How to create API For supplier/vendor creation in r12
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;
CURSOR C1 IS
select VENDOR_NAME SUPPLIER_NAME, VENDOR_TYPE SUPPLIER_TYPE
from (
SELECT 'WIPRO' VENDOR_NAME, 'VENDOR' VENDOR_TYPE FROM DUAL
--SELECT 'HELLO' VENDOR_NAME, '3RD PARTY' VENDOR_TYPE FROM DUAL
--SELECT 'HELLO' VENDOR_NAME, 'CONSULTANT' VENDOR_TYPE FROM DUAL
--SELECT 'HELLO' VENDOR_NAME, 'EMPLOYEE' VENDOR_TYPE FROM DUAL
--SELECT 'Ashok L Pathak' VENDOR_NAME, 'EMPLOYEE' VENDOR_TYPE FROM DUAL
--SELECT 'OMM NAMAH SHIVAYA TOURS '||CHR(38)||' TRAVELS' VENDOR_NAME, 'VENDOR' VENDOR_TYPE FROM DUAL /* & */
--SELECT 'OMM NAMAH SHIVAYA TOURS '||CHR(39)||' TRAVELS' VENDOR_NAME, 'VENDOR' VENDOR_TYPE FROM DUAL /* ' */
);
--select * from XXPCL_SUP_STAGING_TBL A
--where 1=1
----AND A.SUPPLIER_NAME= 'R Rahman'
--and not exists ( select 1 from ap_suppliers Z where TRIM(UPPER(Z.VENDOR_NAME)) = TRIM(UPPER(A.SUPPLIER_NAME)));
--update ap_suppliers
--set vendor_name = REPLACE(vendor_name, CHR(13), '')
--where upper(vendor_name) likE '%MONICA JASSI%'
--select * from ap_suppliers where VENDOR_TYPE_LOOKUP_CODE like 'EMPLOYEE%'
--
--select 'STD', VENDOR_NAME, length(TRIM(VENDOR_NAME)) from ap_suppliers
--where upper(vendor_name) likE '%BINOD%%'
--union
--select 'CST', SUPPLIER_NAME, length(TRIM(SUPPLIER_NAME)) from XXPCL_SUP_STAGING_TBL A
--where upper(SUPPLIER_NAME) likE '%BINOD KUMAR ROY%'
BEGIN
--select * from fnd_responsibility_tl where RESPONSIBILITY_NAME like 'WIPRO%Resource%'
fnd_global.apps_initialize(0, 51572, 200);
FOR I IN C1 LOOP
--Required
--l_vendor_rec.segment1 := '00002359'; --ID
l_vendor_rec.vendor_name := I.SUPPLIER_NAME;
--Optional
l_vendor_rec.VENDOR_TYPE_LOOKUP_CODE:= I.SUPPLIER_TYPE;
l_vendor_rec.ATTRIBUTE_CATEGORY := 'Vendor Categories';
l_vendor_rec.ATTRIBUTE4 :='COMMMISION';
l_vendor_rec.TERMS_DATE_BASIS := 'Invoice';
l_vendor_rec.match_option:='R' ;
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||SQLERRM);
dbms_output.put_line('msg_data: '||l_msg_data);
dbms_output.put_line('vendor_id: '||l_vendor_id);
dbms_output.put_line('vendor_Name: '||I.SUPPLIER_NAME);
dbms_output.put_line('party_id: '||l_party_id);
--UPDATE XXPCL_SUP_STAGING_TBL
--SET VENDOR_ID = l_vendor_id
--WHERE VENDOR_STAGING_ID = I.VENDOR_STAGING_ID;
COMMIT;
END LOOP;
END;
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;
CURSOR C1 IS
select VENDOR_NAME SUPPLIER_NAME, VENDOR_TYPE SUPPLIER_TYPE
from (
SELECT 'WIPRO' VENDOR_NAME, 'VENDOR' VENDOR_TYPE FROM DUAL
--SELECT 'HELLO' VENDOR_NAME, '3RD PARTY' VENDOR_TYPE FROM DUAL
--SELECT 'HELLO' VENDOR_NAME, 'CONSULTANT' VENDOR_TYPE FROM DUAL
--SELECT 'HELLO' VENDOR_NAME, 'EMPLOYEE' VENDOR_TYPE FROM DUAL
--SELECT 'Ashok L Pathak' VENDOR_NAME, 'EMPLOYEE' VENDOR_TYPE FROM DUAL
--SELECT 'OMM NAMAH SHIVAYA TOURS '||CHR(38)||' TRAVELS' VENDOR_NAME, 'VENDOR' VENDOR_TYPE FROM DUAL /* & */
--SELECT 'OMM NAMAH SHIVAYA TOURS '||CHR(39)||' TRAVELS' VENDOR_NAME, 'VENDOR' VENDOR_TYPE FROM DUAL /* ' */
);
--select * from XXPCL_SUP_STAGING_TBL A
--where 1=1
----AND A.SUPPLIER_NAME= 'R Rahman'
--and not exists ( select 1 from ap_suppliers Z where TRIM(UPPER(Z.VENDOR_NAME)) = TRIM(UPPER(A.SUPPLIER_NAME)));
--update ap_suppliers
--set vendor_name = REPLACE(vendor_name, CHR(13), '')
--where upper(vendor_name) likE '%MONICA JASSI%'
--select * from ap_suppliers where VENDOR_TYPE_LOOKUP_CODE like 'EMPLOYEE%'
--
--select 'STD', VENDOR_NAME, length(TRIM(VENDOR_NAME)) from ap_suppliers
--where upper(vendor_name) likE '%BINOD%%'
--union
--select 'CST', SUPPLIER_NAME, length(TRIM(SUPPLIER_NAME)) from XXPCL_SUP_STAGING_TBL A
--where upper(SUPPLIER_NAME) likE '%BINOD KUMAR ROY%'
BEGIN
--select * from fnd_responsibility_tl where RESPONSIBILITY_NAME like 'WIPRO%Resource%'
fnd_global.apps_initialize(0, 51572, 200);
FOR I IN C1 LOOP
--Required
--l_vendor_rec.segment1 := '00002359'; --ID
l_vendor_rec.vendor_name := I.SUPPLIER_NAME;
--Optional
l_vendor_rec.VENDOR_TYPE_LOOKUP_CODE:= I.SUPPLIER_TYPE;
l_vendor_rec.ATTRIBUTE_CATEGORY := 'Vendor Categories';
l_vendor_rec.ATTRIBUTE4 :='COMMMISION';
l_vendor_rec.TERMS_DATE_BASIS := 'Invoice';
l_vendor_rec.match_option:='R' ;
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||SQLERRM);
dbms_output.put_line('msg_data: '||l_msg_data);
dbms_output.put_line('vendor_id: '||l_vendor_id);
dbms_output.put_line('vendor_Name: '||I.SUPPLIER_NAME);
dbms_output.put_line('party_id: '||l_party_id);
--UPDATE XXPCL_SUP_STAGING_TBL
--SET VENDOR_ID = l_vendor_id
--WHERE VENDOR_STAGING_ID = I.VENDOR_STAGING_ID;
COMMIT;
END LOOP;
END;
No comments:
Post a Comment