DECLARE
x_return_status VARCHAR2 (200) := NULL;
x_msg_count NUMBER := 0;
x_msg_data VARCHAR2 (200) := NULL;
t_output VARCHAR2 (200) := NULL;
t_msg_dummy VARCHAR2 (200) := NULL;
l_payee_upd_status iby_disbursement_setup_pub.ext_payee_update_tab_type;
p_external_payee_tab_type iby_disbursement_setup_pub.external_payee_tab_type;
p_ext_payee_id_tab_type iby_disbursement_setup_pub.ext_payee_id_tab_type;
i NUMBER := 0;
BEGIN
fnd_msg_pub.delete_msg (NULL);
fnd_msg_pub.initialize;
-- the cursor taking only employee type supplier whose payment method not defined
FOR c1_rec IN (SELECT ieppm.payment_method_code, iepa.payee_party_id,
assa.vendor_site_id, iepa.ext_payee_id,
assa.org_id
FROM ap_supplier_sites_all assa,
ap_suppliers sup,
iby_external_payees_all iepa,
iby_ext_party_pmt_mthds ieppm
WHERE sup.vendor_id = assa.vendor_id
AND assa.pay_site_flag = 'Y'
AND assa.vendor_site_id = iepa.supplier_site_id
AND iepa.ext_payee_id = ieppm.ext_pmt_party_id(+)
AND sup.employee_id IS NOT NULL
AND ieppm.payment_method_code IS NULL
ORDER BY sup.vendor_name, assa.vendor_site_code)
LOOP
i := 0;
i := i + 1;
DBMS_OUTPUT.put_line ('c1_rec.payee_party_id : '
|| c1_rec.payee_party_id
);
DBMS_OUTPUT.put_line ('c1_rec.ext_payee_id: ' || c1_rec.ext_payee_id);
p_external_payee_tab_type (i).default_pmt_method := 'EFT';
p_external_payee_tab_type (i).payment_function := 'PAYABLES_DISB';
p_external_payee_tab_type (i).exclusive_pay_flag := 'N';
p_external_payee_tab_type (i).payee_party_id := c1_rec.payee_party_id;
p_ext_payee_id_tab_type (i).ext_payee_id := c1_rec.ext_payee_id;
p_external_payee_tab_type (i).payer_org_id := c1_rec.org_id;
p_external_payee_tab_type (i).payer_org_type := 'OPERATING_UNIT';
p_external_payee_tab_type (i).supplier_site_id := c1_rec.vendor_site_id;
mo_global.set_policy_context ('S', c1_rec.org_id);
iby_disbursement_setup_pub.update_external_payee
(p_api_version => 1.0,
p_init_msg_list => 'T',
p_ext_payee_tab => p_external_payee_tab_type,
p_ext_payee_id_tab => p_ext_payee_id_tab_type,
x_return_status => x_return_status,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data,
x_ext_payee_status_tab => l_payee_upd_status
);
DBMS_OUTPUT.put_line ('Return Status : ' || x_return_status);
DBMS_OUTPUT.put_line ('Error Message : ' || x_msg_data);
IF x_return_status <> 'S'
THEN
IF x_msg_count > 0
THEN
FOR i IN 1 .. x_msg_count
LOOP
fnd_msg_pub.get (i, fnd_api.g_false, x_msg_data, t_msg_dummy);
DBMS_OUTPUT.put_line ('Error Message : ' || x_msg_data);
t_output := (TO_CHAR (i) || ': ' || x_msg_data);
END LOOP;
END IF;
DBMS_OUTPUT.put_line
( 'Error occurred while updating the Payment Method'
|| t_output
);
END IF;
FOR j IN l_payee_upd_status.FIRST .. l_payee_upd_status.LAST
LOOP
DBMS_OUTPUT.put_line ( 'Error Message from table type : '
|| l_payee_upd_status (j).payee_update_msg
);
END LOOP;
END LOOP;
END;
This blog is very helpfull
ReplyDeletehttps://www.youtube.com/watch?v=dV2omeERo5U
ReplyDelete