Contents
Overview ....................................................................................................................................................... 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...................................................................................................................................... 12
Supplier Bank Account ............................................................................................................................ 14
Updating existing records using API ........................................................................................................... 19
Debugging the API issues ............................................................................................................................ 23
Enabling Debug at User Level ............................................................................................................. 25
References: ................................................................................................................................................. 26
Page 2
Overview
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.
It covers Suppliers, Sites, Contact, Bank, Branch and External Bank Account APIs.
Does not cover Employee type Supplier, automation, customization and legacy data migration.
Page 3
Agenda
end;
Page 4
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 that
does 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.
Page 5
Page 6
Page 7
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.
Page 8
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_id
INTO
l_vendor_site_rec.vendor_id
FROM
ap_suppliers
WHERE 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_id
INTO l_vendor_site_rec.org_id
from hr_operating_units
where 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 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') then
commit;
end if;
end;
Page 9
Update Address
Page 10
Page 11
Supplier Contact
Supplier contact information is just for reference only. It is not used by the system.
Page 12
vendor_id
l_vendor_contact_rec.vendor_id
ap_suppliers
vendor_name = '&Supplier_name';
select organization_id
INTO l_vendor_contact_rec.org_id
from hr_operating_units
where 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 := 'axyz@oracle.com';
-- 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 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') then
commit;
end if;
end;
Page 13
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.
=> 'US'
=> 'BANK_API'
Page 14
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);
Supplier Bank UI
Page 15
--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'
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,
,
,
Page 16
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);
Page 17
upper('&Vendor_Name');--
Page 18
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.
Page 19
Supplier update UI
Page 20
Page 21
Page 22
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.
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
fnd_api.g_false;
begin
/*Initialize to collect the debug log output starts
select user_id INTO l_user_id
from fnd_user where upper(user_name) = upper('&user_name');
select responsibility_id INTO l_responsibility_id
from fnd_responsibility_tl where upper(responsibility_name)
= upper('&responsibility_name');
fnd_global.APPS_INITIALIZE (l_user_id,l_responsibility_id,200);
Page 23
FND_MSG_PUB.initialize;
Initialize to collect the debug log output ends*/
SELECT
INTO
FROM
WHERE
vendor_id
l_vendor_site_rec.vendor_id
ap_suppliers
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_id
INTO l_vendor_site_rec.org_id
from hr_operating_units
where 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 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') then
commit;
end if;
end;//*
*********************************************
To get the AUDSID
need to run in the session of the API script:
*********************************************
select sid,audsid
from v$session
where audsid = sys_context('USERENV', 'SESSIONID')
*********************************************
Output:
144,31542700
19
31543786
*********************************************
select *
from fnd_log_messages A
where A.user_id='1318'
and A.audsid = '31542700'
and timestamp > sysdate-1
order by log_sequence desc;
******************
API Script Output:
******************
5
U
1. This Site name already exists for this supplier.
Re-enter.
2. Supplier Site Info is duplicate
Page 24
3. VENDOR_SITE_CODE is invalid
4. 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.
*/
Page 25
References:
Oracle Payments Implementation Guide
Oracle iSupplier Portal User's Guide
Oracle Supplier Management Implementation and Administration Guide
Page 26