Supplier Bank Account API v1.1

  • Upload
    nthack

  • View
    335

  • Download
    7

Embed Size (px)

Citation preview

  • 7/26/2019 Supplier Bank Account API v1.1

    1/26

    Oracle Applications White Paper

    White Paper on Supplier and Bank

    Account API in R12Author: Satyanarayana Ale & Soundararajan RagavanCreation Date: 01-November-2014

    Last Updated: 27-October-2015

    Version: 1.1

    Status: FINAL

    To help API users:

    Understand the API structure

    Design anonymous block

    Create/update records in Applications through API

    Debug the common errors in API execution.

  • 7/26/2019 Supplier Bank Account API v1.1

    2/26

    Supplier and Bank Account API in R12 Page 2

    ContentsOverview ....................................................................................................................................................... 3

    Objective ....................................................................................................................................................... 3

    Scope ............................................................................................................................................................. 3

    Agenda .......................................................................................................................................................... 4

    Designing Anonymous Block ......................................................................................................................... 4

    Sample Anonymous Block ............................................................................................................................. 4

    Suppliers/Vendors Creation (Master Data) .................................................................................................. 5

    Supplier Site .............................................................................................................................................. 8

    Supplier Contact ...................................................................................................................................... 12Supplier Bank Account ............................................................................................................................ 14

    Updating existing records using API ........................................................................................................... 19

    Debugging the API issues ............................................................................................................................ 23

    Enabling Debug at User Level ............................................................................................................. 25

    References: ................................................................................................................................................. 26

  • 7/26/2019 Supplier Bank Account API v1.1

    3/26

    Supplier and Bank Account API in R12 Page 3

    Overview API stands for Application Programming Interface.

    While APIs themselves are not new, we are now entering a chapter, which opens a whole new

    spectrum of possibilities. It helps and acts as a master data upload in scant of interface import

    program When talking about API management, the first thing that comes to mind is a public API,one that is open for anybody to consume, provided a certain level of registration exists.

    Public APIs : These are designed for customers and Oracle consultants to integrate non-Oracle

    systems into Oracle e-Business Suite or to extend the functionality of the base products. Oracle

    does not support public APIs unless they are published in a reference manual.

    Private APIs : Private API's are one which Oracle normally using internal, development purpose

    only. Details are not provided to anyone outside of the immediate development environment,

    nor are they intended for use by anyone outside of the e-Business Suite development

    environment.

    Objective Oracle Applications use APIs to insert and update data in Oracle Applications. APIs are stored

    procedures that enable you to insert and update data in Oracle Applications.

    For example, by using APIs, you can insert a Supplier record in Oracle Applications

    Objective: To help understanding technical insight with various Payables Public APIs usage and

    debugging techniques. This paper is written with the intention of helping implementers and

    those supporting the applications to understand how API works.

    Scope This white paper covers the overview of Payables Specific Public APIs with technical structure

    and usage.

    To give technical insight with API execution and debugging techniques

    It covers Suppliers, Sites, Contact, Bank, Branch and External Bank Account APIs.

    Does not cover Employee type Supplier, automation, customization and legacy data migration.

  • 7/26/2019 Supplier Bank Account API v1.1

    4/26

    Supplier and Bank Account API in R12 Page 4

    Agenda Designing Anonymous Block

    Execution method of API

    Debug Script Incorporation

    Steps to generate FND Debug log

    Designing Anonymous Block

    Structure :

    declare

    ;

    begin;

    ;

    End;

    Sample Anonymous Block

    declare

    l_party_id number;l_branchaddress_rec HZ_PARTY_SITE_V2PUB.party_site_rec_type;--Variable declared with default Value:l_api_version number :=1;

    beginl_party_site_id := &party_site_id;HZ_PARTY_SITE_V2PUB.create_party_site (

    p_init_msg_list => l_init_msg_list,p_party_site_rec => l_branchaddress_rec ,x_party_site_id => l_party_site_id,

    x_party_site_number => l_party_site_number,x_return_status => l_return_status ,

    x_msg_count => l_msg_count,x_msg_data => l_msg_data

    );end;

  • 7/26/2019 Supplier Bank Account API v1.1

    5/26

    Supplier and Bank Account API in R12 Page 5

    Suppliers/Vendors Creation (Master Data)

    Suppliers Overview : Set up and maintain suppliers in the Suppliers pages to record information

    about individuals and companies from whom you purchase goods and services. You can also

    enter employees whom you reimburse for expense reports. When you enter a supplier thatdoes business from multiple locations, you store supplier information only once, and enter

    supplier addresses for each location. You can designate supplier addresses as payment,

    purchasing, RFQ only, or procurement card locations.

    For example, for a single supplier, you can buy from several different addresses and send

    payments to several different addresses. Most supplier information automatically defaults to all

    supplier sites to facilitate supplier site entry. However, you can override these defaults and have

    unique information for each site.

    Note : Suppliers can have multiple addresses and each address can be used by an operating unit

    through a supplier site record.

    The Oracle eBusiness Suite has a single repository called the Trading Community Architecture

    (TCA) to store information about your trading partners.

    Create Supplier API Execution:

    SQL>@Create_Vendor_API

    Parameters:

    -- Required

    l_vendor_rec.vendor_name := 'Supplier API';

    -- Optional

    l_vendor_rec.vendor_name_alt := 'DEMO001';

    l_vendor_rec.start_date_active := sysdate - 1;

  • 7/26/2019 Supplier Bank Account API v1.1

    6/26

    Supplier and Bank Account API in R12 Page 6

    Create Supplier API Script:

    --Here Package pos_vendor_pub_pkg has been used to create vendor and site.

    --For the same purpose alternately AP_VENDOR_PUB_PKG can be used.

    --In this document AP_VENDOR_PUB_PKG is also used in FND log messages sample script.

    --Note: For updates only AP_VENDOR_PUB_PKG is supported

    set serveroutput on;DECLARE

    l_vendor_rec ap_vendor_pub_pkg.r_vendor_rec_type;l_return_status VARCHAR2(10);l_msg_count NUMBER;l_msg_data VARCHAR2(1000);l_vendor_id NUMBER;l_party_id NUMBER;

    BEGIN---- Required----l_vendor_rec.segment1 := '&Supplier_no.';--Required in case of manual numberingl_vendor_rec.vendor_name := '&Supplier_Name';

    ---- Optional--l_vendor_rec.vendor_name_alt := '&Alternate_Name';l_vendor_rec.start_date_active := sysdate - 1;

    -- etc.. --

    pos_vendor_pub_pkg.create_vendor(p_vendor_rec => l_vendor_rec,x_return_status => l_return_status,x_msg_count => l_msg_count,x_msg_data => l_msg_data,x_vendor_id => l_vendor_id,x_party_id => l_party_id);

    COMMIT;

    dbms_output.put_line('return_status: '||l_return_status);dbms_output.put_line('msg_data: '||l_msg_data);dbms_output.put_line('vendor_id: '||l_vendor_id);dbms_output.put_line('party_id: '||l_party_id);

    END;/

  • 7/26/2019 Supplier Bank Account API v1.1

    7/26

    Supplier and Bank Account API in R12 Page 7

    Post API execution SupplierUI

  • 7/26/2019 Supplier Bank Account API v1.1

    8/26

    Supplier and Bank Account API in R12 Page 8

    Supplier Site

    Site : Supplier Site is typically address and pay site. Address from where the goods/services are

    supplied and buyers to remit the payments. Unique supplier site name that distinguishes the

    site from a supplier's other sites.

    For example, city name or branch name. This name is for your reference when selecting sites

    from a list of values during purchase order or invoice entry, and will not appear on any

    correspondence with the supplier.

    Address: Depending on the address parameter values, an existing address is used or a new

    address will be created. Can verify it with the party_site_id.

    Supplier Site API Execution:

    SQL>@Create_Vendor_Site_API

    Parameters:

    vendor_name = 'Supplier API

    vendor_site_code := 'Site API';

    address_line1 := '300 Oracle Parkway';

    city := 'Redwood City';

    state := 'CA';

    country := 'US';

    Operating unit := 'Vision Operations';

    purchasing_site_flag := 'Y';

    pay_site_flag := 'Y';

  • 7/26/2019 Supplier Bank Account API v1.1

    9/26

    Supplier and Bank Account API in R12 Page 9

    Create_Vendor_Site_API Script:

    set serveroutput on;DECLARE

    l_vendor_site_rec ap_vendor_pub_pkg.r_vendor_site_rec_type;l_return_status VARCHAR2(10);l_msg_count NUMBER;

    l_msg_data VARCHAR2(1000);l_vendor_site_id NUMBER;l_party_site_id NUMBER;l_location_id NUMBER;

    BEGIN---- Required--SELECT vendor_idINTO l_vendor_site_rec.vendor_idFROM ap_suppliersWHERE vendor_name = '&Supplier_Name';

    l_vendor_site_rec.vendor_site_code := '&Supp_Site_Code';l_vendor_site_rec.address_line1 := '&Address';l_vendor_site_rec.city := '&City';

    l_vendor_site_rec.state := '&State';l_vendor_site_rec.country := '&Country';

    select organization_idINTO l_vendor_site_rec.org_idfrom hr_operating_unitswhere upper(name) = upper('&operating_unit');

    l_vendor_site_rec.purchasing_site_flag := 'Y';--l_vendor_site_rec.rfq_only_site_flag := 'N';l_vendor_site_rec.pay_site_flag := 'Y';---- Optional----l_vendor_site_rec.phone := '123123123';

    -- etc... --

    pos_vendor_pub_pkg.create_vendor_site(p_vendor_site_rec => l_vendor_site_rec,x_return_status => l_return_status,x_msg_count => l_msg_count,x_msg_data => l_msg_data,x_vendor_site_id => l_vendor_site_id,x_party_site_id => l_party_site_id,x_location_id => l_location_id);

    DBMS_OUTPUT.put_line(l_vendor_site_id);DBMS_OUTPUT.put_line('message count: '||l_msg_count);DBMS_OUTPUT.put_line('return status: '||l_return_status);DBMS_OUTPUT.put_line(l_msg_data);

    IF l_msg_count >1 THEN FOR I IN 1..l_msg_count LOOPdbms_output.put_line(I||'. '||SubStr(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE ), 1, 255));

    END LOOP; END IF;

    if (l_return_status = 'S') then

    commit;end if;end;

  • 7/26/2019 Supplier Bank Account API v1.1

    10/26

    Supplier and Bank Account API in R12 Page 10

    Supplier Address Screen from ApplicationsUI

    Update Address

  • 7/26/2019 Supplier Bank Account API v1.1

    11/26

    Supplier and Bank Account API in R12 Page 11

    Post APISupplier Site UI

  • 7/26/2019 Supplier Bank Account API v1.1

    12/26

    Supplier and Bank Account API in R12 Page 12

    Supplier Contact

    Supplier contact information is just for reference only. It is not used by the system.

    This can be viewed from UI as follows:

    Access the Suppliers: Contact Directory page to enter contact information.

    Supplier Contact API Script

    SQL>@Create_Vendor_Contact-API.sql

    Parameters:

    vendor_name := 'Supplier API';

    org_id := '204';

    person_first_name := 'A';

    person_last_name := 'XYZ';

  • 7/26/2019 Supplier Bank Account API v1.1

    13/26

    Supplier and Bank Account API in R12 Page 13

    Supplier Contact API Script

    set serveroutput on;DECLARE

    l_vendor_contact_rec ap_vendor_pub_pkg.r_vendor_contact_rec_type;l_return_status VARCHAR2(10);l_msg_count NUMBER;l_msg_data VARCHAR2(1000);l_vendor_contact_id NUMBER;l_per_party_id NUMBER;l_rel_party_id NUMBER;l_rel_id NUMBER;l_org_contact_id NUMBER;l_party_site_id NUMBER;

    BEGIN---- Required--

    SELECT vendor_idINTO l_vendor_contact_rec.vendor_idFROM ap_suppliersWHERE vendor_name = '&Supplier_name';

    select organization_idINTO l_vendor_contact_rec.org_idfrom hr_operating_unitswhere upper(name) = upper('&operating_unit') ;l_vendor_contact_rec.person_first_name := '&First_Name';l_vendor_contact_rec.person_last_name := '&Last_Name';

    ---- Optional----l_vendor_contact_rec.phone := '12343210';--l_vendor_contact_rec.email_address := '[email protected]';-- etc... --

    pos_vendor_pub_pkg.create_vendor_contact(p_vendor_contact_rec => l_vendor_contact_rec,

    x_return_status => l_return_status,x_msg_count => l_msg_count,x_msg_data => l_msg_data,x_vendor_contact_id => l_vendor_contact_id,x_per_party_id => l_per_party_id,x_rel_party_id => l_rel_party_id,x_rel_id => l_rel_id,x_org_contact_id => l_org_contact_id,x_party_site_id => l_party_site_id);

    dbms_output.put_line('return_status: '||l_return_status);dbms_output.put_line('msg_data: '||l_msg_data);dbms_output.put_line('vendor_contact_id: '||l_vendor_contact_id);dbms_output.put_line('party_site_id: '||l_party_site_id);dbms_output.put_line('per_party_id: '||l_per_party_id);dbms_output.put_line('rel_party_id: '||l_rel_party_id);dbms_output.put_line('rel_id: '||l_rel_id);

    dbms_output.put_line('org_contact_id: '||l_org_contact_id);

    IF l_msg_count >=1 THEN FOR I IN 1..l_msg_count LOOPdbms_output.put_line(I||'. '||SubStr(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE ), 1, 255));END LOOP; END IF;

    if (l_return_status = 'S') then

    commit;end if;end;

  • 7/26/2019 Supplier Bank Account API v1.1

    14/26

    Supplier and Bank Account API in R12 Page 14

    Supplier Bank Account

    Supplier Bank Accounts are required to pay electronically.

    Bank Account information can be viewed from UI as follows:

    Access the Suppliers: Banking Details page to record the supplier bank accounts that your

    suppliers and supplier sites use for payment transactions

    In order to create bank account, a Bank and Branch are required. Either these can be created as

    new or use existing ones.

    Using API, if new Bank and Branch are to be created, then need to create the same first before

    creating Bank Account.

    Supplier Bank API Execution

    SQL>@BANK_API_CREATE.sql

    Parameters:

    p_country_code => 'US'

    p_bank_name => 'BANK_API'

    Supplier Bank API Script:

    set serveroutput on;declare--l_vendor_rec ap_vendor_pub_pkg.r_vendor_rec_type;l_api_version number := 1;l_init_msg_list VARCHAR2 (30) DEFAULT fnd_api.g_false;

    l_validation_level NUMBER DEFAULT FND_API.G_VALID_LEVEL_FULL;l_msg_data VARCHAR2 (1000);l_msg_count NUMBER;l_return_status VARCHAR2 (100);l_bank_id NUMBER;l_party_id NUMBER;

    begin--Intializing the Message Pub API.

    FND_MSG_PUB.initialize;ce_bank_pub.create_bank

    ( p_init_msg_list => l_init_msg_list ,p_country_code => '&Country_Code',p_bank_name => '&Bank_Name',p_bank_number => NULL,p_alternate_bank_name => NULL,

    p_short_bank_name => NULL,p_description => NULL,p_tax_payer_id => NULL,p_tax_registration_number => NULL,p_attribute_category => NULL,p_attribute1 => NULL,p_attribute2 => NULL,p_attribute3 => NULL,p_attribute4 => NULL,p_attribute5 => NULL,p_attribute6 => NULL,p_attribute7 => NULL,

  • 7/26/2019 Supplier Bank Account API v1.1

    15/26

    Supplier and Bank Account API in R12 Page 15

    p_attribute8 => NULL,p_attribute9 => NULL,p_attribute10 => NULL,p_attribute11 => NULL,p_attribute12 => NULL,p_attribute13 => NULL,p_attribute14 => NULL,p_attribute15 => NULL,

    p_attribute16 => NULL,p_attribute17 => NULL,p_attribute18 => NULL,p_attribute19 => NULL,p_attribute20 => NULL,p_attribute21 => NULL,p_attribute22 => NULL,p_attribute23 => NULL,p_attribute24 => NULL,x_bank_id => l_bank_id,x_return_status => l_return_status ,x_msg_count => l_msg_count,x_msg_data => l_msg_data);

    DBMS_OUTPUT.put_line(l_bank_id);DBMS_OUTPUT.put_line(l_return_status);DBMS_OUTPUT.put_line(l_msg_data);

    IF l_msg_count >1 THEN FOR I IN 1..l_msg_count LOOPdbms_output.put_line(I||'. '||SubStr(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE ), 1, 255));END LOOP; END IF;

    if (l_return_status = 'S') thencommit;end if;end;

    Supplier Bank UI

    Supplier Bank Branch API Execution

    SQL>@BANK_BRANCH_API_CREATE.sql

    Parameters:

    bank_id => 628797

  • 7/26/2019 Supplier Bank Account API v1.1

    16/26

    Supplier and Bank Account API in R12 Page 16

    --Note: Below SQL has been used in API to retrieve Bank id.

    --select bank_party_id

    --from ce_banks_v

    --where upper(bank_name) = upper('&Bank_Name')

    branch_name => 'BRANCH_API'

    Supplier Bank Branch API Script:

    set serveroutput on;declarel_api_version number := 1;l_init_msg_list VARCHAR2 (30) DEFAULT fnd_api.g_false;l_validation_level NUMBER DEFAULT FND_API.G_VALID_LEVEL_FULL;l_msg_data VARCHAR2 (1000);l_msg_count NUMBER;l_return_status VARCHAR2 (100);l_branch_id NUMBER;l_party_id NUMBER;l_bank_id NUMBER;

    begin

    --Intializing the Message Pub API.FND_MSG_PUB.initialize;

    select bank_party_idINTO l_bank_idfrom ce_banks_vwhere upper(bank_name) = upper('&Bank_Name');

    ce_bank_pub.create_bank_branch( p_init_msg_list => l_init_msg_list ,

    p_bank_id => l_bank_id ,p_branch_name => '&Branch_Name',p_branch_number => NULL,p_branch_type => NULL,p_alternate_branch_name=> NULL,p_description => NULL,p_bic => NULL,p_eft_number => NULL,p_rfc_identifier => NULL,p_attribute_category=>NULL,p_attribute1 => NULL,p_attribute2 => NULL,p_attribute3 => NULL,p_attribute4 => NULL,p_attribute5 => NULL,p_attribute6 => NULL,p_attribute7 => NULL,p_attribute8 => NULL,p_attribute9 => NULL,p_attribute10 => NULL,p_attribute11 => NULL,p_attribute12 => NULL,p_attribute13 => NULL,

    p_attribute14 => NULL,p_attribute15 => NULL,p_attribute16 => NULL,p_attribute17 => NULL,p_attribute18 => NULL,p_attribute19 => NULL,p_attribute20 => NULL,p_attribute21 => NULL,p_attribute22 => NULL,p_attribute23 => NULL,p_attribute24 => NULL,x_branch_id => l_branch_id,

  • 7/26/2019 Supplier Bank Account API v1.1

    17/26

    Supplier and Bank Account API in R12 Page 17

    x_return_status => l_return_status ,x_msg_count => l_msg_count,x_msg_data => l_msg_data);

    DBMS_OUTPUT.put_line(l_branch_id);DBMS_OUTPUT.put_line(l_return_status);DBMS_OUTPUT.put_line(l_msg_data);

    IF l_msg_count >1 THEN FOR I IN 1..l_msg_count LOOP

    dbms_output.put_line(I||'. '||SubStr(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE ), 1,255));END LOOP; END IF;

    if (l_return_status = 'S') thencommit;end if;end;

    Supplier Bank Branch UI

    Supplier Bank Account API Execution:

    SQL>@EXT_BANK_ACC_API_CREATE_ASG.sql

    Parameters:

    bank_account_num := 609792;

    branch_id := 628799;

    bank_id := 628797;

    acct_owner_party_id := 609792;

    country_code := 'US';

    bank_account_name := 'ACCOUNT_API';

    --Note : Below SQL has been used in API to retrieve Bank, Branch and party id.

  • 7/26/2019 Supplier Bank Account API v1.1

    18/26

    Supplier and Bank Account API in R12 Page 18

    --select bank_party_id, branch_party_id--from ce_bank_branches_v--where upper(bank_name) = upper('&Bank_name')--and upper(bank_branch_name) = upper('&Branch_name');

    --select party_id--from ap_suppliers--where upper(Vendor_name)= upper('&Vendor_Name');--

    Supplier Bank Account API Script:

    set serveroutput on;declarel_extbank_rec iby_ext_bankacct_pub.extbankacct_rec_type;l_resp iby_fndcpt_common_pub.result_rec_type;l_joint_acct_owner_id NUMBER;l_msg_data VARCHAR2 (1000);l_msg_count NUMBER;l_assign_id NUMBER;l_return_status VARCHAR2 (100);l_return_status1 VARCHAR2 (100);l_bank_account_id NUMBER;l_party_id number;l_api_version number := 1;

    l_init_msg_list VARCHAR2 (30) DEFAULT fnd_api.g_false;l_commit VARCHAR2 (30) DEFAULT fnd_api.g_true;l_rec IBY_EXT_BANKACCT_PUB.ExtBankAcct_rec_type;/*l_assign IBY_FNDCPT_SETUP_PUB.PmtInstrAssignment_rec_type;l_payment_function CONSTANT VARCHAR2(30) := 'PAYABLES_DISB';l_instrument_type CONSTANT VARCHAR2(30) := 'BANKACCOUNT';l_association_level VARCHAR2(2) ;*/

    begin--Intializing the Message Pub API.

    FND_MSG_PUB.initialize;

    l_rec.bank_account_num := '&Bank_Account_number';

    select bank_party_id, branch_party_idINTO l_rec.bank_id,l_rec.branch_idfrom ce_bank_branches_v

    where upper(bank_name) = upper('&Bank_name')and upper(bank_branch_name) = upper('&Branch_name');

    select party_idINTO l_rec.acct_owner_party_idfrom ap_supplierswhere upper(Vendor_name)= upper('&Vendor_Name');-- party_id = 609792l_rec.country_code := '&Country_code';l_rec.bank_account_name := '&Bank_account_name';

    iby_ext_bankacct_pub.create_ext_bank_acct (p_api_version => l_api_version,p_init_msg_list => l_init_msg_list,p_ext_bank_acct_rec => l_rec,p_association_level => 'S',p_supplier_site_id => NULL,p_party_site_id => NULL,

    p_org_id => NULL,p_org_type => NULL,x_acct_id => l_bank_account_id ,x_return_status => l_return_status,x_msg_count => l_msg_count,x_msg_data => l_msg_data,x_response => l_resp);

    DBMS_OUTPUT.put_line(l_bank_account_id);DBMS_OUTPUT.put_line(l_return_status);

  • 7/26/2019 Supplier Bank Account API v1.1

    19/26

    Supplier and Bank Account API in R12 Page 19

    IF l_msg_count >1 THEN FOR I IN 1..l_msg_count LOOPdbms_output.put_line(I||'. '||SubStr(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE ), 1, 255));END LOOP;END IF;

    if (l_return_status = 'S') thencommit;end if;

    end;

    Supplier Bank Account Screen from Applications UI

    Updating existing records using API API can be used to update existing records if number of records to be updated is high in volume.

    In this document, updating Supplier and Site using API are described.

    Update Supplier API Execution:

    SQL>@Update_Vendor_API.SQL

    Parameters:

  • 7/26/2019 Supplier Bank Account API v1.1

    20/26

    Supplier and Bank Account API in R12 Page 20

    vendor_name = 'Supplier API

    vendor_type_lookup_code := 'Contractor';

    Update Supplier API Script:

    set serveroutput on;DECLAREl_vendor_rec ap_vendor_pub_pkg.r_vendor_rec_type;l_return_status VARCHAR2(10);l_msg_count NUMBER;l_msg_data VARCHAR2(1000);l_vendor_id NUMBER;l_party_id NUMBER;

    BEGIN---- Required--SELECT vendor_idINTO l_vendor_rec.vendor_idFROM ap_suppliersWHERE vendor_name = '&supplier_name';

    ---- Optional--

    l_vendor_rec.vendor_type_lookup_code := '&Vendortype';--l_vendor_rec.vendor_name_alt := '&vendornamealt';-- For example,--l_vendor_rec.vendor_type_lookup_code := 'Contractor';--l_vendor_rec.vendor_name_alt := 'Advantage Corp Testing';-- etc.. --AP_VENDOR_PUB_PKG.update_vendor_public(p_api_version => 1,x_return_status => l_return_status,x_msg_count => l_msg_count,x_msg_data => l_msg_data,p_vendor_rec => l_vendor_rec,p_vendor_id => l_vendor_rec.vendor_id);COMMIT;dbms_output.put_line('return_status: '||l_return_status);

    dbms_output.put_line('msg_data: '||l_msg_data);END;/

    Supplier updateUI

  • 7/26/2019 Supplier Bank Account API v1.1

    21/26

    Supplier and Bank Account API in R12 Page 21

    Update Supplier Site API Execution Parameters:

    SQL>@Update_Vendor_Site_API.sql

    vendor_name = 'Supplier API'

    vendor_site_code = 'Site API'

    auto_tax_calc_flag:= 'Y ';

    Update Supplier Site API Script:

    set serveroutput on;DECLAREl_vendor_site_rec ap_vendor_pub_pkg.r_vendor_site_rec_type;l_return_status VARCHAR2(10);l_msg_count NUMBER;l_msg_data VARCHAR2(1000);BEGIN---- Required--SELECT vendor_id

    INTO l_vendor_site_rec.vendor_idFROM ap_suppliersWHERE vendor_name = '&supplier_name';SELECT vendor_site_idINTO l_vendor_site_rec.vendor_site_idFROM ap_supplier_sites_allWHERE vendor_id = l_vendor_site_rec.vendor_id ANDvendor_site_code = '&Supplier_site_code';select organization_idINTO l_vendor_site_rec.org_idfrom hr_operating_unitswhere upper(name) = upper('&operating_unit');--Note : For example we are modifying automatic tax calculation to Yesl_vendor_site_rec.auto_tax_calc_flag:= 'Y';-- etc... --AP_VENDOR_PUB_PKG.Update_Vendor_Site_public ( p_api_version => 1,--x_return_status => l_return_status, --

    x_msg_count => l_msg_count, --x_msg_data => l_msg_data, --p_vendor_site_rec => l_Vendor_site_Rec, --p_Vendor_site_Id => l_vendor_site_rec.vendor_site_id);

    COMMIT;dbms_output.put_line('return_status: '||l_return_status);dbms_output.put_line('msg_data: '||l_msg_data);END;

  • 7/26/2019 Supplier Bank Account API v1.1

    22/26

    Supplier and Bank Account API in R12 Page 22

    Supplier Site updateUI

  • 7/26/2019 Supplier Bank Account API v1.1

    23/26

    Supplier and Bank Account API in R12 Page 23

    Debugging the API issues In most of the cases, server output error message may not be sufficient to understand the actual

    cause of the error during API execution. Hence need to collect FND log messages for the API

    execution process in order to analyze the issue in detail.

    Log messages steps:

    STEP 1:

    Enable FND Logging using system administrator responsibility by setting the following profiles at user level.

    FND: Debug Log Enabled -- Yes

    FND: Debug Log Level -- Statement

    FND: Debug Log Module -- %

    STEP 2:

    Execute API script in issue

    STEP 3:

    Use below SQL from the API script session to get AUDSID:

    select sid,audsid

    from v$session

    where audsid = sys_context('USERENV', 'SESSIONID')

    STEP 4:

    Use the below SQL to collect the debug log messages

    select * from fnd_log_messages

    where audsid = &audsid'

    and timestamp > sysdate-1

    order by log_sequence desc;

    Sample Script with FND log Messages Initialize:

    set serveroutput ondeclarel_resp_id number;l_user_id number;l_vendor_site_rec ap_vendor_pub_pkg.r_vendor_site_rec_type;l_api_version number := 1;l_init_msg_list VARCHAR2 (30) DEFAULT fnd_api.g_false;l_validation_level NUMBER DEFAULT FND_API.G_VALID_LEVEL_FULL;l_msg_data VARCHAR2 (1000);l_msg_count NUMBER;l_return_status VARCHAR2 (100);l_vendor_site_id NUMBER;l_party_site_id NUMBER;l_location_id NUMBER;l_user_id NUMBER;l_responsibility_id NUMBER;

    begin/*Initialize to collect the debug log output startsselect user_id INTO l_user_idfrom fnd_user where upper(user_name) = upper('&user_name');

    select responsibility_id INTO l_responsibility_idfrom fnd_responsibility_tl where upper(responsibility_name) = upper('&responsibility_name');

    fnd_global.APPS_INITIALIZE (l_user_id,l_responsibility_id,200);

  • 7/26/2019 Supplier Bank Account API v1.1

    24/26

    Supplier and Bank Account API in R12 Page 24

    FND_MSG_PUB.initialize;Initialize to collect the debug log output ends*/

    SELECT vendor_idINTO l_vendor_site_rec.vendor_idFROM ap_suppliersWHERE vendor_name = '&Supplier_Name';

    l_vendor_site_rec.vendor_site_code := '&Supp_Site_Code';l_vendor_site_rec.address_line1 := '&Address';l_vendor_site_rec.city := '&City';l_vendor_site_rec.state := '&State';l_vendor_site_rec.country := '&Country';

    select organization_idINTO l_vendor_site_rec.org_idfrom hr_operating_unitswhere upper(name) = upper('&operating_unit');

    AP_VENDOR_PUB_PKG.Create_Vendor_Site( p_api_version => l_api_version,

    p_init_msg_list => l_init_msg_list,p_commit => l_init_msg_list,p_validation_level => l_validation_level,x_return_status => l_return_status,

    x_msg_count => l_msg_count,x_msg_data => l_msg_data,p_vendor_site_rec => l_vendor_site_rec,x_vendor_site_id => l_vendor_site_id,x_party_site_id => l_party_site_id,x_location_id => l_location_id);

    DBMS_OUTPUT.put_line(l_vendor_site_id);DBMS_OUTPUT.put_line(l_msg_count);DBMS_OUTPUT.put_line(l_return_status);DBMS_OUTPUT.put_line(l_msg_data);IF l_msg_count >1 THEN FOR I IN 1..l_msg_count LOOPdbms_output.put_line(I||'. '||SubStr(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE ), 1, 255));END LOOP; END IF;if (l_return_status = 'S') thencommit;end if;end;//*

    *********************************************To get the AUDSIDneed to run in the session of the API script:*********************************************select sid,audsidfrom v$sessionwhere audsid = sys_context('USERENV', 'SESSIONID')*********************************************Output:144,3154270019 31543786*********************************************select *from fnd_log_messages Awhere A.user_id='1318'and A.audsid = '31542700'and timestamp > sysdate-1

    order by log_sequence desc;

    ******************API Script Output:******************5U

    1. This Site name already exists for this supplier.

    Re-enter.2. Supplier Site Info is duplicate

  • 7/26/2019 Supplier Bank Account API v1.1

    25/26

    Supplier and Bank Account API in R12 Page 25

    3. VENDOR_SITE_CODE is invalid4. Address/PartySite name already exists for the Supplier. Please re-enter a unique one.5. Invalid Payee context values. Org parameters exist only with party site and supplier site.*/

    Enabling Debug at User Level

  • 7/26/2019 Supplier Bank Account API v1.1

    26/26

    References:

    Oracle Payments Implementation Guide

    Oracle iSupplier Portal User's Guide

    Oracle Supplier Management Implementation and Administration Guide