Está en la página 1de 21

SUPPLIER INTERFACE STEP:1 Initially for loading data of Suppliers into Supplier Interface using SQL Loader.

First create Staging table & Sequence.

You will see that Sequence & Staging table is created. STEP2: We will create a flat file & loader file. FLAT FILE:

Control File:

Here we will see that in load file we have given the path for flat file through that path we are loading the data into the staging table. FTP :( FILE TRANSFER PROTOCOL)

click on supplier.csv & supplier_ctl then transfer it. Now go to application create executable 7 concurrent Program.

FIELD DISCRIPTION: Specify Executable name as per your wish. Similarly for short name. Specify the application TDN Custom Development (specify the only name where you have transferred the .ctl & .csv file). Execution Method: SQL* LOADER. Execution File Name: Specify the name of control file.

Save the work. Now we have to add the Program to the request group.

Now go to Menu: View: Request

Click on submit.

As we see in the above form that the request is submitted.

Observe in the above window that the request is completed normally. Then go to toad & see that the data is loaded into Staging table.

Now to insert the data into interface table we have to write a procedure.

DETAIL PROCEDURE IS GIVEN BELOW.

CREATE OR REPLACE PROCEDURE SUPPLIER_TEST1(errbuff out varchar2, retcode out number ) as CURSOR L1 is select * from SUPPLIER_TEST where process_flag='N'; cursor L2 is SELECT * FROM SUPPLIER_TEST where process_flag='N';

V_TERM_ID NUMBER; l_success NUMBER; L_phase varchar2(1000); L_status varchar2(1000); L_dev_phase varchar2(1000); L_Dev_status varchar2(1000); L_message varchar2(1000); V1 NUMBER; V2 NUMBER; V3 NUMBER; V4 VARCHAR2(100); M1 BOOLEAN; BEGIN FOR k IN L1 LOOP SELECT TERM_ID INTO V_TERM_ID FROM AP_TERMS WHERE TYPE=k.SUPPLIER_TYPE---'STD' AND NAME='IMMEDIATE'; INSERT INTO AP_SUPPLIERS_INT ( Vendor_interface_id, summary_flag, enabled_flag, vendor_name, segment1, terms_id, invoice_currency_code ) VALUES ( SEQ_NUMBER.NEXTVAL, 'Y', 'Y', k.VENDOR_NAME, k.SUPPLIER_NO, V_TERM_ID, 'INR' ); END LOOP; COMMIT; fnd_global.apps_initialize( user_id => 2197, resp_id => 50367, resp_appl_id => 7000); l_success := fnd_request.submit_request ('SQLAP', -- Application Short name of the Concurrent Program. 'APXSUIMP', -- Program Short Name. 'Supplier Open Interface Import', -- Description of the Program.

SYSDATE, -- Submitted date. Always give the SYSDATE. FALSE, -- Always give the FLASE. 'ALL', -- Passing the Value to the First Parameter of the report. 1000, 'N', 'N', 'N' ); COMMIT; M1:= apps.FND_CONCURRENT.WAIT_FOR_REQUEST(request_id =>l_success, phase =>L_PHASE, status =>L_STATUS, dev_phase =>L_dev_phase, dev_status =>L_Dev_status, message =>L_message); FOR I IN L2 LOOP SELECT COUNT(*) INTO V1 FROM ap_suppliers_int A WHERE A.VENDOR_NAME=I.VENDOR_NAME; IF V1>0 THEN SELECT COUNT(*) INTO V3 FROM AP_SUPPLIER_INT_rejections WHERE PARENT_TABLE='AP_SUPPLIERS_INT' AND PARENT_ID IN ( SELECT vendor_interface_id FROM ap_suppliers_int A WHERE A.VENDOR_NAME=I.VENDOR_NAME); IF V3>0 THEN SELECT REJECT_LOOKUP_CODE INTO V4 FROM AP_SUPPLIER_INT_rejections WHERE PARENT_TABLE='AP_SUPPLIERS_INT' AND PARENT_ID IN ( SELECT vendor_interface_id FROM ap_suppliers_int A WHERE A.VENDOR_NAME=I.VENDOR_NAME); SELECT MAX(SUPPLIER_ID) INTO V1 FROM SUPPLIER_TEST A WHERE VENDOR_NAME=I.VENDOR_NAME; UPDATE SUPPLIER_TEST SET ERROR_MESSAGE=V4, PROCESS_FLAG='E' WHERE SUPPLIER_ID=V1;

ELSE UPDATE SUPPLIER_TEST SET ERROR_MESSAGE=NULL, PROCESS_FLAG='Y' WHERE SUPPLIER_ID IN (SELECT MIN(SUPPLIER_ID) FROM SUPPLIER_TEST A WHERE VENDOR_NAME=I.VENDOR_NAME); END IF; END IF ; END LOOP; COMMIT; END;

Now go to application & register the procedure.

Create a concurrent program.

Go to responsibility & check the request group & copy it. now go to request.

Go to query mode & call the request group copied from responsibility. Now attach the concurrent program, save the work.

Here we observe that 9 records are loaded & 2 are rejected. Now go to toad & Query the error table.

Here we see that all existing record from staging table is loaded into interface table & from interface table to base table but the already existing record are rejected because of duplicate.

Record 3rd already exist. so for that we will update it from Staging

Now go to toad & write A sql statement Select * from ap_suppliers;

Here we will see that the record which was rejected is proceeding into base table.

SUPPLIER SITE INTERFACE Write a procedure which will load a data from staging table to interface table.
create or replace procedure PRC_TEST(errbuff out varchar2, retcode out number )AS cursor c1 is select * from SUPPLIER_TEST ; --cursor L2 is SELECT * FROM XX_TEST1 where process_flag='N'; ---CURSOR L2 IS SELECT * FROM ap_supplier_sites_int where status='REJECTED'; Z1 number; l_success NUMBER; L_phase varchar2(1000); L_status varchar2(1000); L_dev_phase varchar2(1000); L_Dev_status varchar2(1000); L_message varchar2(1000); V1 NUMBER; V2 NUMBER; V3 NUMBER; V4 VARCHAR2(100); M1 BOOLEAN; MT1 number; MT2 number; begin for i in c1 loop begin select vendor_id into Z1 from ap_suppliers where vendor_name=i.vendor_name; exception when others then fnd_file.PUT_LINE(fnd_file.log,'error for vendor_id'||i.vendor_name|| sqlerrm); end; begin select code_combination_id into MT1 from gl_code_combinations where -- code_combination_id=2008 segment1||'.'||segment2||'.'||segment3||'.'||segment4||'.'|| segment5||'.'||segment6||'.'||segment7 =i.LIBILITY_ACCOUNT; exception when others then fnd_file.PUT_LINE(fnd_file.log,'error for code_combination_id'|| sqlerrm); end; begin

select code_combination_id into MT2 from gl_code_combinations where -- code_combination_id=2008 segment1||'.'||segment2||'.'||segment3||'.'||segment4||'.'|| segment5||'.'||segment6||'.'||segment7 =i.PREPAYMENT_ACCOUNT; exception when others then fnd_file.PUT_LINE(fnd_file.log,'error for code_combination_id'|| sqlerrm); end;

INSERT INTO ap_supplier_sites_int ( vendor_site_interface_id,-------=> ap_supplier_sites_int_s.nextval --vendor_interface_id, --------=>ap_supplier_sites_int_s.nextval vendor_site_code, org_id, vendor_id, address_line1, address_line2, address_line3, address_line4, ZIP, ACCTS_PAY_CODE_COMBINATION_ID, PREPAY_CODE_COMBINATION_ID, terms_id,---------/terms_name invoice_currency_code, country ) VALUES ( ap_supplier_sites_int_s.nextval, --1107, 'XXXX', 83, Z1, i.ADDRESS_LINE1, i.ADDRESS_LINE2, i.ADDRESS_LINE3, i.ADDRESS_LINE4, i.POSTAL_CODE, MT1, MT2, 10001, 'INR', 'IN' ); end loop;

fnd_global.apps_initialize( user_id => 2197, resp_id => 50367, resp_appl_id => 7000); l_success := fnd_request.submit_request

('SQLAP', -- Application Short name of the Concurrent Program. 'APXSSIMP', -- Program Short Name. 'Supplier Sites Open Interface Import', -- Description of the Program. SYSDATE, -- Submitted date. Always give the SYSDATE. FALSE, -- Always give the FLASE. 'ALL', -- Passing the Value to the First Parameter of the report. 1000, 'N', 'N', 'N' ); COMMIT; END;

Now register the procedure.

Create the concurrent Program.

Attach the concurrent to the request group. Now go to the payables responsibility & submit the request.

Specify the name the program attached to the request group & submit.

Click on find & refresh the data. Go to toad

Here we will observe that all the data for site from staging to interface is loaded.

Here we will observe that all ten records for site is loaded. For our conformation check it from front end. Go to payables.

Specify the name of the supplier name & click on go the above window will pop up. We observe that entered name of supplier is successfully load from back end.

Now click on address book &we will find the address & site for that supplier.

También podría gustarte