Supplier Interface

24
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:

Transcript of Supplier Interface

Page 1: Supplier Interface

SUPPLIER INTERFACE

STEP:1Initially 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:

Page 2: Supplier Interface

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)

Page 3: Supplier Interface

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.

Page 4: Supplier Interface

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

Now go to Menu: View: Request

Page 5: Supplier Interface

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.

Page 6: Supplier Interface

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

DETAIL PROCEDURE IS GIVEN BELOW.

Page 7: Supplier Interface

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;BEGINFOR k IN L1LOOPSELECT TERM_ID INTO V_TERM_IDFROM AP_TERMSWHERE 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.

Page 8: Supplier Interface

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 L2LOOP SELECT COUNT(*) INTO V1FROM ap_suppliers_int A WHERE A.VENDOR_NAME=I.VENDOR_NAME;

IF V1>0 THEN

SELECT COUNT(*) INTO V3 FROM AP_SUPPLIER_INT_rejectionsWHERE 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_rejectionsWHERE 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 V1FROM SUPPLIER_TEST A WHERE VENDOR_NAME=I.VENDOR_NAME;

UPDATE SUPPLIER_TESTSET ERROR_MESSAGE=V4,PROCESS_FLAG='E'WHERE SUPPLIER_ID=V1;

Page 9: Supplier Interface

ELSE

UPDATE SUPPLIER_TESTSET 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.

Page 10: Supplier Interface

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.

Page 11: Supplier Interface

Here we observe that 9 records are loaded & 2 are rejected.

Now go to toad & Query the error table.

Page 12: Supplier Interface

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

Page 13: Supplier Interface
Page 14: Supplier Interface

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.

Page 15: Supplier Interface

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 )AScursor 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 c1loop

beginselect vendor_id into Z1from ap_supplierswhere 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;

beginselect code_combination_id into MT1from gl_code_combinations where -- code_combination_id=2008segment1||'.'||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

Page 16: Supplier Interface

select code_combination_id into MT2from gl_code_combinations where -- code_combination_id=2008segment1||'.'||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.nextvalvendor_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_nameinvoice_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

Page 17: Supplier Interface

('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.

Page 18: Supplier Interface

Create the concurrent Program.

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

Page 19: Supplier Interface

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

Click on find & refresh the data.Go to toad

Page 20: Supplier Interface

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.

Page 21: Supplier Interface

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.