Anda di halaman 1dari 62

INTERFACE/CONVERSION EXAMPLES AND DETAILS:

The below list of interfaces/conversions are covered in this section. Details like prerequisites required, interface tables, interface program, base tables, validations that
need to be performed after inserting the details into the interface tables and
required columns that need to be populated in the interface table are discussed for
each interface.
Order Import Interface (Sales Order Conversion)
Customer conversion
Item import (Item conversion)
Inventory On-hand quantity Interface
Customer conversion
Auto Invoice Interface
AR Receipts
Lockbox Interface
AP Invoices
Vendor
Purchase Orders
Requisition
Receiving
Journal import
Budget import
Daily Conversion Rates

PURCHASE ORDER
The Purchasing Document Open Interface concurrent program was replaced by two
new concurrent programs Import Price Catalogs and Import Standard Purchase
Orders. Import Price Catalogs concurrent program is used to import Catalog
Quotations, Standard Quotations, and Blanket Purchase Agreements. Import
Standard Purchase Orders concurrent program is used to import Unapproved or
Approved Standard Purchase Orders.
IMPORT STANDARD PURCHASE ORDERS
Pre-requisites:
Suppliers, sites and contacts
Buyers
Line Types
Items
PO
Charge account setup
Interface Tables:
PO_HEADERS_INTERFACE
PO_LINES_INTERFACE
PO_DISTRIBUTIONS_INTERFACE
PO_INTERFACE_ERRORS (Fallouts)
Interface Program: Import Standard Purchase Orders.

Base Tables:
PO_HEADERS_ALL
PO_LINES_ALL
PO_DISTRIBUTIONS_ALL
PO_LINE_LOCATIONS_ALL
Validations:
Header:
Check if OU name is valid
Check if Supplier is valid
Check if Supplier site is valid
Check if buyer is valid
Check if Payment term is valid
Check if Bill to and ship to are valid
Check if FOB, freight terms are valid
Lines:
Check if Line_type, ship_to_org, item, uom, ship_to_location_id, requestor,
charge_account, deliver_to_location are valid
General:
Check for duplicate records in interface tables
Check if the record already exists in base tables.
Some important columns that need to be populated in the interface
tables:
PO_HEADERS_INTERFACE:
INTERFACE_HEADER_ID (PO_HEADERS_INTERFACE_S.NEXTVAL), BATCH_ID, ORG_ID,
INTERFACE_SOURCE_CODE, ACTION (ORIGINAL,UPDATE,REPLACE),
GROUP_CODE, DOCUMENT_TYPE_CODE, PO_HEADER_ID (NULL), RELEASE_ID,
RELEASE_NUM, CURRENCY_CODE, RATE, AGENT_NAME, VENDOR_ID,
VENDOR_SITE_ID, SHIP_TO_LOCATION, BILL_TO_LOCATION, , PAYMENT_TERMS
PO_LINES_INTERFACE:
INTERFACE_LINE_ID, INTERFACE_HEADER_ID, LINE_NUM, SHIPMENT_NUM, ITEM,
REQUISITION_LINE_ID, UOM, UNIT_PRICE, FREIGHT_TERMS, FOB
PO_DISTRIBUTIONS_INTERFACE:
INTERFACE_LINE_ID, INTERFACE_HEADER_ID, INTERFACE_DISTRIBUTION_ID,
DISTRIBUTION_NUM, QUANTITY_ORDERED, QTY_DELIVERED, QTY_BILLED,
QTY_CANCELLED, DELIVER_TO_LOCATION_ID, DELIVER_TO_PERSON_ID,
SET_OF_BOOKS, CHARGE_ACCT, AMOUNT_BILLED.
--Staging Tables
CREATE TABLE xx_po_header_stg(
interface_header_id NUMBER
,batch_id NUMBER
,org_id NUMBER
,action VARCHAR2(25)
,document_type_code VARCHAR2(25)
,currency_code VARCHAR2(15)

,agent_id NUMBER
,full_name VARCHAR2(240)
,vendor_name VARCHAR2(240)
,vendor_site_code VARCHAR2(15)
,ship_to_location VARCHAR2(60)
,bill_to_location VARCHAR2(60)
,approval_status VARCHAR2(25)
,freight_carrier VARCHAR2(25)
,fob VARCHAR2(25)
,freight_terms VARCHAR2(25))
CREATE TABLE xx_po_line_stg
(
interface_header_id NUMBER
,interface_line_id NUMBER
,line_num NUMBER
,shipment_num NUMBER
,line_type VARCHAR2(25)
,item VARCHAR2(1000)
,item_description VARCHAR2(240)
,item_id NUMBER
,uom_code VARCHAR2(3)
,quantity NUMBER
,unit_price NUMBER
,ship_to_organization_code VARCHAR2(3)
,ship_to_location VARCHAR2(60)
,list_price_per_unit NUMBER)
CREATE TABLE xx_po_distribution_stg
(interface_header_id NUMBER,
interface_line_id NUMBER,
interface_distribution_id NUMBER,
org_id NUMBER,
quantity_ordered NUMBER,
destination_organization_id NUMBER,
set_of_books_id NUMBER,
charge_account_id VARCHAR2(2000),
distribution_num NUMBER);
--Creation Of The Package.
CREATE OR REPLACE PACKAGE xxak_po_imp_pkg
IS
PROCEDURE xxak_po_imp_prc (errbuf OUT VARCHAR2, retcode OUT NUMBER);
END;/
--Creation Of The Procedure.
CREATE OR REPLACE PACKAGE BODY xxak_po_imp_pkg
IS
PROCEDURE xxak_po_imp_prc (errbuf OUT VARCHAR2, retcode OUT NUMBER)
IS

CURSOR cur_head
IS
SELECT * FROM xx_po_header_stg;
CURSOR cur_line (p_interface_header_id NUMBER)
IS
SELECT *FROM xx_po_line_stg
WHERE interface_header_id = p_interface_header_id;
CURSOR cur_dist (p_interface_line_id NUMBER)
IS
SELECT *FROM xx_po_distribution_stg
WHERE interface_line_id = p_interface_line_id;
lv_vendor_id
NUMBER (10);
lv_agent_id
NUMBER (10);
lv_itemid
NUMBER;
lv_site_code
VARCHAR2 (100);
lv_lookup_code VARCHAR2 (25);
lv_curr_code
VARCHAR2 (10);
lv_org_id
NUMBER (6);
BEGIN
BEGIN
SELECT organization_id INTO lv_org_id FROM hr_operating_units
WHERE NAME LIKE 'Vision Operations';
EXCEPTION
WHEN OTHERS THEN
fnd_file.put_line (fnd_file.LOG, 'invalid org_id');
END;
BEGIN
FOR var1 IN cur_head
LOOP
BEGIN
SELECT vendor_id INTO lv_vendor_id FROM po_vendors
WHERE vendor_name = var1.vendor_name;
EXCEPTION
WHEN OTHERS
THEN
fnd_file.put_line (fnd_file.LOG, 'invalid vendor_id');
END;
BEGIN
SELECT vendor_site_code
INTO lv_site_code
FROM po_vendor_sites_all
WHERE vendor_site_code = var1.vendor_site_code;
EXCEPTION
WHEN OTHERS
THEN
fnd_file.put_line (fnd_file.LOG, 'invalid vendor_site_code');
END;

BEGIN
SELECT currency_code
INTO lv_curr_code
FROM fnd_currencies
WHERE currency_code = var1.currency_code;
EXCEPTION
WHEN OTHERS
THEN
fnd_file.put_line (fnd_file.LOG, 'invalid currency_code');
END;
BEGIN
SELECT document_type_code
INTO lv_lookup_code
FROM po_document_types
WHERE document_type_code = var1.document_type_code;
EXCEPTION
WHEN OTHERS
THEN
fnd_file.put_line (fnd_file.LOG, 'invalid typecode');
END;
BEGIN
SELECT person_id
INTO lv_agent_id
FROM per_all_people_f
WHERE full_name = var1.full_name;
EXCEPTION
WHEN OTHERS
THEN
fnd_file.put_line (fnd_file.LOG, 'invalid Buyer');
END;
BEGIN
INSERT INTO po_headers_interface
(interface_header_id,
batch_id,
org_id,
action,
document_type_code,
currency_code,
agent_id,
agent_name,
vendor_name,
vendor_site_code,
ship_to_location, bill_to_location,
approval_status, freight_terms,
fob, freight_carrier, created_by, creation_date,
last_update_date, last_updated_by
)

VALUES (po_headers_interface_s.NEXTVAL, var1.batch_id,


lv_org_id, var1.action, var1.document_type_code,
var1.currency_code, lv_agent_id, var1.full_name,
var1.vendor_name, var1.vendor_site_code,
var1.ship_to_location, var1.bill_to_location,
var1.approval_status, var1.freight_terms,
var1.fob, var1.freight_carrier, -1, SYSDATE,
SYSDATE, -1
);
EXCEPTION
WHEN OTHERS
THEN
fnd_file.put_line (fnd_file.output,
'insertion successful into headers int'
);
END;
FOR var2 IN cur_line (var1.interface_header_id)
LOOP
BEGIN
SELECT inventory_item_id
INTO lv_itemid
FROM mtl_system_items_b
WHERE segment1 = var2.item AND organization_id = lv_org_id;
EXCEPTION
WHEN OTHERS
THEN
-- lv_item := NULL;
fnd_file.put_line (fnd_file.LOG, 'invalid item');
END;
BEGIN
INSERT INTO po_lines_interface
(interface_line_id,
interface_header_id,
line_num,
shipment_num,
line_type,
item,
item_description,
item_id,
uom_code,
quantity,
unit_price,
ship_to_organization_code,
ship_to_location,
need_by_date,
-- ,PROMISED_DATE
list_price_per_unit,
created_by,

creation_date,
last_update_date,
last_updated_by
)
VALUES (po_lines_interface_s.NEXTVAL,
po_headers_interface_s.CURRVAL,
var2.line_num,
var2.shipment_num,
var2.line_type,
var2.item,
var2.item_description,
var2.item_id,
var2.uom_code,
var2.quantity,
var2.unit_price,
var2.ship_to_organization_code,
var2.ship_to_location,
SYSDATE,
-- ,SYSDATE
var2.list_price_per_unit,
-1,
SYSDATE,
SYSDATE,
-1
);
EXCEPTION
WHEN OTHERS
THEN
fnd_file.put_line (fnd_file.output,
'insertion successful into lines int'
);
END;
FOR var3 IN cur_dist (var2.interface_line_id)
LOOP
BEGIN
INSERT INTO po_distributions_interface
(interface_header_id,
interface_line_id,
interface_distribution_id,
org_id, quantity_ordered,
destination_organization_id,
set_of_books_id,
charge_account_id,
distribution_num, created_by,
creation_date, last_update_date,
last_updated_by
)
VALUES (po_headers_interface_s.CURRVAL,
po_lines_interface_s.CURRVAL,

po_distributions_interface_s.NEXTVAL,
lv_org_id, var3.quantity_ordered,
var3.destination_organization_id,
var3.set_of_books_id,
var3.charge_account_id,
var3.distribution_num, -1,
SYSDATE, SYSDATE,
-1
);
EXCEPTION
WHEN OTHERS
THEN
fnd_file.put_line
(fnd_file.output,
'insertion successful into dist int'
);
END;
END LOOP;
END LOOP;
END LOOP;
END;
COMMIT;
END xxak_po_imp_prc;
END xxak_po_imp_pkg;

ORDER IMPORT INTERFACE (SALES ORDER CONVERSION)


Order Import enables you to import Sales Orders into Oracle Applications instead of
manually entering them.
Pre-requisites:
Order Type
Line Type
Items
Customers
Ship Method/ Freight Carrier
Sales Person
Sales Territories
Customer Order Holds
Sub Inventory/ Locations
On hand Quantity
Interface tables:
OE_HEADERS_IFACE_ALL
OE_LINES_IFACE_ALL
OE_ACTIONS_IFACE_ALL
OE_ORDER_CUST_IFACE_ALL
OE_PRICE_ADJS_IFACE_ALL
OE_PRICE_ATTS_IFACE_ALL
Base tables:
OE_ORDER_HEADERS_ALL
OE_ORDER_LINES_ALL

Pricing tables:

QP_PRICING_ATTRIBUTES

Concurrent Program: Order Import


Validations:
Check for sold_to_org_id. If does not exist, create new customer by calling
create_new_cust_info API.
Check for sales_rep_id. Should exist for a booked order.
Ordered_date should exist (header level)
Delivery_lead_time should exist (line level)
Earliest_acceptable_date should exist.
Freight_terms should exist
Notes:
During import of orders, shipping tables are not populated.
If importing customers together with the order, OE_ORDER_CUST_IFACE_ALL has to
be populated and the base tables are HZ_PARTIES, HZ_LOCATIONS.
Orders can be categorized based on their status:
1. Entered orders
2. Booked orders
3. Closed orders
Order Import API :
OE_ORDER_PUB.GET_ORDER and PROCESS_ORDER can also be used to import
orders.
Some important columns that need to populated in the interface tables:
OE_HEADERS_IFACE_ALL:
ORIG_SYS_DOCUMENT_REF
ORDER_SOURCE
CONVERSION_RATE
ORG_ID
ORDER_TYPE_ID
PRICE_LIST
SOLD_FROM_ORG_ID
SOLD_TO_ORG_ID
SHIP_TO_ORG_ID
SHIP_FROM_ORG_ID
CUSTOMER_NAME
INVOICE_TO_ORG_ID
OPERATION_CODE
OE_LINES_IFACE_ALL:
ORDER_SOURCE_ID
ORIG_SYS_DOCUMENT_REF
ORIG_SYS_LINE_REF
ORIG_SYS_SHIPMENT_REF
INVENTORY_ITEM_ID
LINK_TO_LINE_REF
REQUEST_DATE
DELIVERY_LEAD_TIME

DELIVERY_ID
ORDERED_QUANTITY
ORDER_QUANTITY_UOM
SHIPPING_QUANTITY
PRICING_QUANTITY
PRICING_QUANTITY_UOM
SOLD_FROM_ORG_ID
SOLD_TO_ORG_ID
INVOICE_TO_ ORG_ID
SHIP_TO_ORG_ID
PRICE_LIST_ID
PAYMENT_TERM_ID
STAGING TABLES
CREATE TABLE ST_OE_HEADERS_IFACE_ALL (
ORDER_SOURCE_ID NUMBER,
ORIG_SYS_DOCUMENT_REF VARCHAR2 (50),
ORG_ID NUMBER,
ORDERED_DATE DATE,
ORDER_TYPE_ID NUMBER,
PRICE_LIST_ID NUMBER,
TRANSACTIONAL_CURR_CODE VARCHAR2 (15),
SALESREP_ID NUMBER,
PAYMENT_TERM_ID NUMBER,
SOLD_TO_ORG_ID NUMBER,
SHIP_FROM_ORG_ID NUMBER,
SHIP_TO_ORG_ID NUMBER,
INVOICE_TO_ORG_ID NUMBER,
CUSTOMER_ID NUMBER,
CREATED_BY NUMBER NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY NUMBER NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
REQUEST_DATE DATE,
SOLD_FROM_ORG_ID NUMBER);
CREATE TABLE ST_OE_LINES_IFACE_ALL (
ORDER_SOURCE_ID NUMBER,
ORIG_SYS_DOCUMENT_REF VARCHAR2 (50),
ORIG_SYS_LINE_REF VARCHAR2 (50),
ORG_ID NUMBER,
LINE_TYPE_ID NUMBER,
INVENTORY_ITEM_ID NUMBER,
SCHEDULE_SHIP_DATE DATE,
ORDERED_QUANTITY NUMBER,
ORDER_QUANTITY_UOM VARCHAR2 (3),
SOLD_TO_ORG_ID NUMBER,
SHIP_FROM_ORG_ID NUMBER,
SHIP_TO_ORG_ID NUMBER,

INVOICE_TO_ORG_ID NUMBER,
PRICE_LIST_ID NUMBER,
UNIT_LIST_PRICE NUMBER,
UNIT_SELLING_PRICE NUMBER,
PAYMENT_TERM_ID NUMBER,
SALESREP_ID NUMBER,
CREATED_BY NUMBER NOT NULL,
CREATION_DATE DATE NOT NULL,
LAST_UPDATED_BY NUMBER NOT NULL,
LAST_UPDATE_DATE DATE NOT NULL,
REQUEST_DATE DATE,
SOLD_FROM_ORG_ID NUMBER,
LINES_NUMBER NUMBER);
create table ST_OE_ACTIONS_IFACE_ALL (ORDER_SOURCE_ID NUMBER,
ORIG_SYS_DOCUMENT_REF VARCHAR2(50),
ORG_ID NUMBER,OPERATION_CODE VARCHAR2(50));
SQL * LOADER
LOAD DATA INFILE *
INTO TABLE ST_OE_ACTIONS_IFACE_ALL
FIELDS TERMINATED BY ","
TRAILING NULLCOLS
(ORDER_SOURCE_ID,ORIG_SYS_DOCUMENT_REF,ORG_ID,OPERATION_CODE)
INTO TABLE ST_OE_HEADERS_IFACE_ALL
FIELDS TERMINATED BY ","
TRAILING NULLCOLS
(ORDER_SOURCE_ID,
ORIG_SYS_DOCUMENT_REF,
ORG_ID,
ORDERED_DATE "TO_DATE(SYSDATE)",
ORDER_TYPE_ID,
PRICE_LIST_ID,
TRANSACTIONAL_CURR_CODE,
SALESREP_ID,
PAYMENT_TERM_ID,
SOLD_TO_ORG_ID,
SHIP_FROM_ORG_ID,
SHIP_TO_ORG_ID,
INVOICE_TO_ORG_ID,
CUSTOMER_ID,
CREATED_BY,
CREATION_DATE "TO_DATE(SYSDATE)",
LAST_UPDATED_BY,
LAST_UPDATE_DATE "TO_DATE(SYSDATE)",
REQUEST_DATE "TO_DATE(SYSDATE)",
SOLD_FROM_ORG_ID)
INTO TABLE ST_OE_LINES_IFACE_ALL
FIELDS TERMINATED BY ','
TRAILING NULLCOLS

(ORDER_SOURCE_ID,
ORIG_SYS_DOCUMENT_REF,
ORIG_SYS_LINE_REF,
ORG_ID,
LINE_TYPE_ID,
INVENTORY_ITEM_ID,
SCHEDULE_SHIP_DATE "TO_DATE(SYSDATE)",
ORDERED_QUANTITY,
ORDER_QUANTITY_UOM,
SOLD_TO_ORG_ID,
SHIP_FROM_ORG_ID,
SHIP_TO_ORG_ID,
INVOICE_TO_ORG_ID,
PRICE_LIST_ID,
UNIT_LIST_PRICE,
UNIT_SELLING_PRICE,
PAYMENT_TERM_ID,
SALESREP_ID,
CREATED_BY ,
CREATION_DATE "TO_DATE(SYSDATE)",
LAST_UPDATED_BY,
LAST_UPDATE_DATE "TO_DATE(SYSDATE)" ,
REQUEST_DATE "TO_DATE(SYSDATE)",
SOLD_FROM_ORG_ID,
LINES_NUMBER)
CREATE OR REPLACE PROCEDURE MOT_OM_CONV_PROC(ERRBUF OUT VARCHAR2,
RETCODE OUT vARCHAR2) IS
CURSOR CUR_HEADERs IS SELECT * FROM ST_OE_HEADERS_IFACE_ALL;
CURSOR CUR_LINES IS SELECT * FROM ST_OE_LINES_IFACE_ALL;
err_control EXCEPTION;
err_msg varchar2(250);
err_flag number;
ID NUMBER;
VERROR_FLAG OE_HEADERS_IFACE_ALL.ERROR_FLAG%TYPE;
VINTERFACE_STATUS OE_HEADERS_IFACE_ALL.INTERFACE_STATUS%TYPE;
VCREATION_DATE OE_HEADERS_IFACE_ALL.CREATION_DATE%TYPE;
VLAST_UPDATE_DATE OE_HEADERS_IFACE_ALL.LAST_UPDATE_DATE%TYPE;
VREQUEST_ID OE_HEADERS_IFACE_ALL.REQUEST_ID%TYPE;
VORIG_SYS_DOCUMENT_REF OE_HEADERS_IFACE_ALL.ORIG_SYS_DOCUMENT_REF
%TYPE;
VORIG_SYS_LINE_REF OE_LINES_IFACE_ALL.ORIG_SYS_LINE_REF%TYPE;
VORDER_SOURCE_ID OE_ORDER_SOURCES.ORDER_SOURCE_ID%TYPE;
BEGIN
ID :=FND_GLOBAL.USER_ID;
VERROR_FLAG :=NULL;
VINTERFACE_STATUS :=NULL;
VCREATION_DATE :=SYSDATE;
VLAST_UPDATE_DATE :=SYSDATE;
VORIG_SYS_DOCUMENT_REF :='Order1';

VORIG_SYS_LINE_REF :='Line1';
ERR_MSG :='';
err_flag :=0;
VORDER_SOURCE_ID :=1047;
FOR V1 IN CUR_MOT_HEADERs
LOOP
BEGIN
IF order_valid(v1.ORDER_TYPE,v1.ORDER_TYPE_ID,'ORDER')='ERROR' THEN
err_msg:='Order_type or order_type_id must be valid';
err_flag:=1;
end if ;
IF price_item_validate(V1.PRICE_LIST_ID,NULL,'H')='ERROR' THEN
IF err_flag=1 then
err_msg:=err_msg||'&'||'Price list must be valid';
else
err_msg:='Price list must be valid';
err_flag:=1;
end if ;
end if;
IF payment_term_validate(V1.PAYMENT_TERM_id)='ERROR' THEN
if err_flag=1 then
err_msg:=err_msg||'&'||'Invalid payment term';
else
err_msg:='Invalid payment term';
err_flag:=1;
end if ;
end if ;
IF validate_customer(V1.CUSTOMER_NAME,v1.CUSTOMER_ID,v1.SOLD_TO_ORG_ID)
='ERROR' then
IF err_flag=1 then
err_msg:=err_msg||'&'||' iNVALID CUSTOMER or sold to org id ';
else
err_msg:=' iNVALID CUSTOMER or sold to org id ';
err_flag:=1;
end if ;
end if;
if invoice_to_ship_to(v1.SHIP_TO_ORG_ID,v1.invoice_to_org_id)='ERROR' THEN
IF err_flag=1 then
err_msg:=err_msg||'&'||'INVALID SHIP TO OR INVOICE TO';
else
err_msg:='INVALID SHIP TO OR INVOICE TO';
err_flag:=1;
end if ;
end if;
-- raise exception -IF err_flag=1 then -- RAISE ERROR MSG -dbms_output.put_line('raising error');
raise err_control;
ELSE -- INSERT INTO INTERFCAE TABLES TABLE -INSERT INTO OE_HEADERS_IFACE_ALL

(
ORDER_SOURCE_ID,
ORIG_SYS_DOCUMENT_REF,
ORDER_SOURCE,
ORDERED_DATE,
ORDER_TYPE,
ORDER_TYPE_ID,
PRICE_LIST_ID,
SALESREP_ID,
PAYMENT_TERM_id,
CUSTOMER_NAME,
CUSTOMER_ID,
CREATED_BY,
CREATION_DATE,
LAST_UPDATED_BY,
LAST_UPDATE_DATE,
REQUEST_ID,
OPERATION_CODE,
ERROR_FLAG,
INTERFACE_STATUS,
SOLD_TO_ORG_ID,
SHIP_TO_ORG_ID,
INVOICE_TO_ORG_ID
)
VALUES
(
VORDER_SOURCE_ID,
VORIG_SYS_DOCUMENT_REF,
v1.ORDER_SOURCE,
v1.ORDERED_DATE,
v1.ORDER_TYPE,
v1.ORDER_TYPE_ID,
v1.PRICE_LIST_ID,
v1.SALESREP_ID,
v1.PAYMENT_TERM_id,
v1.CUSTOMER_NAME,
v1.CUSTOMER_ID,
ID,
VCREATION_DATE,
ID,
vLAST_UPDATE_DATE,
v1.REQUEST_ID,
v1.OPERATION_CODE,
VERROR_FLAG,
VINTERFACE_STATUS,
v1.SOLD_TO_ORG_ID,
v1.SHIP_TO_ORG_ID,
v1.INVOICE_TO_ORG_ID
);
INSERT INTO OE_ACTIONS_IFACE_ALL

(
ORDER_SOURCE_ID,
ORIG_SYS_DOCUMENT_REF,
OPERATION_CODE
)
VALUES
(
VORDER_SOURCE_ID,
VORIG_SYS_DOCUMENT_REF,
'BOOK_ORDER'
);
END IF ;
EXCEPTION
WHEN err_control THEN
update MOT_stage_HEADER set error_msg=err_msg;
WHEN NO_DATA_FOUND THEN
EXIT;
WHEN OTHERS THEN
ERR_MSG:=SUBSTR(SQLERRM,1,25);
UPDATE MOT_stage_HEADER set error_msg=err_msg;
END;
END LOOP ;
--- end of header processing -----------------err_flag:=0;
FOR V2 in CUR_MOT_LINES
LOOP
begin
IF order_valid(v2.LINE_type,v2.LINE_TYPE_ID,'LINE')='ERROR' THEN
err_msg:='Order_type or order_type_id must be valid';
err_flag:=1;
END IF ;
dbms_output.put_line('price_item_validate('||V2.PRICE_LIST_ID||','||
v2.inventory_item_id||',L');
IF price_item_validate(V2.PRICE_LIST_ID,v2.inventory_item_id,'L')='ERROR' THEN
IF err_flag=1 then
err_msg:=err_msg||'&'||'Price list must be valid';
else
err_msg:='Price list must be valid';
err_flag:=1;
END IF ;
END IF ;
IF payment_term_validate(V2.PAYMENT_TERM_id)='ERROR' THEN
IF err_flag=1 then
err_msg:=err_msg||'&'||'Invalid payment term';
ELSE
err_msg:='Invalid payment term';
err_flag:=1;
end if ;
end if ;
IF invoice_to_ship_to(v2.SHIP_TO_ORG_ID,v2.invoice_to_org_id)='ERROR' THEN

IF err_flag =1 then
err_msg:=err_msg||'&'||'INVALID SHIP TO OR INVOICE TO';
else
err_msg:='INVALID SHIP TO OR INVOICE TO';
err_flag:=1;
end if ;
end if;
IF uom_validate(V2.order_quantity_uom)='ERROR' THEN
IF err_flag =1 then
err_msg:=err_msg||'&'||'INVALID UNIT OF MEASURE';
else
err_msg:='INVALID UNIT OF MEASURE';
err_flag:=1;
end if ;
end if;
-- raise exception -IF err_flag=1 then -- RAISE ERROR FLAG -raise err_control;
ELSE -- INSERT TO INTERFACE TABLES -INSERT INTO OE_LINES_IFACE_ALL
(
ORDER_SOURCE_ID,
ORIG_SYS_DOCUMENT_REF,
ORIG_SYS_LINE_REF,
LINE_TYPE,
LINE_TYPE_ID,
INVENTORY_ITEM_ID,
PAYMENT_TERM_id,
PRICE_LIST_ID,
ORDERED_QUANTITY,
ORDER_QUANTITY_UOM,
REQUEST_DATE,
SALESREP_ID,
UNIT_LIST_PRICE,
UNIT_SELLING_PRICE,
CALCULATE_PRICE_FLAG,
SHIP_TO_ORG_ID,
INVOICE_TO_ORG_ID,
CREATED_BY,
CREATION_DATE,
LAST_UPDATED_BY,
LAST_UPDATE_DATE,
OPERATION_CODE,
ERROR_FLAG,
INTERFACE_STATUS,
REQUEST_ID
)
VALUES
(
V2.ORDER_SOURCE_ID,

VORIG_SYS_DOCUMENT_REF,
VORIG_SYS_LINE_REF,
V2.LINE_TYPE,
V2.LINE_TYPE_ID,
V2.INVENTORY_ITEM_ID,
V2.PAYMENT_TERM_id,
V2.PRICE_LIST_ID,
V2.ORDERED_QUANTITY,
V2.ORDER_QUANTITY_UOM,
V2.REQUEST_DATE,
V2.SALESREP_ID,
V2.UNIT_LIST_PRICE,
V2.UNIT_SELLING_PRICE,
V2.CALCULATE_PRICE_FLAG,
V2.SHIP_TO_ORG_ID,
V2.INVOICE_TO_ORG_ID,
ID,
VCREATION_DATE,
ID,
VLAST_UPDATE_DATE,
V2.OPERATION_CODE,
VERROR_FLAG,
VINTERFACE_STATUS,
V2.REQUEST_ID
);
END IF ;
EXCEPTION
WHEN err_control THEN
update MOT_stage_lines set error_msg=err_msg;
WHEN NO_DATA_FOUND THEN
EXIT;
WHEN OTHERS THEN
ERR_MSG:=SUBSTR(SQLERRM,1,25);
UPDATE MOT_stage_lines set error_msg=err_msg;
END;
END LOOP ;
END;

ITEM IMPORT (ITEM CONVERSION)


The Item Interface lets you import items into Oracle Inventory.
Pre-requisites:
Creating an Organization
Code Combinations
Templates
Defining Item Status Codes
Defining Item Types

Interface tables:
MTL_SYSTEM_ITEMS_INTERFACE
MTL_ITEM_REVISIONS_INTERFACE (If importing revisions)
MTL_ITEM_CATEGORIES_INTERFACE (If importing categories)
MTL_INTERFACE_ERRORS (View errors after import)
Concurrent Program: Item import
In the item import parameters form, for the parameter set process id, specify the
set process id value given in the mtl_item_categories_interface table. The
parameter Create or Update can have any value. Through the import process, we
can only create item category assignment(s). Updating or Deletion of item category
assignment is not supported.
Base tables:
MTL_SYSTEM_ITEMS_B
MTL_ITEM_REVISIONS_B
MTL_CATEGORIES_B
MTL_CATEGORY_SETS_B
MTL_ITEM_STATUS
MTL_ITEM_TEMPLATES
Validations:
Check for valid item type.
Check for valid part_id/segment of the source table.
Validate part_id/segment1 for master org.
Validate and translate template id of the source table.
Check for valid template id. (Attributes are already set for items, default attributes
for that template, i.e., purchasable, stockable, etc)
Check for valid item status.
Validate primary uom of the source table.
Validate attribute values.
Validate other UOMs of the source table.
Check for unique item type. Discard the item, if part has non-unique item type.
Check for description, inv_um uniqueness
Validate organization id.
Load master records and category records only if all validations are passed.
Load child record if no error found.
Some important columns that need to populated in the interface tables:
MTL_SYSTEM_ITEMS_INTERFACE:
PROCESS_FLAG = 1 (1= Pending, 2= Assign Complete,
3= Assign/Validation Failed, 4= Validation succeeded; Import failed, 5 = Import in
Process,

7 = Import succeeded)
TRANSACTION_TYPE = CREATE, UPDATE
SET_PROCESS_ID = 1
ORGANIZATION_ID
DESCRIPTION
ITEM_NUMBER and/or SEGMENT (n)
MATERIAL_COST
REVISION
TEMPLATE_ID
SUMMARY_FLAG
ENABLED_FLAG
PURCHASING_ITEM_FLAG
SALES_ACCOUNT (defaulted from
MTL_PARAMETERS.SALES_ACCOUNT)
COST_OF_SALES_ACCOUNT (defaulted from MTL_PARAMETERS.
COST_OF_SALES_ACCOUNT)
MTL_ITEM_CATEGORIES_INTERFACE:
INVENTORY_ITEM_ID or ITEM_NUMBER.
ORGANIZATION_ID or ORGANIZATION_CODE or both.
TRANSACTION_TYPE = CREATE (UPDATE or DELETE is not possible through Item
Import).
CATEGORY_SET_ID or CATEGORY_SET_NAME or both.
CATEGORY_ID or CATEGORY_NAME or both.
PROCESS_FLAG = 1
SET_PROCESS_ID (The item and category interface records should have the
same set_process_id, if you are importing item and category assignment together)
MTL_ITEM_REVISIONS_INTERFACE:
INVENTORY_ITEM_ID or ITEM_NUMBER (Must match
mtl_system_items_interface table)
ORGANIZATION_ID or ORGANIZATION_CODE or both
REVISION
CHANGE_NOTICE
ECN_INITIATION_DATE
IMPLEMENTATION_DATE
IMPLEMENTED_SERIAL_NUMBER
EFFECTIVITY_DATE
ATTRIBUTE_CATEGORY
ATTRIBUTEn
REVISED_ITEM_SEQUENCE_ID
DESCRIPTION
PROCESS_FLAG = 1

the

item_number

in

TRANSACTION_TYPE = CREATE
SET_PROCESS_ID = 1
Each row in the mtl_item_revisions_interface table must have the REVISION and
EFFECTIVITY_DATE in alphabetical (ASCII sort) and chronological order.
INVENTORY ON-HAND QUANTITY INTERFACE
This interface lets you import the on hand inventory into Oracle.
Interface tables:
MTL_TRANSACTIONS_INTERFACE
MTL_MTL_TRANSACTION_LOTS_INTERFACE (If the item is Lot controlled)
MTL_SERIAL_NUMBERS_INTERFACE (If the item is Serial controlled)
Concurrent Program:
Launch the Transaction Manager through Interface Manager or explicitly call the
API INV_TXN_MANAGER_PUB.PROCESS_TRANSACTIONS () to launch a dedicated
transaction worker to process them.
The Transaction Manager picks up the rows to process based on the LOCK_FLAG,
TRANSACTION_MODE, and PROCESS_FLAG. Only records with TRANSACTION_MODE
of 3, LOCK_FLAG of 2, and PROCESS_FLAG of 1 will be picked up by the
Transaction Manager and assigned to a Transaction Worker. If a record fails to
process completely, then PROCESS_FLAG will be set to 3 and ERROR_CODE and
ERROR_EXPLANATION will be populated with the cause for the error.
Base Tables:
MTL_ON_HAND_QUANTITIES
MTL_LOT_NUMBERS
MTL_SERIAL_NUMBERS
Validations:
Validate organization_id
Check if item is assigned to organization
Validate disposition_id
Check if the item for the org is lot controlled before inserting into the Lots interface
table.
Check if the item for the org is serial controlled before inserting into Serial interface
table.
Check if inventory already exists for that item in that org and for a lot.
Validate organization_id, organization_code.
Validate inventory item id.
Transaction period must be open.
Some important columns that need to be populated in the interface tables:
MTL_TRANSACTIONS_INTERFACE:

TRANSACTION_SOURCE_NAME (ANY USER DEFINED VALUE),


TRANSACTION_HEADER_ID (MTL_MATERIAL_TRANSACTIONS_S.NEXTVAL)
TRANSACTION_INTERFACE_ID (MTL_MATERIAL_TRANSACTIONS_S.NEXTVAL If item
is lot or serial controlled, use this field to link to mtl_transactions_interface
otherwise leave it as NULL),
TRANSACTION_DATE,
TRANSACTION_TYPE_ID,
PROCESS_FLAG (1 = Yet to be processed, 2 = Processed, 3= Error)
TRANSACTION_MODE (2 = Concurrent to launch a dedicated transaction worker
to explicitly process a set of transactions.
3 = Background will be picked up by transaction manager polling process and
assigned to transaction
worker. These will not be picked up until the transaction manager is running)
SOURCE_CODE,
SOURCE_HEADER_ID,
SOURCE_LINE_ID (Details about the source like Order Entry etc for tracking
purposes)
TRANSACTION_SOURCE_ID
Source Type
Account
Account Alias
Job or schedule
Sales Order

Foreign Key Reference


GL_CODE_COMBINATIONS.CODE_COMBINATION_ID
MTL_GENERIC_DISPOSITIONS.DISPOSITION_ID
WIP_ENTITIES.WIP_ENTITY_ID
MTL_SALES_ORDERS.SALES_ORDER_ID

ITEM_SEGMENT1 TO 20,
TRANSACTION_QTY,
TRANSACTION_UOM,
SUBINVENTORY_CODE,
ORGANIZATION_ID,
LOC_SEGMENT1 TO 20.
MTL_TRANSACTION_LOTS_INTERFACE:
TRANSACTION_INTERFACE_ID,
LOT_NUMBER,
LOT_EXPIRATION_DATE,
TRANSACTION_QUANTITY,
SERIAL_TRANSACTION_TEMP_ID (This is required for items under both lot and serial
control to identify child records in mtl_serial_numbers_interface)
MTL_SERIAL_NUMBERS_INTERFACE:
TRANSACTION_INTERFACE_ID,
FM_SERIAL_NUMBER,
TO_SERIAL_NUMBER,

VENDOR_SERIAL_NUMBER
CUSTOMER CONVERSION
Customer Interface helps you create customers in Oracle Applications.
Interface tables:
RA_CUSTOMERS_INTERFACE_ALL
RA_CUSTOMER_PROFILES_INT_ALL
RA_CONTACT_PHONES_INT_ALL
RA_CUSTOMER_BANKS_INT_ALL
RA_CUST_PAY_METHOD_INT_ALL
Base tables:
RA_CUSTOMERS
RA_ADDRESSES_ALL
RA_CUSTOMER_RELATIONSHIPS_ALL
RA_SITE_USES_ALL
Concurrent program: Customer Interface
Validations:
Check if legacy values fetched are valid.
Check if customer address site is already created.
Check if customer site use is already created.
Check is customer header is already created.
Check whether the ship_to_site has associated bill_to_site
Check whether associated bill_to_site is created or not. Profile amounts validation:
Validate cust_account_id, validate customer status.
Check if the location already exists in HZ_LOCATIONS. If does not exist, create new
location.
Some important columns that need to be populated in the interface tables:
RA_CUSTOMERS_INTERFACE_ALL:
ORIG_SYSTEM_CUSTOMER_REF
SITE_USE_CODE
ORIG_SYSTEM_ADDRESS_REF
INSERT_UPDATE_FLAG (I = Insert, U = Update)
CUSTOMER_NAME
CUSTOMER_NUMBER
CUSTOMER_STATUS
PRIMARY_SITE_USE_FLAG
LOCATION
ADDRESS1
ADDRESS2

ADDRESS3
ADDRESS4
CITY
STATE
PROVINCE
COUNTY
POSTAL_CODE
COUNTRY
CUSTOMER_ATTRIBUTE1
CUSTOMER_ATTRIBUTE2
CUSTOMER_ATTRIBUTE3
CUSTOMER_ATTRIBUTE4
CUSTOMER_ATTRIBUTE5
LAST_UPDATED_BY
LAST_UPDATE_DATE
CREATED_BY
CREATION_DATE
ORG_ID
CUSTOMER_NAME_PHONETIC
RA_CUSTOMER_PROFILES_INT_ALL:
INSERT_UPDATE_FLAG
ORIG_SYSTEM_CUSTOMER_REF
ORIG_SYSTEM_ADDRESS_REF
CUSTOMER_PROFILE_CLASS_NAME
CREDIT_HOLD
LAST_UPDATED_BY
LAST_UPDATE_DATE
CREATION_DATE
CREATED_BY
ORG_ID
RA_CONTACT_PHONES_INT_ALL:
ORIG_SYSTEM_CONTACT_REF
ORIG_SYSTEM_TELEPHONE_REF
ORIG_SYSTEM_CUSTOMER_REF
ORIG_SYSTEM_ADDRESS_REF
INSERT_UPDATE_FLAG
CONTACT_FIRST_NAME
CONTACT_LAST_NAME
CONTACT_TITLE
CONTACT_JOB_TITLE
TELEPHONE
TELEPHONE_EXTENSION

TELEPHONE_TYPE
TELEPHONE_AREA_CODE
LAST_UPDATE_DATE
LAST_UPDATED_BY
LAST_UPDATE_LOGIN
CREATION_DATE
CREATED_BY
EMAIL_ADDRESS
ORG_ID

CUSTOMER API
Trading Community Architecture (TCA) is an architecture concept designed to
support complex
trading communities. These APIs utilize the new TCA model, inserting directly to the
HZ tables.
API Details:
1. Set the organization id
Exec dbms_application_info.set_client_info(204);
2. Create a party and an account
HZ_CUST_ACCOUNT_V2PUB.CREATE_CUST_ACCOUNT()
HZ_CUST_ACCOUNT_V2PUB.CUST_ACCOUNT_REC_TYPE
HZ_PARTY_V2PUB.ORGANIZATION_REC_TYPE
HZ_CUSTOMER_PROFILE_V2PUB.CUSTOMER_PROFILE_REC_TYPE
3. Create a physical location
HZ_LOCATION_V2PUB.CREATE_LOCATION()
HZ_LOCATION_V2PUB.LOCATION_REC_TYPE
4. Create a party site using party_id you get from step 2 and location_id from
step 3.
HZ_PARTY_SITE_V2PUB.CREATE_PARTY_SITE()
HZ_PARTY_SITE_V2PUB.PARTY_SITE_REC_TYPE
5. Create an account site using account_id you get from step 2 and
party_site_id from step 4.
HZ_CUST_ACCOUNT_SITE_V2PUB.CREATE_CUST_ACCT_SITE()
HZ_CUST_ACCOUNT_SITE_V2PUB.CUST_ACCT_SITE_REC_TYPE
6. Create an account site use using cust_acct_site_id you get from step 5 ans
site_use_code = BILL_TO.
HZ_CUST_ACCOUNT_SITE_V2PUB.CREATE_CUST_SITE_USE()
HZ_CUST_ACCOUNT_SITE_V2PUB.CUST_SITE_USE_REC_TYPE
HZ_CUSTOMER_PROFILE_V2PUB.CUSTOMER_PROFILE_REC_TYPE
Base table:
HZ_PARTIES

HZ_PARTY_SITES
HZ_LOCATIONS
HZ_CUST_ACCOUNTS
HZ_CUST_SITE_USES_ALL
HZ_CUST_ACCT_SITES_ALL
HZ_PARTY_SITE_USES
Validations:
Check if legacy values fetched are valid.
Check if customer address site is already created.
Check if customer site use is already created.
Check is customer header is already created.
Check whether the ship_to_site has associated bill_to_site
Check whether associated bill_to_site is created or not.
Profile amounts validation:
Validate cust_account_id, validate customer status.
Check if the location already exists in HZ_LOCATIONS. If does not exist, create new
location.
For detailed explanation refer to the below article:
http://www.erpschools.com/Apps/oracleapplications/articles/financials/Receivables/Customer-TCA-Architecture-andAPI/index.aspx
Steps for AR Invoice Interface are:
1. Put the data into your staging tables.
2. Calls your package to validate the data and load into AR Interface tables
(RA_INTERFACE_LINES_ALL & RA_INTERFACE_DISTRIBUTIONS_ALL).
3. Then submits a concurrent request for AutoInvoice.
If any errors occur it can be found in ra_interface_errors_all table. The concurrent
program has 2 stages. First the Master program fires which intern kicks of the
Import Program. Once this is completed data is inserted into the following tables.
1) ra_customer_trx_all (Invoice Header Info)
2) ra_customer_trx_lines_all (Invoice Line Level Info)
3) ra_cust_trx_line_gl_dist_all (Accounting Info. One record for each Account Type is
inserted into this ex. Receivable Revenue Tax Freight etc)
4) ar_payment_schedules_all (All Payment related info)
Validations:
Validation are generally done on the below columns.
Batch_source_name
Set_of_books_id
Orig_sys_batch_name
orig_system_bill_customer_ref
orig_system_bill_address_ref
Line_Type
Currency_Code

Term_name
Transaction_type
Interface_line_attribute1-7
Account_class
Accounting Flexfields segments
1- AR Transaction Type Validation: Check if the Transaction type provided in data file
is defined in AR transaction types (RA_CUST_TRX_TYPES_ALL)
2- Transaction Batch Source Validation: Check if the source provided in data file is
defined in AR transaction Batch source (RA_BATCH_SOURCES_ALL).
3- Invoice Currency Validation: Check if the currency provided in data file is defined
in AR Currency (FND_CURRENCIES).
4- Customer Validation: Check if the Bill to Customer Number, Ship to Customer
Number, Bill to Custom Location, Ship to Customer Location provided in the data file
is defined in AR Customer (RA_CUSTOMERS).
5- Primary Sales Representative Validation: Sales representative number to be
hardcode to -3 for No Sales Credit.
6- Term Name: Check if the Term name provided in the data file is defined in
Payment terms (RA_TERMS)
7- Inventory Item Validation: Check if the Item provided in data file is defined in
Inventory Items (MTL_SYSTEM_ITEMS).
8- Unit of Measurement validation: Check if the UOM provided is defined in
MTL_UNITS_OF_MEASURE Table
9- Invoice Tax Code Validation: Check if the Tax Code provided in data file is defined
in AR_VAT_TAX_ALL_B Table.
10- Invoice GL Date Validation: Check if the GL Data of provided invoices is in open
period.
For MOAC:
You need to add the below columns and need to do validations if your application
supports MOAC.
conversion_type
conversion_rate
conversion_date
CUSTOMER INTERFACES(AR)
INTERFACE TABLES
RA_CUSTOMERS_INTERFACE_ALL
RA_CUSTOMER_PROFILES_INT_ALL
RA_CONTACT_PHONES_INT_ALL
RA_CUSTOMER_BANKS_INT_ALL
RA_CUST_PAY _METHOD_INT_ALL
RA_Cust_Pay_Method_Int_All
BASE TABLES
RA_CUSTOMERS
RA_ADDRESSES_ALL
RA_CUSTOMER_RELATIONSHIPS_ALL
RA_SITE_USES_ALL

Moving the Staging Table Data into Base tables of AR Customer thro
Interfaces:
Creating three Staging tables and Inserting data into the Tables:
CREATE TABLE XXAR_CUST_STG (
INSERT_UPDATE_FLAG VARCHAR2 (1 Byte),
PARTY_TYPE VARCHAR2 (30 Byte),
CUSTOMER_NAME VARCHAR2 (50 Byte),
CUSTOMER_NUMBER VARCHAR2 (30 Byte),
ORIG_SYSTEM_CUSTOMER_REFERENCE VARCHAR2 (240 Byte),
PRIMARY_USE_CODE_FLAG VARCHAR2 (1 Byte),
STATUS VARCHAR2 (1 Byte),
SITE_USE_CODE VARCHAR2 (30 BYTE),
ADDRESS_ID NUMBER (15),
ORIG_SYSTEM_ADDRESS_REFERENCE VARCHAR2 (240 Byte),
ADDRESS1 VARCHAR2 (240 Byte),
ADDRESS2 VARCHAR2 (240 Byte),
CITY VARCHAR2 (60 Byte),
STATE VARCHAR2 (60 Byte),
COUNTRY VARCHAR2 (60 Byte)
);
Desc XXAR_CUST_STG
Alter table XXAR_CUST_STG add primary_site_use_flag VARCHAR2 (30 BYTE)
Drop table XXAR_CUST_STG
INSERT INTO XXAR_CUST_STG
Values ('I','ORGANIZATION','Archies','', 10112,'A'
,'SHIP_TO', ,'2021','#456, Lane 78'
,'Sustain Lane', 'SINGAPORE', 'SG', SG,'Y');
INSERT INTO XXAR_CUST_STG
Values ('I','ORGANIZATION','Archies','', 10112,'A'
,'BILL_TO', ,'2021','#456,A-Block, Lane 78'
,'Sustain Lane', 'SINGAPORE', 'SG', SG,'Y');
create table XXAR_PROFILE_STG (
INSERT_UPDATE_FLAG VARCHAR2 (1 BYTE),
ORIG_SYSTEM_CUSTOMER_REF VARCHAR2 (240 BYTE),
CUSTOMER_PROFILE_CLASS_NAME VARCHAR2 (30 BYTE),
CREDIT_CHECKING VARCHAR2 (1 BYTE),
COLLECTOR_NAME VARCHAR2 (30 BYTE),
CREDIT_HOLD VARCHAR2 (1 BYTE),
DUNNING_LETTERS VARCHAR2 (1 BYTE),
STATEMENTS VARCHAR2 (1 BYTE)
DUNNING_LETTER_SET_NAME VARCHAR2 (30 Byte)
STATEMENT_CYCLE_NAME VARCHAR2 (15 Byte));

INSERT INTO XXAR_PROFILE_STG


Values ('I', 10112,'BR Profile 1',Y,'Kerry','Y','N','N')
CREATE TABLE XXAR_PHONE_STG(
ORIG_SYSTEM_CUSTOMER_REF VARCHAR2 (240 BYTE),
ORIG_SYSTEM_ADDRESS_REF VARCHAR2 (240 BYTE),
INSERT_UPDATE_FLAG VARCHAR2 (1 BYTE),
ORIG_SYSTEM_TELEPHONE_REF VARCHAR2 (240 BYTE),
TELEPHONE VARCHAR2 (25 BYTE),
TELEPHONE_TYPE VARCHAR2 (30 BYTE),
ORIG_SYSTEM_CONTACT_REF VARCHAR2 (240 BYTE),
CONTACT_LAST_NAME VARCHAR2 (50 BYTE)
)
insert into XXAR_PHONE_STGValues('10112','2021','I','Tel002','9849771099','PHONE'
,'Cnt01','Arnold');
create table XXAR_BANK_STG(
ORIG_SYSTEM_CUSTOMER_REF VARCHAR2 (240 BYTE),
PRIMARY_FLAG VARCHAR2 (1 BYTE),
START_DATE DATE,
BANK_ACCOUNT_NAME VARCHAR2 (80 BYTE),
BANK_ACCOUNT_CURRENCY_CODE VARCHAR2 (15 BYTE),
BANK_ACCOUNT_NUM VARCHAR2 (30 BYTE),
BANK_BRANCH_NAME VARCHAR2 (60 BYTE),
ORIG_SYSTEM_ADDRESS_REF VARCHAR2 (240 BYTE));
insert into XXAR_BANK_STG values('10112','Y','20-Nov-08','LGS
Bank','INR','289012384','Lgs Branch','2021');
create table XXAR_CUSTPAY_STG(
ORIG_SYSTEM_CUSTOMER_REF VARCHAR2 (240 BYTE),
PAYMENT_METHOD_NAME VARCHAR2 (30 BYTE),
PRIMARY_FLAG VARCHAR2 (1 BYTE),
START_DATE date,
ORIG_SYSTEM_ADDRESS_REF VARCHAR2 (240 BYTE));
insert into XXAR_CUSTPAY_STG values('10122','CASH','Y','05-jan-2009','2020')
-----------------------------------------------------------------Create table XXAR_LOC_STG (
SITE_USE_ID NUMBER (15) ,
SITE_USE_CODE VARCHAR2 (30 Byte),
ADDRESS_ID NUMBER (15) ,
PRIMARY_FLAG VARCHAR2 (1 Byte),
STATUS VARCHAR2 (1 Byte),
LOCATION VARCHAR2 (40 Byte) );
create table XXAR_SITE_STG(
SITE_USE_ID NUMBER (15),
SITE_USE_CODE VARCHAR2 (30 Byte),

ADDRESS_ID NUMBER (15),


PRIMARY_FLAG VARCHAR2 (1 Byte),
STATUS VARCHAR2 (1 Byte),
LOCATION VARCHAR2 (40 Byte) );
SQL * LOADER
options(skip=0)
load data
infile '/ebs12/oracle/apps/apps_st/appl/ar/12.0.0/bin/customer flat file.csv'
insert into table xxcustomersstg
fields terminated by ','
optionally enclosed by '"'
trailing nullcols
(orig_system_customer_ref,
INSERT_UPDATE_FLAG,
Customer_name,
Customer_number,
Customer_status,
person_flag,
person_first_name,
Person_last_name,
primary_site_use_flag,
Location,
site_use_code,
address1,
address2,
city,
Province,
Postal_code,
state,
County,
Country,
orig_system_address_ref,
Customer_profile_class_name,
credit_hold,
Collector_name,
credit_balence_statements,
CREDIT_CHECKING,
AUTO_REC_MIN_RECEIPT_AMOUNT,
DISCOUNT_TERMS,
DUNNING_LETTERS,
STATEMENTS,
INTEREST_CHARGES,
INTEREST_PERIOD_DAYS,
TOLERANCE,
OVERRIDE_TERMS,
ORIG_SYSTEM_TELEPHONE_REF,
TELEPHONE,
TELEPHONE_TYPE,

PRIMARY_FLAG,
START_DATE DATE,
BANK_ACCOUNT_NUM,
BANK_ACCOUNT_CURRENCY_CODE,
bank_account_name,
Bank_branch_name,
PAYMENT_METHOD_NAME,bank_home_country,org_id)
Create a package with validations to move the data from Staging table to
Interface table
CREATE OR REPLACE PACKAGE xxar_custint_pkg
IS
PROCEDURE xxar_custint_prc (errbuf OUT VARCHAR2, retcode OUT VARCHAR2);
END;
CREATE OR REPLACE PACKAGE BODY xxar_custint_pkg
IS
PROCEDURE xxar_custint_prc (errbuf OUT VARCHAR2, retcode OUT VARCHAR2)
IS
CURSOR ar_cur
IS
SELECT insert_update_flag, primary_site_use_flag, customer_name,
customer_number, orig_system_customer_ref, site_use_code,
status, orig_system_address_ref, address1, address2, city,
state, country
FROM xxar_cust_stg;
CURSOR ar_prof (orig_system_customer_ref NUMBER)
IS
SELECT insert_update_flag, orig_system_customer_ref,
customer_profile_class_name, credit_hold, collector_name,
dunning_letter_set_name, statement_cycle_name
FROM xxar_profile_stg;
--Variable Declaration
lv_insert_update_flag
VARCHAR2 (1);
lv_primary_site_use_flag
VARCHAR2 (1);
lv_site_use_code
VARCHAR2 (30 BYTE);
lv_country
VARCHAR2 (6);
lv_customer_profile_class_name VARCHAR2 (30 BYTE);
lv_collector_name
VARCHAR2 (30 BYTE);
lv_credit_hold
VARCHAR2 (1 BYTE);
lv_dunning_letter_set_name
VARCHAR2 (30 BYTE);
lv_statement_cycle_name
VARCHAR2 (15 BYTE);
lv_status
VARCHAR2 (1);
lv_err_flag
CHAR (1)
:= 'A';
lv_exp
VARCHAR2 (5);
BEGIN
-- Cursor for Loop
FOR i IN ar_cur
LOOP

BEGIN
SELECT insert_update_flag
INTO lv_insert_update_flag
FROM xxar_cust_stg
WHERE insert_update_flag IN ('I', 'U');
EXCEPTION
WHEN OTHERS
THEN
lv_err_flag := 'E';
fnd_file.put_line (fnd_file.LOG,
'INSERT_UPDATE_FLAG is not valid-- '
);
END;
fnd_file.put_line (fnd_file.LOG,
'Inserting INSERT_UPDATE_FLAG -- '
|| lv_insert_update_flag
);
BEGIN
SELECT primary_site_use_flag
INTO lv_primary_site_use_flag
FROM xxar_cust_stg
WHERE primary_site_use_flag IN ('Y', 'N');
EXCEPTION
WHEN NO_DATA_FOUND
THEN
lv_err_flag := 'N';
fnd_file.put_line (fnd_file.LOG,
'The flag should be either yes or no'
);
WHEN TOO_MANY_ROWS
THEN
lv_exp := NULL;
END;
fnd_file.put_line (fnd_file.LOG,
'Inserting the primary_SITE_USE_flag --'
|| lv_primary_site_use_flag
);
BEGIN
SELECT territory_code
INTO lv_country
FROM fnd_territories
WHERE territory_code = i.country;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
lv_err_flag := 'N';

fnd_file.put_line (fnd_file.LOG,
'The Country code given doesnot exist'
);
WHEN TOO_MANY_ROWS
THEN
lv_exp := NULL;
END;
fnd_file.put_line (fnd_file.LOG,
'Inserting The Country code--' || lv_country
);
BEGIN
SELECT lookup_code
INTO lv_site_use_code
FROM ar_lookups
WHERE lookup_type = 'SITE_USE_CODE'
AND lookup_code = i.site_use_code;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
lv_err_flag := 'N';
lv_site_use_code := NULL;
fnd_file.put_line
(fnd_file.LOG,
'The Site_use_code doesnt exist please change it and run it one more
time'
);
WHEN TOO_MANY_ROWS
THEN
lv_exp := NULL;
END;
fnd_file.put_line (fnd_file.LOG,
'Inserting Site_use_code--' || lv_site_use_code
);
BEGIN
SELECT status
INTO lv_status
FROM xxar_cust_stg
WHERE status IN ('A', 'I');
EXCEPTION
WHEN OTHERS
THEN
lv_err_flag := 'E';
fnd_file.put_line (fnd_file.LOG,
'CUSTOMER_status is not valid... '
);
END;

fnd_file.put_line (fnd_file.LOG,
'Inserting CUSTOMER_status -- ' || lv_status
);
BEGIN
SELECT credit_hold
INTO lv_credit_hold
FROM xxar_profile_stg
WHERE credit_hold IN ('Y', 'N');
EXCEPTION
WHEN OTHERS
THEN
lv_err_flag := 'E';
fnd_file.put_line (fnd_file.LOG,
' CREDIT_HOLD is not valid... '
);
END;
fnd_file.put_line (fnd_file.LOG,
'Inserting CREDIT_HOLD -- ' || lv_credit_hold
);
--Cursor loop starts here --FOR j IN ar_prof (i.orig_system_customer_ref)
LOOP
BEGIN
SELECT NAME
INTO lv_customer_profile_class_name
FROM ar_customer_profile_classes
WHERE NAME = j.customer_profile_class_name;
EXCEPTION
WHEN OTHERS
THEN
lv_err_flag := 'E';
fnd_file.put_line
(fnd_file.LOG,
' CUSTOMER_PROFILE_CLASS_NAME is not valid... '
);
END;
fnd_file.put_line (fnd_file.LOG,
'Inserting CUSTOMER_PROFILE_CLASS_NAME -- '
|| lv_customer_profile_class_name
);
BEGIN
SELECT NAME
INTO lv_collector_name
FROM ar_collectors

WHERE NAME = j.collector_name;


EXCEPTION
WHEN OTHERS
THEN
lv_err_flag := 'E';
fnd_file.put_line (fnd_file.LOG,
' COLLECTOR_NAME is not valid... '
);
END;
fnd_file.put_line (fnd_file.LOG,
'Inserting COLLECTOR_NAME -- '
|| lv_collector_name
);
BEGIN
SELECT ac.NAME
INTO lv_dunning_letter_set_name
FROM ar_dunning_letter_sets ac
WHERE ac.NAME = j.dunning_letter_set_name;
EXCEPTION
WHEN OTHERS
THEN
lv_err_flag := 'E';
fnd_file.put_line
(fnd_file.LOG,
' DUNNING_LETTER_SET_NAME is not valid... '
);
END;
fnd_file.put_line (fnd_file.LOG,
'Inserting DUNNING_LETTER_SET_NAME -- '
|| lv_dunning_letter_set_name
);
BEGIN
SELECT NAME
INTO lv_statement_cycle_name
FROM ar_statement_cycles
WHERE NAME = j.statement_cycle_name;
EXCEPTION
WHEN OTHERS
THEN
lv_err_flag := 'E';
fnd_file.put_line (fnd_file.LOG,
' STATEMENT_CYCLE_NAME is not valid... '
);
END;
fnd_file.put_line (fnd_file.LOG,

'Inserting STATEMENT_CYCLE_NAME -- '


|| lv_statement_cycle_name
);
IF lv_err_flag = 'A'
THEN
INSERT INTO ra_customers_interface_all
(insert_update_flag,
orig_system_customer_ref, customer_status,
customer_name, customer_number,
site_use_code, primary_site_use_flag,
orig_system_address_ref, address1,
address2, city, state, country, last_updated_by,
last_update_date, created_by, creation_date
)
VALUES (lv_insert_update_flag,
i.orig_system_customer_ref, lv_status
--, i.PARTY_NUMBER
,
i.customer_name, i.customer_number,
i.site_use_code, lv_primary_site_use_flag,
i.orig_system_address_ref, i.address1,
i.address2, i.city, i.state, i.country, -1,
SYSDATE, -1, SYSDATE
);
INSERT INTO ra_customer_profiles_int_all
(insert_update_flag,
orig_system_customer_ref,
credit_balance_statements, dunning_letters,
statements, customer_profile_class_name,
dunning_letter_set_name, collector_name,
credit_hold, statement_cycle_name,
last_updated_by, last_update_date, created_by,
creation_date
)
VALUES (lv_insert_update_flag,
j.orig_system_customer_ref,
'N', 'Y',
'N', lv_customer_profile_class_name,
lv_dunning_letter_set_name, lv_collector_name,
lv_credit_hold, lv_statement_cycle_name,
-1, SYSDATE, -1,
SYSDATE
);
END IF;
END LOOP;
END LOOP;
EXCEPTION
WHEN OTHERS

THEN
fnd_file.put_line (fnd_file.LOG,
'Error in inserting data into interface tables '
);
fnd_file.put_line (fnd_file.LOG, SQLCODE || ' ' || SQLERRM);
COMMIT;
END xxar_custint_prc;
END xxar_custint_pkg;
/
IN ORACLE APPLICATIONS:
Create an Executable in Apps XXAR_CUSTINT_PKG_EXEC
Application xxmz Custom
Create a Concurrent Program by attaching the Executable -XXAR_CUSTINT_PKG_EXEC IFace Conc Prgm
Attach the Concurrent program to Request Group xxmz Request Group
In XXMZ Custom Module, Run the Concurrent Program
In RECEIVABLE Module, Run the Standard Concurrent Program
Customer Interface
Power of Autoinvoice
Here is note on one of most efficient tool used in Oracle application. It is Auto
Invoice, most industry accepted tool in Oracle apps.
What is Auto Invoice??
Auto Invoice is a tool that can be used to import and validate transaction data from
other financial systems from which one can create invoices, debit memos, credit
memos, and on-account credits. It rejects transactions with invalid information to
insure the integrity of the data.
Where its fits
This fits well with in Oracle ERP or to integrate with any third party application< ?
xml:namespace prefix ="" o />
What Module data can be integrated?
Oracle Order Management
Oracle Project Accounting
Oracle services
To make fully functional what else required
Loader program
Validation program
Top 10 reasons for using Auto Invoice
1. Powerful Interface Tool
2. Supports Oracle & Non-Oracle Systems
3. Import Large Amount of Data
4. Calculate or Import Tax
5. Group Lines & Invoices
6. Online Error Correction
7 .Lines Validation
8. Derive GL Date
9 .Import Flex fields
10.Import or Derive Accounting Info

What is inside AutoInvoice


AutoInvoice is a tool consists of 3 main programs. Each program will have unique
nature of work to do and they are called internally except Purge program whose
execution is derived on the setup otherwise ready to execute stand alone.
Master (RAXMTR)
Import (RAXTRX)
Purge (RAXDEL)
1. Auto Invoice Master program RAXMTR
Selects and marks records in the interface tables to be processed based on the
parameters the user entered and then calls the AutoInvoice Import program. Auto
Invoice Master program has no report output.
Gathers statistics, it means it gathers the stats on interface tables and set the
stats on certain indices on interface tables
Marks interface records for processing by marking request_id
Submits multiple workers for Parallel Processing by creating instances for request.
2. Auto Invoice Import Program Validates the selected record and creates
transaction if it passes validation. Any record that fails validation is left in the
interface table with an error code. Depending on the setup, related records may be
rejected as well. This program has an output file called Auto Invoice Execution
report, which you can view by clicking the View Report button in the Requests
window.
Workhorse of Auto invoice
Validates data
Inserts records
Deletes interface data
Only when system option purge set to Y
3. Auto Invoice Purge Program Deletes records from the interface tables. If you set
the Purge Interface Table system option to No in Define System Option window, Auto
Invoice does not delete processed records from the interface tables after each
run,and we must submit Auto Invoice Purge Program periodically to clean up the
interface tables. This program only deletes transaction lines that have been
successfully imported.
Deletes all rows where interface_status =P
Ra_interface_lines
Ra_interface_distributions
Ra_interface_sales credits
How to start
As discussed above, oracle Receivables Auto Invoice program will be used to import
and validate Invoices.
A custom feeder program is required to transfer data from the Advantage extract
files and populate the Auto Invoice interface tables (RA_INTERFACE_LINES_ALL and
RA_INTERFACE_DISTRIBUTIONS_ALL).If there is need to run populate sales credit into
RA_INTERFACE_SALESCREDITS_ALL table.
When run, AutoInvoice produces the AutoInvoice Execution Report and the
AutoInvoice Validation Report.
Any entries which failed validation can be reviewed in Oracle Receivables
AutoInvoice Interface Exceptions window. Depending on the error, changes may
need to be made in Receivables, the feeder program or the imported records in the
interface tables.

How Auto invoice Execution works


Normally, Auto Invoice can be divided into three major phases
Pre-grouping: here the validates all of the line level data takes place
Grouping: groups lines based on the grouping rules and validates header level data
Transfer :validates information that exists in Receivables tables
What happen when Auto invoice run
Once the Auto invoice Program gets called, the following activity takes place is part
of execution process. This can be analyzed by debug options.
Line, accounting, and sales credit information for each line populates 3 interface
tables
Lines are ordered and grouped
Tax is calculated
GL date is determined
GL accounts are assigned using Auto Accounting
Tax, freight, commitments, and credit memos are linked to transaction lines
All transactions are batched
Validated lines are used to create the transaction
How Data is flowing
Select, insert and update and delete take place on certain tables once it is logged
out.
Selects
RA_INTERFACE_LINES_ALL
RA_INTERFACE_DISTRIBUTIONS_ALL
RA_INTERFACE_SALESCREDITS_ALL
Updates/Insert
RA_INTERFACE_ERRORS_ALL
RA_CUSTOMER_TRX_ALL
RA_CUSTOMER_TRX_LINES_ALL
AR_PAYMENT_SCHEDULES_ALL
AR_RECEIVABLE_APPLICATIONS_ALL
Inserts
RA_INTERFACE_ERRORS_ALL
AutoInvoice Exception Handling
Records that fail validation are called Exceptions
Exceptions stay in Interface Tables which is RA_INTERFACE_ERRORS_ALL
Errors can be corrected in the Exception Handling window
Once corrections are made, Auto invoice must be resubmitted
Records that pass validation get transferred to Receivables tables
AutoInvoice Exception Handling Windows
Interface Exception window displays exception messages associated with all invalid
records
Interface Lines window displays records that fail validation, provides an error
message and can be used to correct the errors
The Line Errors windows displays errors associated with a specific line, and can only
be opened from Interface Lines window
Interface Exceptions window displays Interface Id, Exception Type, Error Message
and Invalid Value associated to the error

Data cannot be edited in this window, but error can be viewed and corrected by
clicking the Details button
Error Message and Column name with invalid data are displayed in the Message
column, and the invalid value that needs to be corrected is displayed in the Invalid
Value column
AUTO INVOICE INTERFACE
This interface is used to import Customer invoices, Credit memos, Debit memos and
On Account credits.
Pre-requisites:
Set of Books
Code combinations
Items
Sales representatives
Customers
Sales Tax rate
Payment Terms
Transaction Types
Freight Carriers
FOB
Batch Sources
Accounting Rules
Interface tables:
RA_INTERFACE_LINES_ALL
RA_INTERFACE_SALESCREDITS
RA_INTERFACE_DISTRIBUTIONS
RA_INTERFACE_ERRORS (details about the failed records)
Base tables:
RA_BATCHES
RA_CUSTOMER_TRX_ALL
RA_CUSTOMER_TRX_LINES_ALL
AR_PAYMENT_SCHEDULES_ALL
RA_CUST_TRX_GL_DIST_ALL
RA_CUSTOMER_TRX_TYPES_ALL

RA_CUSTOMER_TRX_LINE_SALESREPS

Concurrent Program: Auto invoice master program


Validations:
Check for amount, batch source name, conversion rate, conversion type.
Validate orig_system_bill_customer_id, orig_system_bill_address_id, quantity.
Validate if the amount includes tax flag.
Some important columns that need to be populated in the interface tables:

RA_INTERFACE_LINES_ALL:
AGREEMENT_ID
COMMENTS
CONVERSION_DATE
CONVERSION_RATE
CONVERSION_TYPE
CREDIT_METHOD_FOR_ACCT_RULE
CREDIT_METHOD_FOR_INSTALLMENTS
CURRENCY_CODE
CUSTOMER_BANK_ACCOUNT_ID
CUST_TRX_TYPE_ID
DOCUMENT_NUMBER
DOCUMENT_NUMBER_SEQUENCE_ID
GL_DATE
HEADER_ATTRIBUTE115
HEADER_ATTRIBUTE_CATEGORY
INITIAL_CUSTOMER_TRX_ID
INTERNAL_NOTES
INVOICING_RULE_ID
ORIG_SYSTEM_BILL_ADDRESS_ID
ORIG_SYSTEM_BILL_CONTACT_ID
ORIG_SYSTEM_BILL_CUSTOMER_ID
ORIG_SYSTEM_SHIP_ADDRESS_ID
ORIG_SYSTEM_SHIP_CONTACT_ID
ORIG_SYSTEM_SHIP_CUSTOMER_ID
ORIG_SYSTEM_SOLD_CUSTOMER_ID
ORIG_SYSTEM_BATCH_NAME
PAYMENT_SERVER_ORDER_ID
PREVIOUS_CUSTOMER_TRX_ID
PRIMARY_SALESREP_ID
PRINTING_OPTION
PURCHASE_ORDER
PURCHASE_ORDER_DATE
PURCHASE_ORDER_REVISION
REASON_CODE
RECEIPT_METHOD_ID
RELATED_CUSTOMER_TRX_ID
SET_OF_BOOKS_ID
TERM_ID
TERRITORY_ID
TRX_DATE
TRX_NUMBER

Receipt API
To bring in Unapplied Receipts and Conversion Receipts for Open Debit items to
reduce the balance to the original amount due.
Pre-requisites:
Set of Books
Code combinations
Items
Quick Codes
Sales representatives
Customers
Sales Tax rate
API:
AR_RECEIPT_API_PUB.CREATE_CASH
AR_RECEIPT_API_PUB.CREATE_AND_APPLY
Base tables:
AR_CASH_RECEIPTS
Validations:
Check the currency and the exchange rate type to assign the exchange rate.
Validate bill to the customer.
Get bill to site use id.
Get the customer trx id for this particular transaction number.
Get payment schedule date for the customer trx id.

Lockbox interface
AutoLockbox lets us automatically process receipts that are sent directly to the bank
instead of manually feeding them in Oracle Receivables.
AutoLockbox is a three step process:
1. Import: During this step, Lockbox reads and formats the data from your bank file
into interface table AR_PAYMENTS_INTERFACE_ALL using a SQL *Loader
script.
2. Validation: The validation program checks data in this interface table for
compatibility with Receivables. Once validated, the data is transferred into
QuickCash tables (AR_INTERIM_CASH_RECEIPTS_ALL and
AR_INTERIM_CASH_RCPT_LINES_ALL).
3. Post QuickCash: This step applies the receipts and updates your customers
balances.
Pre-Requisites:

Banks
Receipt Class
Payment Method
Receipt Source
Lockbox
Transmission format
AutoCash Rule sets
Interface tables:
AR_PAYMENTS_INTERFACE_ALL
(Import
data from bank file)
AR_INTERIM_CASH_RECEIPTS_ALL
AR_INTERIM_CASH_RCPT_LINES_ALL (Validate data in interface table and place in
quick cash tables)
Base Tables:
AR_CASH_RECEIPTS
AR_RECEIVABLES_APPLICATIONS
AR_ADJUSTMENTS
AR_DISTRIBUTIONS_ALL
AR_PAYMENT_SCHEDULES_ALL
Concurrent program:
Lockbox
Validations:
Check for valid record type, transmission record id.
Validate sum of the payments within the transmission.
Identify the lockbox number (no given by a bank to identify a lockbox).
Some important columns that need to be populated in the interface tables:
AR_PAYMENTS_INTERFACE_ALL:
STATUS
RECORD_TYPE
LOCKBOX_NUMBER
BATCH_NAME
TRANSIT_ROUTING_NUMBER
ACCOUNT
CHECK_NUMBER
REMITTANCE_AMOUNT
DEPOSIT_DATE
ITEM_NUMBER
CURRENCY_CODE
DEPOSIT_TIME

AP INVOICE INTERFACE
This interface helps us to import vendor invoices into Oracle applications from
external systems into Oracle Applications.
Pre-requisites:
Set of Books
Code combinations
Employees
Lookups
Interface tables:
AP_INVOICES_INTERFACE
AP_INVOICE_LINES_INTERFACE
Base tables:
AP_INVOICES_ALL header information
AP_INVOICE_DISTRIBUTIONS_ALL lines info
Concurrent program:
Payables Open Interface Import
Validations:
Check for valid vendor
Check for Source, Location, org_id, currency_codes validity
Check for valid vendor site code.
Check if record already exists in payables interface table.
Some important columns that need to be populated in the interface tables:
AP_INVOICES_INTERFACE:
INVOICE_ID
INVOICE_NUM
INVOICE_DATE
VENDOR_NUM
VENDOR_SITE_ID
INVOICE_AMOUNT
INVOICE_CURRENCY_CODE
EXCHANGE_RATE
EXCHANGE_RATE_TYPE
EXCHANGE_DATE
DESCRIPTION
SOURCE
PO_NUMBER
PAYMENT_METHOD_LOOKUP_CODE
PAY_GROUP_LOOKUP_CODE

ATTRIBUTE1 TO 15
ORG_ID
AP_INVOICE_LINES_INTERFACE:
INVOICE_ID
INVOICE_LINE_ID
LINE_TYPE_LOOKUP_CODE
AMOUNT
DESCRIPTION
TAX_CODE
PO_NUMBER
PO_LINE_NUMBER
PO_SHIPMENT_NUM
PO_DISTRIBUTION_NUM
PO_UNIT_OF_MEASURE
QUANTITY_INVOICED
DIST_CODE_CONCATENATED
DIST_CODE_COMBINATION_ID
ATTRIBUTE1
ATTRIBUTE2
ATTRIBUTE3
ATTRIBUTE4
ATTRIBUTE5
ORG_ID

Vendor conversion/interface
This interface is used to import suppliers, supplier sites and site contacts into Oracle
applications.
Pre-requisites setups required:
Payment terms
Pay Groups
CCID
Supplier classifications
Bank Accounts
Employees (if employees have to set up as vendors)
Interface tables:
AP_SUPPLIERS_INT
AP_SUPPLIER_SITES_INT

AP_SUP_SITE_CONTACT_INT
Base Tables:
PO_VENDORS
PO_VENDOR_SITES_ALL
PO_VENDOR_CONTACTS
Interface programs:
Supplier Open Interface Import
Supplier Sites Open Interface Import
Supplier Site Contacts Open Interface Import
Validations:
Check
Check
Check
Check

if
if
if
if

vendor already exists


vendor site already exists
site contact already exists
term is defined.

Some important columns that need to be populated in the interface tables:


AP_SUPPLIERS_INT:
VENDOR_NUMBER, VENDOR_NAME, VENDOR_TYPE, STATE_REPORTABLE,
FED_REPORTABLE, NUM_1099, TYPE_1099, PAY_GROUP_LOOKUP_CODE, VENDOR_ID
is auto generated.
AP_SUPPLIER_SITES_INT:
VENDOR_SITE_ID, ORG_ID, VENDOR_SITE_CODE, INACTIVE_DATE, PAY_SITE,
PURCHASING_SITE, SITE_PAYMENT_TERM, ADDRESS1, ADDRESS2.ADDRESS3, CITY,
STATE, COUNTRY, ZIP, PH_NUM, FAX_NUMBER, TAX_REPORTING_SITE_FLAG.
AP_SUP_SITE_CONTACTS_INT:
VENDOR_ID, VENDOR_SITE_ID, FIRST_NAME, LAST_NAME, AREA_CODE, PHONE,
EMAIL, ORG_ID

Purchase Order conversion:


The Purchasing Document Open Interface concurrent program was replaced by two
new concurrent programs Import Price Catalogs and Import Standard Purchase
Orders. Import Price Catalogs concurrent program is used to import Catalog
Quotations, Standard Quotations, and Blanket Purchase Agreements. Import

Standard Purchase Orders concurrent program is used to import Unapproved or


Approved Standard Purchase Orders.
Import Standard Purchase Orders
Pre-requisites:
Suppliers, sites and contacts
Buyers
Line Types
Items
PO Charge account setup
Interface Tables:
PO_HEADERS_INTERFACE
PO_LINES_INTERFACE
PO_DISTRIBUTIONS_INTERFACE
PO_INTERFACE_ERRORS (Fallouts)
Interface Program:
Import Standard Purchase Orders.
Base Tables:
PO_HEADERS_ALL
PO_LINES_ALL
PO_DISTRIBUTIONS_ALL
PO_LINE_LOCATIONS_ALL
Validations:
Header:
Check if OU name is valid
Check if Supplier is valid
Check if Supplier site is valid
Check if buyer is valid
Check if Payment term is valid
Check if Bill to and ship to are valid
Check if FOB, freight terms are valid
Lines:
Check if Line_type, ship_to_org, item, uom, ship_to_location_id, requestor,
charge_account, deliver_to_location are valid
General:
Check for duplicate records in interface tables
Check if the record already exists in base tables.

Some important columns that need to be populated in the interface tables:


PO_HEADERS_INTERFACE:
INTERFACE_HEADER_ID (PO_HEADERS_INTERFACE_S.NEXTVAL), BATCH_ID, ORG_ID,
INTERFACE_SOURCE_CODE, ACTION (ORIGINAL,'UPDATE,'REPLACE),
GROUP_CODE, DOCUMENT_TYPE_CODE, PO_HEADER_ID (NULL), RELEASE_ID,
RELEASE_NUM, CURRENCY_CODE, RATE, AGENT_NAME, VENDOR_ID,
VENDOR_SITE_ID, SHIP_TO_LOCATION, BILL_TO_LOCATION, PAYMENT_TERMS
PO_LINES_INTERFACE:
INTERFACE_LINE_ID, INTERFACE_HEADER_ID, LINE_NUM, SHIPMENT_NUM, ITEM,
REQUISITION_LINE_ID, UOM, UNIT_PRICE, FREIGHT_TERMS, FOB
PO_DISTRIBUTIONS_INTERFACE:
INTERFACE_LINE_ID, INTERFACE_HEADER_ID, INTERFACE_DISTRIBUTION_ID,
DISTRIBUTION_NUM, QUANTITY_ORDERED, QTY_DELIVERED, QTY_BILLED,
QTY_CANCELLED, DELIVER_TO_LOCATION_ID, DELIVER_TO_PERSON_ID,
SET_OF_BOOKS, CHARGE_ACCT, AMOUNT_BILLED.
Import Blanket Purchase Agreements:
Interface Tables:
PO_HEADERS_INTERFACE
PO_LINES_INTERFACE
Interface program:
Import Price Catalogs
Base tables:
PO_HEADERS_ALL
PO_LINES_ALL
PO_LINE_LOCATIONS_ALL
Example:
Suppose you want to create a blanket with one line and two price breaks and the
details for the price break are as below:
1) Quantity = 500, price = 10, effective date from 01-JAN-2006 to
31-JUN-2006
2) Quantity = 500, price = 11, effective date from 01-JUL-2006 to
01-JAN-2007
To create the above the BPA, you would create ONE record in
PO_HEADERS_INTERFACE and THREE records in PO_LINES_INTERFACE
LINE1: It will have only the line information. LINE NUM would be 1.

LINE2: For the first Price Break details, LINE NUM will be the same as above i.e. 1.
SHIPMENT_NUM would be 1 and SHIPMENT_TYPE would be PRICE BREAK
LINE3: For the second Price Break details, LINE NUM will be the same as above i.e.
1. SHIPMENT_NUM would be 2 and SHIPMENT_TYPE would be PRICE BREAK
All the line-level records above must have the same INTERFACE_HEADER_ID.
For detailed explanation refer to the below article:
http://www.erpschools.com/Apps/oracleapplications/articles/financials/Purchasing/Import-Blanket-PurchaseAgreements/index.aspx

Requisition import
You can automatically import requisitions into Oracle Applications using the
Requisitions Open Interface
Pre-requisites:
Set of Books
Code combinations
Employees
Items
Define a Requisition Import Group-By method in the Default region of the Purchasing
Options window.
Associate a customer with your deliver-to location using the Customer Addresses
window for internally sourced requisitions.
Interface tables:
PO_REQUISITIONS_INTERFACE_ALL
PO_REQ_DIST_INTERFACE_ALL
Base tables:
PO_REQUISITIONS_HEADERS_ALL
PO_REQUISITION_LINES_ALL
PO_REQ_DISTRIBUTIONS_ALL
Concurrent program:
REQUISITION IMPORT
Validations:
Check for interface transaction source code, requisition destination type.
Check for quantity ordered, authorization status type.

Some important columns that need to be populated in the interface tables:


PO_REQUISITIONS_INTERFACE_ALL:
INTERFACE_SOURCE_CODE (to identify the source of your imported
Requisitions)
DESTINATION_TYPE_CODE
AUTHORIZATION_STATUS
PREPARER_ID or PREPARER_NAME
QUANTITY
CHARGE_ACCOUNT_ID or charge account segment values
DESTINATION_ORGANIZATION_ID or DESTINATION_ORGANIZATION_
CODE
DELIVER_TO_LOCATION_ID or DELIVER_TO_LOCATION_CODE
DELIVER_TO_REQUESTOR_ID or DELIVER_TO_REQUESTOR_NAME
ORG_ID
ITEM_ID or item segment values (values if the SOURCE_TYPE_CODE or
DESTINATION_TYPE_CODE is INVENTORY)
PO_REQ_DIST_INTERFACE_ALL:
CHARGE_ACCOUNT_ID or charge account segment values
DISTRIBUTION_NUMBER
DESTINATION_ORGANIZATION_ID
DESTINATION_TYPE_CODE
INTERFACE_SOURCE_CODE
ORG_ID
DIST_SEQUENCE_ID (if MULTI_DISTRIBUTIONS is set to Y)

PO Receipts Interface
The Receiving Open Interface is used for processing and validating receipt data that
comes from sources other than the Receipts window in Purchasing.
Pre-requisites:
Set of Books
Code combinations
Employees
Items
Interface tables:
RCV_HEADERS_INTERFACE
RCV_TRANSACTIONS_INTERFACE
PO_INTERFACE_ERRORS
Concurrent program:

RECEIVING OPEN INTERFACE


Base tables:
RCV_SHIPMENT_HEADERS
RCV_SHIPMENT_LINES
RCV_TRANSACTIONS
Validations:
Check that SHIPPED_DATE should not be later than today.
Check if vendor is valid.
If Invoice number is passed, check for its validity
Check if Item is valid
Some important columns that need to be populated in the interface tables:
RCV_HEADERS_INTERFACE:
HEADER_INTERFACE_ID
GROUP_ID
PROCESSING_STATUS_
CODE
RECEIPT_SOURCE_CODE
TRANSACTION_TYPE
SHIPMENT_NUM
RECEIPT_NUM
VENDOR_NAME
SHIP_TO_
ORGANIZATION_CODE
SHIPPED_DATE
INVOICE_NUM
INVOICE_DATE
TOTAL_INVOICE_
AMOUNT
PAYMENT_TERMS_ID
EMPLOYEE_NAME
VALIDATION_FLAG (Indicates whether to validate a row or not, values Y, N)
RCV_TRANSACTIONS_INTERFACE:
INTERFACE_TRANSACTION_ID
GROUP_ID
TRANSACTION_TYPE (SHIP for a standard shipment (an ASN or ASBN)
or RECEIVE for a standard receipt)
TRANSACTION_DATE
PROCESSING_STATUS_CODE =PENDING
CATEGORY_ID

QUANTITY
UNIT_OF_MEASURE
ITEM_DESCRIPTION
ITEM_REVISION
EMPLOYEE_ID
AUTO_TRANSACT_CODE
SHIP_TO_LOCATION_ID
RECEIPT_SOURCE_CODE
TO_ORGANIZATION_CODE
SOURCE_DOCUMENT_CODE
PO_HEADER_ID
PO_RELEASE_ID
PO_LINE_ID
PO_LINE_LOCATION_ID
PO_DISTRIBUTION_ID
SUBINVENTORY
HEADER_INTERFACE_ID
DELIVER_TO_PERSON_NAME
DELIVER_TO_LOCATION_CODE
VALIDATION_FLAG
ITEM_NUM
VENDOR_ITEM_NUM
VENDOR_ID
VENDOR_SITE_ID
ITEM_ID
ITEM_DESCRIPTION
SHIP_TO_LOCATION_ID
GL JOURNAL INTERFACE
This interface lets you import journals from other applications like Receivables,
Payables etc to integrate the information with General Ledger.
Pre-requisites:
Set of Books
Flex field Value sets
Code Combinations
Currencies
Categories
Journal Sources
Interface tables:
GL_INTERFACE

Base tables:
GL_JE_HEADERS
GL_JE_LINES
GL_JE_BACTHES
Concurrent Program:
Journal Import
Journal Posting populates GL_BALANCES
Validations:
Validate SOB, journal source name, journal category name, actual flag
A Actual amounts
B Budget amounts
E Encumbrance amount
If you enter E in the interface table, then enter appropriate encumbrance ID, if
B enter budget id.
Check if accounting date or GL date based period name is valid (i.e., not closed).
Check if accounting date falls in open or future open period status.
Check chart of accounts id based on Sob id.
Check if code combination is valid and enabled.
Check if record already exists in GL interface table.
Check if already journal exists in GL application.
Some important columns that need to be populated in the interface tables:
GL_INTERFACE:
STATUS
SET_OF_BOOKS_ID
ACCOUNTING_DATE
CURRENCY_CODE
DATE_CREATED
CREATED_BY
ACTUAL_FLAG
USER_JE_CATEGORY_NAME
USER_JE_SOURCE_NAME
CURRENCY_CONVERSION_DATE
ENCUMBRANCE_TYPE_ID
BUDGET_VERSION_ID
USER_CURRENCY_CONVERSION_TYPE
CURRENCY_CONVERSION_RATE
SEGMENT1 to
ENTERED_DR
ENTERED_CR
ACCOUNTED_DR
ACCOUNTED_CR

TRANSACTION_DATE
PERIOD_NAME
JE_LINE_NUM
CHART_OF_ACCOUNTS_ID
FUNCTIONAL_CURRENCY_CODE
CODE_COMBINATION_ID
DATE_CREATED_IN_GL
GROUP_ID

GL budget interface
Budget interface lets you load budget data from external sources into Oracle
Applications.
Pre-requisites:
Set of Books
Flex field Value sets
Code Combinations
Interface tables:
GL_BUDGET_INTERFACE
Base tables:
GL_BUDGETS
GL_BUDGET_ASSIGNMENTS
GL_BUDGET_TYPES
Concurrent program:
Budget Upload
Validations:
Check if CURRENCY_CODE is valid.
Check if SET_OF_BOOKS_ID is valid.
Check if BUDGET_ENTITY_NAME (budget organization) is valid.

Some important columns that need to be populated in the interface tables:


GL_BUDGET_INTERFACE:
BUDGET_NAME NOT
BUDGET_ENTITY_NAME
CURRENCY_CODE

FISCAL_YEAR
UPDATE_LOGIC_TYPE
BUDGET_ENTITY_ID
SET_OF_BOOKS_ID
CODE_COMBINATION_ID
BUDGET_VERSION_ID
PERIOD_TYPE
DR_FLAG
STATUS
ACCOUNT_TYPE
PERIOD1_AMOUNT through PERIOD60_AMOUNT
SEGMENT1 through SEGMENT30

GL daily conversion rates


This interface lets you load the rates automatically into General Ledger.
Pre-requisites:
Currencies
Conversion rate Types
Interface tables:
GL_DAILY_RATES_INTERFACE
Base tables:
GL_DAILY_RATES
GL_DAILY_CONVERSION_TYPES
Concurrent Program:
You do not need to run any import programs. The insert, update, or deletion of rates
in GL_DAILY_RATES is done automatically by database triggers on the
GL_DAILY_RATES_INTERFACE. All that is required is to develop program to populate
the interface table with daily rates information.
Validations:
Check if
FROM_CURRENCY and TO_CURRENCY are valid.
Check if USER_CONVERSION_TYPE is valid.
Some important columns that need to be populated in the interface tables:
GL_DAILY_RATES_INTERFACE:
FROM_CURRENCY

TO_CURRENCY
FROM_CONVERSION_DATE
TO_CONVERSION_DATE
USER_CONVERSION_TYPE
CONVERSION_RATE
MODE_FLAG (D= Delete, I = Insert, U = Update)
INVERSE_CONVERSION_RATE
GL INTERFACES
Difference between Interface and API
An API (Application Programming Interface) is inbuilt program through which
datas can be transferred to Oracle base tables directly without writing the program
for validating or inserting in Interface tables. But through User Interface, we have
to write codes for validation and insertion of datas In Interface tables and then in
Oracle base tables
Oracle defines an API as "A set of public programmatic interface that consist of a
language and message format to communicate with an operating system or other
programmatic environment, such as databases, Web servers, JVMs, and so forth.
These messages typically call functions and methods available for application
development."I guess that there is no such thing as an interface to Oracle=2 there
are only "open" interfaces.
These are a group of published and supported inbound and outbound Interface
objects (talk about them more in a second) that Oracle has developed for your
use=2 these objects may be, a table or group of tables, a concurrent program that
references a PL*SQL or Pro*C/C++ package o library.
Oracle's policy over the years is that if you post data directly to an application table,
then you are invalidating your support agreement, and if you are bored enough, you
can see the clause in the agreement sure enough.But these published interfaces are
quite often not enough to d what you need to do. Take the case of Payables
suppliersfor example. That has been a pain for everyone Right from the beginning.
So in answer to your question. An open interface is a group of objects that Oracle
supports and licenses with the software that allow inbound and outbound data
transactions in Oracle' Approved format. You put data into the tables and oracle
import it or you run a concurrent request and oracle outputs data into that table.
Batch processing. You need to put your data into the right pre-validated format
before inserting into the interface table or the data will be rejected.
An API is programmatic hooks or coding blocks that you can "call that allow you to
perform some function or other to achieve par of your goal. For example, Oracle
Projects there is PA_INTERFACE_UTILS_PUB.CREATE_PROJECT API that takes a list o
input variables that you assign to the called API (these can b in a table or passed
directly) for example;
l_project_in.created_from_project_id := '1001'; -- Project id from template

l_project_in.project_name :='C, AMG TEST PROJECT';


l_project_in.pm_project_reference := 'C, AMG TEST PROJECT';
and if the package passes validation on all these data points your project will be
inserted as a result.
So finally, you can insert data into an open interface table then use a concurrent
program that CALLS an API to process that information.
In the case of real-time processing or OLTP, once you save record in PeopleSoft HR,
you want it to appear in Oracle H immediately, you would write PeopleSoft code that
copies those data items to memory, submit the list of required variable (PeopleSoft
data)to the Oracle API as inputs. The API o completion posts your employee into
theOracle database=2 (ideally you would provide a function then back to PeopleSoft
t confirm that oracle received the transaction correctly and i wasn't rejected by the
API). All this was achieved without the use of an open "interface".
The nail in t he coffin however and where you may be confused, i that many people
think that any exchange of data from one table to another is an "interface". A "link".
And I guess that it i in a way.
Just remember that An interface is the pool,
An open interface table is the lanes and
An API is the swimmer.
The term Open Interfaces actually refers to table driven interfaces, where you put
data in
a table that sits between your external application and the Oracle module you are
interfacing with.
The term API refers to stored procedure driven interfaces, where you call a stored
procedure
to perform an action within an Oracle Module, and the data from your external
application is
passed through the stored procedures parameters. Historically, there were only
table driven
interfaces and they were called Open Interfaces. Later, stored procedures were
added and were called APIs.
GL Interface
Interface tables:
GL_INTERFACE
Base tables:
GL_JE_HEADERS
GL_JE_LINES
GL_JE_BACTHES
Concurrent Program: Journal Import, Journal Posting --- populates GL_BALANCES
Validations: check SOB, journal source name, journal category name, actual flag
A actual amounts

B budget amounts
E encumbrance amount
If u enter E in the interface table, then enter appropriate encumbrance ID.
B budget id.
Check if accounting date or GL date based period name is valid (i.e., not closed).
Check if accounting date falls in open or future open period status.
Check chart of accounts id based on Sob id.
Check if valid code combination.
Check if ccid is enabled.
Check if record already exists in GL interface table.
Check if already journal exists in GL application.
Validations for the staging table:
Check if the input data file is already uploaded into staging table.
Check if the record already exists in the interface table.
Check if the journal already exists in the GL application.
Staging Table:
Create table XX_GL_RY_STG
(status varchar2(50),
set_of_books_id number(15),
User_JE_Source_name varchar2(25),
user_je_category_name varchar2(25),
currency_code varchar2(15),
actual_flag char(1),
ACCOUNTING_DATE date,
DATE_CREATED date,
CREATED_BY number(15),
entered_dr number,
entered_cr number,
accounted_dr number,
accounted_cr number,
segment1 varchar2(25),
segment2 varchar2(25),
segment3 varchar2(25),
segment4 varchar2(25),
segment5 varchar2(25)
);
insert into XX_GL_RY_STG values(
'NEW',1,'Manual' ,'Adjustment','USD','A','20-MAR-2009' ,'20-MAR-2009', 200
0,2000,2000,2000,
'01','000','9950','2080','000','0')
Package:
CREATE OR REPLACE PACKAGE XX_GL_INT_RY_PKG
IS
PROCEDURE xx_gl_int_prc(errbuf out varchar2,Retcode out varchar2);
END;
CREATE OR REPLACE Package body XX_GL_INT_RY_PKG
is
Procedure xx_gl_int_prc(errbuf out varchar2,Retcode out varchar2)
is

cursor GL_CUR
IS
SELECT Status,set_of_books_id,User_JE_Source_name,
user_je_category_name,currency_code,actual_flag,
ACCOUNTING_DATE,DATE_CREATED,CREATED_BY,entered_dr,
entered_cr,accounted_dr,accounted_cr,
segment1, segment2, segment3, segment4, segment5
FROM XX_GL_RY_STG;
lv_status varchar2(50);
lv_sob_id Number(15);
lv_user_je_source_name varchar2(25);
lv_user_je_category_name varchar2(25);
lv_cur_code varchar2(15);
lv_actual_flag varchar2(1);
lv_err_flag varchar2(2);
lv_flag varchar2(2);
BEGIN
FOR rec in GL_CUR
LOOP
lv_flag := 'A';
lv_err_flag := 'A';
BEGIN
SELECT distinct Status into lv_status from XX_GL_RY_STG Where status = 'NEW';
EXCEPTION
When no_data_found Then
lv_status := null;
lv_flag := 'E';
lv_err_flag := 'E';
FND_FILE.PUT_line(FND_FILE.LOG,'The status is not correct so change the status');
FND_FILE.PUT_line(FND_FILE.LOG,'The data is inserting'|| lv_status );
END;
BEGIN
SELECT set_of_books_id into lv_sob_id from gl_sets_of_books
where set_of_books_id=rec.set_of_books_id;
Exception
When no_data_found Then
lv_sob_id:=null;
lv_flag := 'E';
lv_err_flag := 'E';
FND_FILE.PUT_line(FND_FILE.LOG,'The SOB is not correct change SOB ID');
End;
FND_FILE.PUT_line(FND_FILE.LOG,'The data is inserting'|| lv_sob_id );
BEGIN
SELECT user_je_source_name into lv_user_je_source_name FROM GL_JE_SOURCES
WHERE user_je_source_name=rec.user_je_source_name;
EXCEPTION
WHEN no_data_found THEN
lv_user_je_source_name := NULL;
lv_flag := 'E';
lv_err_flag := 'E';

FND_FILE.PUT_line(FND_FILE.LOG,'The SOURCE NAME is not correct change It');


END;
FND_FILE.PUT_line(FND_FILE.LOG,'The data inserting is'|| lv_user_je_source_name );
BEGIN
SELECT user_je_category_name INTO lv_user_je_category_name FROM
GL_JE_CATEGORIES
where user_je_category_name=rec.user_je_category_name;
EXCEPTION
When no_data_found Then
lv_user_je_category_name:=NULL;
lv_flag := 'E';
lv_err_flag := 'E';
FND_FILE.PUT_line(FND_FILE.LOG,'The Category name is not correct Change it');
FND_FILE.PUT_line(FND_FILE.LOG,'The data inserting is'||
lv_user_je_category_name );
END;
BEGIN
SELECT currency_code into lv_cur_code from FND_CURRENCIES
where currency_code=rec.currency_code;
Exception
When no_data_found Then
lv_cur_code:=null;
lv_flag := 'E';
lv_err_flag := 'E';
FND_FILE.PUT_line(FND_FILE.LOG,'The Currency code is not correct ');
End;
FND_FILE.PUT_line(FND_FILE.LOG,'The data inserting is'|| lv_cur_code);
BEGIN
SELECT ACTUAL_FLAG into lv_actual_flag from XX_GL_RY_STG
where actual_flag in ('A','B','E');
Exception
When no_data_found then
lv_actual_flag := null;
lv_flag := 'E';
lv_err_flag := 'E';
FND_FILE.PUT_line(FND_FILE.LOG,'The Flag is not correct');
END;
FND_FILE.PUT_line(FND_FILE.LOG,'The dat inserting is... '|| lv_actual_flag);
IF lv_flag = 'A' THEN
INSERT into GL_INTERFACE (
STATUS, SET_OF_BOOKS_ID, USER_JE_SOURCE_NAME ,USER_JE_CATEGORY_NAME,
CURRENCY_CODE,ACTUAL_FLAG,
ACCOUNTING_DATE, DATE_CREATED,CREATED_BY, ENTERED_DR,ENTERED_CR,
ACCOUNTED_DR,ACCOUNTED_CR,segment1, segment2, segment3, segment4,
segment5)
VALUES (
lv_Status, lv_sob_id, lv_User_JE_Source_name, lv_user_je_category_name,
lv_cur_code,lv_actual_flag,rec.ACCOUNTING_DATE, rec.DATE_CREATED,
1318,rec.entered_dr, rec.entered_cr, rec.accounted_dr,rec.accounted_cr,
rec.segment1, rec.segment2, rec.segment3, rec.segment4, rec.segment5);

END IF;
lv_flag :=null;
lv_err_flag:=null;
END LOOP;
COMMIT;
End;
END XX_GL_INT_RY_PKG;
/
Base tables for GL Daily Rates are
Gl_DAILY_RATES
Interface table for GL Daily Rates are
Gl_DAILY_RATES_INTERFACE
Moving the Data from Flat File to Base Table using SQL * LOADER:
Options (Skip =0)
Load data
infile '/ebs/oracle/apps/apps_st/appl/gl/12.0.0/bin/gl_daily_rates.csv'
Insert into table GL_daily_rates_stg
fields terminated by ','
optionally enclosed by '"'
Trailing nullcols
(From_currency ,To_currency, From_conversion_date, To_conversion_date,
User_conversion_type, conversion_rate, Mode_flag)
Moving the data from Staging tables to Base Tables using
Standard Interface Programs:
Create a Staging table based on the requirement
CREATE TABLE XXGL_DRATES_STG (
FROM_CURRENCY VARCHAR2(15),
TO_CURRENCY VARCHAR2(15),
FROM_CONVERSION_DATE DATE,
TO_CONVERSION_DATE DATE,
USER_CONVERSION_TYPE VARCHAR2(30),
CONVERSION_RATE NUMBER,
MODE_FLAG CHAR(1));
Inserting Data into Staging Table:
Insert into XXGL_DRATES_STG Values (
'USD','INR','29-Jan-2009','31-Jan-2009','Corporate','50','I');
Create a Package with validations to move the data into Interface Tables
CREATE OR REPLACE PACKAGE XXGL_DRATES_PKG
is
PROCEDURE DAILY_RATES_PRC(retcode out number,errbuff out varchar2);
END;
CREATE OR REPLACE PACKAGE BODY XXGL_DRATES_PKG
is

PROCEDURE DAILY_RATES_PRC(retcode out number, errbuff out varchar2)


Is
Cursor cur_drates is
Select FROM_CURRENCY,
TO_CURRENCY, FROM_CONVERSION_DATE , TO_CONVERSION_DATE ,
USER_CONVERSION_TYPE,
CONVERSION_RATE , MODE_FLAG FROM XXGL_DRATES_STG;
LV_FROM_CURRENCY VARCHAR2(15);
LV_TO_CURRENCY VARCHAR2(15);
LV_USER_CONVERSION_TYPE VARCHAR2(30);
LV_CONVERSION_RATE NUMBER;
LV_ERR_FLAG VARCHAR2(1):= 'A';
BEGIN
FOR i IN CUR_DRATES
LOOP
BEGIN
Select CURRENCY_CODE into LV_FROM_CURRENCY FROM
FND_CURRENCIES where CURRENCY_CODE=i.FROM_CURRENCY;
Exception
When NO_DATA_FOUND Then
lv_from_currency := null;
lv_err_flag := 'E';
FND_FILE.PUT_line(FND_FILE.LOG,'The Currency Code is not defined
/not enabled if not enabled enable it.');
end;
FND_FILE.PUT_line(FND_FILE.LOG,'The Currency Code inserting IS--'
|| LV_FROM_CURRENCY );
BEGIN
Select CURRENCY_CODE into LV_TO_CURRENCY
FROM FND_CURRENCIES where ENABLED_FLAG='Y'
AND CURRENCY_CODE=i.To_CURRENCY;
Exception
When NO_DATA_FOUND Then
lv_from_currency := null;
lv_err_flag := 'E';
FND_FILE.PUT_line(FND_FILE.LOG,'The Currency Code is not defined
/not enabled if not enabled enable it.');
end;
FND_FILE.PUT_line(FND_FILE.LOG,'The Currency Code inserting IS--'
|| LV_TO_CURRENCY );
BEGIN
Select USER_CONVERSION_TYPE into LV_USER_CONVERSION_TYPE
FROM GL_DAILY_CONVERSION_TYPES where
USER_CONVERSION_TYPE=i.USER_CONVERSION_TYPE;
Exception
When NO_DATA_FOUND Then
LV_USER_CONVERSION_TYPE := null;
lv_err_flag := 'E';
FND_FILE.PUT_line(FND_FILE.LOG,'The USER_CONVERSION_TYPE is not defined.');
end;

FND_FILE.PUT_line(FND_FILE.LOG,'The USER_CONVERSION_TYPE inserting IS--'


||LV_USER_CONVERSION_TYPE );
BEGIN
Select USER_CONVERSION_TYPE into LV_USER_CONVERSION_TYPE
FROM GL_DAILY_CONVERSION_TYPES where
USER_CONVERSION_TYPE=i.USER_CONVERSION_TYPE;
Exception
When NO_DATA_FOUND Then
LV_USER_CONVERSION_TYPE := null;
lv_err_flag := 'E';
FND_FILE.PUT_line(FND_FILE.LOG,'The USER_CONVERSION_TYPE is not defined.');
end;
FND_FILE.PUT_line(FND_FILE.LOG,'The USER_CONVERSION_TYPE inserting IS--'
||LV_USER_CONVERSION_TYPE );
IF LV_ERR_FLAG='A' THEN
INSERT INTO GL_DAILY_RATES_INTERFACE (
FROM_CURRENCY, TO_CURRENCY,
FROM_CONVERSION_DATE, TO_CONVERSION_DATE,
USER_CONVERSION_TYPE, CONVERSION_RATE,
MODE_FLAG)
VALUES (
LV_FROM_CURRENCY,LV_TO_CURRENCY,
I.FROM_CONVERSION_DATE, I.TO_CONVERSION_DATE
, LV_USER_CONVERSION_TYPE, I.CONVERSION_RATE
, I.MODE_FLAG);
END IF;
END LOOP;
COMMIT;
END;
END XXGL_DRATES_PKG;
Create an Executable XXGL_DRATES_PKG_EXEC
Execution File
Create a Concurrent program XXGL_DRATES_PKG_EXEC IFace Conc prg
Add the Conc program to the Request group
In custom module, Run the Conc Program thro SRS Window.
In GL MODULE Run the Standard Concurrent Program
Program - Daily Rates Import and Calculation

Anda mungkin juga menyukai