Tuesday, August 19, 2014

API to associate AP Bank account to supplier site

API to associate bank account to supplier site in Oracle Applications R12

Important Note: Please visit my posts
'API to create bank in Oracle Applications R12' in this blog to know how to create bank  in Oracle Applications.
'API to create bank branch in Oracle Applications R12' in this blog to know how to create bank branch in Oracle Applications.
'API to create bank account in Oracle Applications R12' in this blog to know how to create bank acoount

r_ext_payee_rec                 iby_disbursement_setup_pub.payeecontext_rec_type;
r_assignment_attribs_rec        iby_fndcpt_setup_pub.pmtinstrassignment_rec_type;
r_instrument_rec                iby_fndcpt_setup_pub.pmtinstrument_rec_type;
x_acct_id NUMBER;
l_party_id NUMBER;
--c_validate_vendor_site_rec is cursor type of cursor crated on site table
--Derive party id of supplier by passing vendor id or name

SELECT party_id
INTO l_party_id
FROM ap_suppliers
WHERE vendor_id = c_validate_vendor_site_rec.vendor_id;

--Derive party site id and vendor site id of supplier site by passing vendor site code and vendor name

SELECT party_site_id,vendor_site_id
INTO v_party_site_id,x_vendor_site_id
FROM ap_supplier_sites_all
WHERE vendor_site_code = c_validate_vendor_site_rec.vendor_site_code
and vendor_id = c_validate_vendor_site_rec.vendor_id;

--Derive ext_bank_account_id by passing account number

SELECT ext_bank_account_id
INTO x_acct_id
FROM iby_ext_bank_accounts
WHERE bank_id = v_bank_party_id
AND branch_id = v_branch_party_id
AND bank_account_num =c_validate_vendor_site_rec.bank_account_number;

r_ext_payee_rec.payment_function :='PAYABLES_DISB';
r_ext_payee_rec.party_id := l_party_id;
r_ext_payee_rec.org_type := 'OPERATING_UNIT';
r_ext_payee_rec.org_id :=c_validate_vendor_site_rec.org_id;
r_ext_payee_rec.party_site_id := v_party_site_id;
r_ext_payee_rec.supplier_site_id :=x_vendor_site_id;
r_instrument_rec.instrument_id := x_acct_id;
r_instrument_rec.instrument_type := 'BANKACCOUNT';
r_assignment_attribs_rec.priority := 1;
r_assignment_attribs_rec.start_date := SYSDATE;
r_assignment_attribs_rec.instrument :=r_instrument_rec;

                              (p_api_version             => 1.0,
                               p_init_msg_list           => fnd_api.g_false,
                               p_commit                  => fnd_api.g_true,
                               x_return_status           => v_return_status_assign,
                               x_msg_count               => x_msg_count,
                               x_msg_data                => x_msg_data,
                               p_payee                   => r_ext_payee_rec,
                               p_assignment_attribs      => r_assignment_attribs_rec,
                               x_assign_id               => x_assign_id,
                               x_response                => x_response_rec
IF v_return_status_account <> 'S'
--print error message or use x_msg_data
x_error_message:=fnd_msg_pub.get_detail (x_msg_count, 'F' );
FOR i IN x_msg_count .. 1
fnd_msg_pub.delete_msg (i);
end if;

1 comment:

  1. Regards
    Sridevi Koduru (Senior Oracle Apps Trainer Oracleappstechnical.com)
    LinkedIn profile - https://in.linkedin.com/in/sridevi-koduru-9b876a8b
    Please Contact for One to One Online Training on Oracle Apps Technical, Financials, SCM, SQL, PL/SQL, D2K at training@oracleappstechnical.com | +91 - 9581017828.