You are on page 1of 6

AP Invoice Interface

insert into AP_INVOICES_INTERFACE (


invoice_id,
invoice_num,
vendor_id,
vendor_site_id,
invoice_amount,
INVOICE_CURRENCY_CODE,
invoice_date,
gl_date,
DESCRIPTION,
PAY_GROUP_LOOKUP_CODE,
source,
org_id
)
values (
AP_INVOICES_INTERFACE_S.NEXTVAL,
'test_inv2',
01,
46,
1200.00,
'USD',
'20-Nov-2014',
'20-Nov-2014',
'test Invoice',
'Supplier',
'MANUAL INVOICE ENTRY',
161
);
insert into AP_INVOICE_LINES_INTERFACE (
invoice_id,
invoice_line_id,
line_number,
line_type_lookup_code,
amount,
dist_code_combination_id
)
values (
AP_INVOICES_INTERFACE_S.CURRVAL,
AP_INVOICE_LINES_INTERFACE_S.NEXTVAL,
1,
'ITEM',
1200.00,
100010645
);
commit;
================================================================================
========================================================

Item Interface

================================================================================
==========================
Creation of Item using Item Interface
Group Team
Item can be created by using Item Import Program.
Prerequistic is to insert record in Mtl_System_Items_Interface table.
Following are the important columns in Interface table
a. Segment1
b. Organization_id
c. set_process_id
d. Process_flag
e. Transaction_type
Segment1 -- It holds the Item Name.
Organization_id -- To which Organization an item belongs to. Normally items will
be added to the Master Organization. Then it will be assigned to Inventory Orga
nization.
set_process_id -- Used to speed up the Import Program process.
Process_flag -- Process_flag=1 will be picked by the Item import program. If it
is error out due to any diffrence, value of process_flag will be changed to 3.
Transaction_type -- It can be either 'CREATE' or 'UPDATE'
Code to Populate Item Interface Table
--------------------------------------------------------declare
v_organization_id NUMBER := 0;
Begin
--Getting the Organization id
BEGIN
SELECT Organization_id
INTO v_organization_id
FROM mtl_parameters mp
WHERE mp.organization_code = 'V1'; --V1 is the Master Organization Code
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Error in getting the Organization id for Organization code
V1 and error is '||SUBSTR(SQLERRM,1,200));
END;
--Inserting into Item interface table
BEGIN
INSERT INTO mtl_system_items_interface
(segment1,
organization_id,
process_flag,
set_process_id,
transaction_type
)
values
('New Item Name',
v_organization_id,
1,
1,
'CREATE'
);
COMMIT;

EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Error in inserting record in interface table and error is
'||SUBSTR(SQLERRM,1,200));
END;
END;
Once item is inserted into inteface table, item import program needs to be calle
d to Create item. Following is the code used to call the item import program
Code to Call Item Import Program
-------------------------------------------------DECLARE
v_organization_id NUMBER := 0;
v_request_id NUMBER := 0;
v_phase VARCHAR2(240);
v_status VARCHAR2(240);
v_request_phase VARCHAR2(240);
v_request_status VARCHAR2(240);
v_finished BOOLEAN;
v_message VARCHAR2(240);
BEGIN
--Submit the item import program in Create Mode to Create New Item
BEGIN
dbms_output.put_line('--Submitting Item Import Program for Item--');
v_request_id := Fnd_Request.submit_request (
application => 'INV',
program => 'INCOIN',
description => NULL,
start_time => SYSDATE,
sub_request => FALSE,
argument1 => 1,
argument2 => 1,
argument3 => 1, --Group ID option (All)
argument4 => 1, -- Group ID Dummy
argument5 => 1, -- Delete processed Record
argument6 => 1, -- Set Process id
argument7 => 1 -- Create item
);
COMMIT;
dbms_output.put_line('Item Import Program submitted');
IF ( v_request_id = 0 ) THEN
dbms_output.put_line( 'Item Import Program Not Submitted');
END IF;
-- Wait for request to run the import Program to Finish
v_finished := fnd_concurrent.wait_for_request (request_id => v_request_id,
interval => 0,
max_wait => 0,
phase => v_phase,
status => v_status,
dev_phase => v_request_phase,
dev_status => v_request_status,
message => v_message);
dbms_output.put_line('Request Phase : '|| v_request_phase );

dbms_output.put_line('Request Status : ' || v_request_status );


dbms_output.put_line('Request id : '||v_request_id );
--Testing end status
IF ( UPPER(v_request_status) = 'NORMAL') THEN
dbms_output.put_line( 'Item Import Program Completed Normally');
ELSE
dbms_output.put_line( 'Item Import Program completed with error. Check Mtl_inter
face_error table for the transaction_id');
END IF;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Error in Submitting Item Import Program and error is '||SU
BSTR(SQLERRM,1,200));
END;
END;
================================================================================
====
item interface 2
================================================================================
===
Import Item Standard API in Oracle Apps Import Item in Oracle Apps Mandatory Val
ues in
mtl_system_items_interface table Column : process_flag, set_process_id, transac
tion_type, organization_id,segment1, description,template_id
Insert script for Interface table
INSERT INTO mtl_system_items_interface
(process_flag, set_process_id, transaction_type, organization_id,
s
egment1, description, template_id
)
VALUES (1, 1, 'CREATE', 2,
' XXITEM ', ' XX Import Item ', 2
);
Once the data has been loaded into interface table then run standard concurrent
program Import Items from INV SUPER USER
Responsibility to import data into base tables.
1] All Organizations: Yes: Run the interface for all organization codes in the
item interface table.
No: Run the interface only for the organization you are currently in. Item inte
rface rows for organizations other than your current organization are ignored.
2] Validate Items: Yes: Validate all items and their data residing in the inter
face table that have not yet been validated.
If items are not validated, they will not be processed into Oracle Inventory. N
o: Do not validate items in the interface table.
3] Process Items: Yes: All qualifying items in the interface table are inserted
into Oracle Inventory. No: Do not insert items into Oracle Inventory.
4] Delete Processed Rows: Yes: Delete successfully processed items from the ite
m interface tables. No: Leave all rows in the item interface tables.
5] Process Set: Enter a number for the set id for the set of rows you want to p
rocess. The program picks up the rows marked with that id in the SET_PROCESS_ID
column.
If you leave this field blank, all rows are picked up for processing regardless
of the SET_PROCESS_ID column value. Working with failed interface rows:
If a row fails validation, the Item Interface sets the PROCESS_FLAG to 3 (Assig
n/validation failed) and inserts a row in the interface errors table, MTL_INTERF
ACE_ERRORS.
To identify the error message for the failed row, the program automatically pop
ulates the TRANSACTION_ID column in this table with the TRANSACTION_ID value fro
m the
corresponding item interface table. The UNIQUE_ID column in MTL_INTERFACE_ERROR

S is populated from the sequence MTL_SYSTEM_ITEMS_INTERFACE_S.


Thus, for a given row, the sequence of errors can be determined by examining UN
IQUE_ID for a given TRANSACTION_ID.
You should resolve errors in the sequence that they were found by the interface
, that is, in increasing order of UNIQUE_ID
for any TRANSACTION_ID. Resubmitting an Errored Row: During Item Interface proc
essing,
rows can error out either due to validation (indicated by PROCESS_FLAG = 3 in M
TL_SYSTEM_ITEMS_INTERFACE and the corresponding error in MTL_INTERFACE_ERRORS)
or due to an Oracle Error. When an Oracle Error is encountered, the processing
is stopped and everything is rolled back to the previous save point.
This could be at PROCESS_FLAG = 1, 2, 3, or 4.
When you encounter rows errored out due to validations, you must first fix the
row corresponding to the error with the appropriate value.
Then reset PROCESS_FLAG = 1, INVENTORY_ITEM_ID = null, and TRANSACTION_ID = nul
l. Then resubmit the row for reprocessing.
To check the errors in interface table. Select
ORGANIZATION_ID,
UNIQUE_ID
,
REQUEST_ID ,
TABLE_NAME ,
COLUMN_NAME,
ERROR_MESSAGE
CREATION_DATE,
MESSAGE_TYPE from
MTL_INTERFACE_ERRORS w
here request_id= :p_req_id order by CREATION_DATE;
Once the items has been successfully imported then process_flag value will be c
hanged 7 in interface table.
You can also able to see the error in interface table MTL_INTERFACE_ERRORS PROC
ESS_FLAG Values after running the Import Items concurrent program 1= Pending,
2= Assign Complete, 3= Assign/Validation Failed, 4= Validation succeeded; Impo
rt failed, 5 = Import in Process, 7 = Import succeeded

After inserting into interface tables, launch Payables Open Interface Import pro
gram using fnd_request.submit_request
mo_global.set_policy_context ('S', l_org_id);
l_standard_request_id :=fnd_request.submit_request (application
=> 'SQLAP'
,program
=> 'APXIIMPT'
,description
=> NULL
,start_time
=> NULL
,sub_request
=> FALSE
,argument1
=> l_org_id
,argument2
=> v_source
,argument3
=> NULL
,argument4

=> NULL

,argument5

=> NULL

,argument6

=> NULL

,argument7
,argument8
);

=> NULL
=> 'Y'

l_completed :=
fnd_concurrent.wait_for_request (l_standard_request_id
,1
,NULL

,l_phase
,l_vstatus
,l_dev_phase
,l_dev_status
,l_message
);
Check l_dev_phase and l_dev_status. it should be complete and normal

You might also like