-------------supplier
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;
--------------------------------local variables ----------------
l_segment1 VARCHAR2(240) := 'Test4';
l_vendor_name VARCHAR2(240) := 'Test4';
l_vendor_name_alt VARCHAR2(240) := 'Test4';
--------------------------------------------------
BEGIN
--
-- Required
--
l_vendor_rec.segment1 := l_segment1;
l_vendor_rec.vendor_name := l_vendor_name;
--
-- Optional
--
l_vendor_rec.vendor_name_alt := l_vendor_name_alt;
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;
--Verify
/*
select * from ap_suppliers
where segment1 = 'Test1'
select * from hz_parties
where
party_id = 10167490
*/
--------------------------------------------------------------------------------------------
-----------Supplier Site
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;
--------------------------local variables--------
l_supp_number varchar2(200) := 'Test4';
l_supp_site_code varchar2(200):= 'Fujairah'; --dont change this
l_address_line1 varchar2(200):= 'Address line 1, Fujairah';
--city varchar2(200):= 'Fujairah';
--state varchar2(200):= 'Fujairah';
l_country varchar2(200):= 'AE'; --dont change this
--purchasing_site_flag varchar2(200):= 'Y';
--pay_site_flag varchar2(200):= 'Y';
l_operating_unit varchar2(200) := 'XXFujairah'; --1770
l_prepay_code_combination_id number := 3351157;
l_email_address varchar2(200):= 'contact1@test.com';
l_phone varchar2(200):= '+9715';
l_fax varchar2(200):= '+971555';
BEGIN
--
-- Required
--
SELECT vendor_id
INTO l_vendor_site_rec.vendor_id
FROM ap_suppliers
WHERE
segment1 = l_supp_number
;
l_vendor_site_rec.vendor_site_code := l_supp_Site_Code;
l_vendor_site_rec.vendor_site_code_alt := l_supp_Site_Code;
l_vendor_site_rec.address_line1 := l_address_line1;
--l_vendor_site_rec.city := City;
--l_vendor_site_rec.state := State;
l_vendor_site_rec.country := l_country;
select organization_id
INTO l_vendor_site_rec.org_id
from hr_operating_units
where upper(name) = upper(l_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';
l_vendor_site_rec.primary_pay_site_flag := 'Y';
l_vendor_site_rec.prepay_code_combination_id := l_prepay_code_combination_id ;
l_vendor_site_rec.email_address := l_email_address;
l_vendor_site_rec.phone := l_phone;
l_vendor_site_rec.FAX := l_fax;
--
-- 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;
--to update supplier site
--AP_VENDOR_PUB_PKG.Update_Vendor_Site_public
--verify:
--select PREPAY_CODE_COMBINATION_ID, vendor_id
--select * from ap_supplier_sites_all where vendor_id = 868744 --> 3351157
--select * from ap_suppliers where vendor_name = 'Test1'
-------------------------------------------------------------------------------------------------------------------
----------------------------------Supplier contact---------------------------------
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;
--Variables:
l_vendor_name varchar2(200) := 'Test4';
l_org_id varchar2(200) := 1770;
l_person_first_name varchar2(200):= 'Afzal';
l_person_last_name varchar2(200):= 'Abdur Rahman';
l_operating_unit varchar2(200) := 'Fujairah National Catering Est. FNCE'; --1770
l_email_address varchar2(200):= 'contact1@test.com';
l_phone varchar2(200):= '+971555265290';
l_fax_phone varchar2(200):= '+971555265292';
BEGIN
--
-- Required
--
SELECT vendor_id
INTO l_vendor_contact_rec.vendor_id
FROM ap_suppliers
WHERE vendor_name = l_vendor_name;
select organization_id
INTO l_vendor_contact_rec.org_id
from hr_operating_units
where upper(name) = upper(l_operating_unit) ;
l_vendor_contact_rec.person_first_name := l_person_first_name;
l_vendor_contact_rec.person_last_name := l_person_last_name;
l_vendor_contact_rec.email_address := l_email_address;
l_vendor_contact_rec.phone := l_phone;
l_vendor_contact_rec.FAX_PHONE := l_fax_phone;
--
-- 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;
--parameters can be find more from below package, as the above api is calling below package.
--ap_vendor_pub_pkg.create_vendor_contact
---------------------------------------------------------------------------------------------------------------
Adding above supplier to different org:
http://mogalafzal.blogspot.ae/2016/07/adding-new-ous-to-existing-supplier.html
post to view above 3 blocks as package and upload mutliple suppliers:
http://mogalafzal.blogspot.ae/2018/03/oracle-apps-r12-api-to-create-supplier_66.html
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;
--------------------------------local variables ----------------
l_segment1 VARCHAR2(240) := 'Test4';
l_vendor_name VARCHAR2(240) := 'Test4';
l_vendor_name_alt VARCHAR2(240) := 'Test4';
--------------------------------------------------
BEGIN
--
-- Required
--
l_vendor_rec.segment1 := l_segment1;
l_vendor_rec.vendor_name := l_vendor_name;
--
-- Optional
--
l_vendor_rec.vendor_name_alt := l_vendor_name_alt;
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;
--Verify
/*
select * from ap_suppliers
where segment1 = 'Test1'
select * from hz_parties
where
party_id = 10167490
*/
--------------------------------------------------------------------------------------------
-----------Supplier Site
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;
--------------------------local variables--------
l_supp_number varchar2(200) := 'Test4';
l_supp_site_code varchar2(200):= 'Fujairah'; --dont change this
l_address_line1 varchar2(200):= 'Address line 1, Fujairah';
--city varchar2(200):= 'Fujairah';
--state varchar2(200):= 'Fujairah';
l_country varchar2(200):= 'AE'; --dont change this
--purchasing_site_flag varchar2(200):= 'Y';
--pay_site_flag varchar2(200):= 'Y';
l_operating_unit varchar2(200) := 'XXFujairah'; --1770
l_prepay_code_combination_id number := 3351157;
l_email_address varchar2(200):= 'contact1@test.com';
l_phone varchar2(200):= '+9715';
l_fax varchar2(200):= '+971555';
BEGIN
--
-- Required
--
SELECT vendor_id
INTO l_vendor_site_rec.vendor_id
FROM ap_suppliers
WHERE
segment1 = l_supp_number
;
l_vendor_site_rec.vendor_site_code := l_supp_Site_Code;
l_vendor_site_rec.vendor_site_code_alt := l_supp_Site_Code;
l_vendor_site_rec.address_line1 := l_address_line1;
--l_vendor_site_rec.city := City;
--l_vendor_site_rec.state := State;
l_vendor_site_rec.country := l_country;
select organization_id
INTO l_vendor_site_rec.org_id
from hr_operating_units
where upper(name) = upper(l_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';
l_vendor_site_rec.primary_pay_site_flag := 'Y';
l_vendor_site_rec.prepay_code_combination_id := l_prepay_code_combination_id ;
l_vendor_site_rec.email_address := l_email_address;
l_vendor_site_rec.phone := l_phone;
l_vendor_site_rec.FAX := l_fax;
--
-- 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;
--to update supplier site
--AP_VENDOR_PUB_PKG.Update_Vendor_Site_public
--verify:
--select PREPAY_CODE_COMBINATION_ID, vendor_id
--select * from ap_supplier_sites_all where vendor_id = 868744 --> 3351157
--select * from ap_suppliers where vendor_name = 'Test1'
-------------------------------------------------------------------------------------------------------------------
----------------------------------Supplier contact---------------------------------
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;
--Variables:
l_vendor_name varchar2(200) := 'Test4';
l_org_id varchar2(200) := 1770;
l_person_first_name varchar2(200):= 'Afzal';
l_person_last_name varchar2(200):= 'Abdur Rahman';
l_operating_unit varchar2(200) := 'Fujairah National Catering Est. FNCE'; --1770
l_email_address varchar2(200):= 'contact1@test.com';
l_phone varchar2(200):= '+971555265290';
l_fax_phone varchar2(200):= '+971555265292';
BEGIN
--
-- Required
--
SELECT vendor_id
INTO l_vendor_contact_rec.vendor_id
FROM ap_suppliers
WHERE vendor_name = l_vendor_name;
select organization_id
INTO l_vendor_contact_rec.org_id
from hr_operating_units
where upper(name) = upper(l_operating_unit) ;
l_vendor_contact_rec.person_first_name := l_person_first_name;
l_vendor_contact_rec.person_last_name := l_person_last_name;
l_vendor_contact_rec.email_address := l_email_address;
l_vendor_contact_rec.phone := l_phone;
l_vendor_contact_rec.FAX_PHONE := l_fax_phone;
--
-- 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;
--parameters can be find more from below package, as the above api is calling below package.
--ap_vendor_pub_pkg.create_vendor_contact
---------------------------------------------------------------------------------------------------------------
Adding above supplier to different org:
http://mogalafzal.blogspot.ae/2016/07/adding-new-ous-to-existing-supplier.html
post to view above 3 blocks as package and upload mutliple suppliers:
http://mogalafzal.blogspot.ae/2018/03/oracle-apps-r12-api-to-create-supplier_66.html
No comments:
Post a Comment