Вы находитесь на странице: 1из 3

ITEM IMPORT API IN ORACLE APPS R12

In this post , W e will discuss about Inventory API uses to create the Inventory items in
Oracle apps. Oracle has provided the standard API to create the Inventory Items from the
backend. W e don't need to use the Item interface to create the Inventory items but we can
use the API directly which helps to create the Inventory item in oracle apps. Here below is
the complete script using Inventory api in oracle apps r12.
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', specif y the 'set
process id' value given in the mtl_item_categories_interface table. The parameter 'Create
or Update' can have an y 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
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:
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_REVISIONS_INTERFACE:
INVENTORY_ITEM_ID or ITEM_NUMBER (Must match the 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
TRANSACTION_TYPE = 'CREATE'
SET_PROCESS_ID = 1

Example using Inventory api in oracle apps r12 : DECLARE


l_item_table EGO_Item_PUB.Item_Tbl_Type;
v_item_tabl_type EGO_Item_PUB.Item_Tbl_Type;
x_return_status VARCHAR2(1);
x_msg_count NUMBER(10);
x_msg_data VARCHAR2(1000);
x_message_list Error_Handler.Error_Tbl_Type;

BEGIN
FND_GLOBAL.APPS_INITIALIZE(USER_ID=>2524,RESP_ID=>20634,RESP_APPL_ID=
>401);
l_item_table(1).Transaction_Type := 'CREATE'; -- Replace this with
'UPDATE' for update transaction.
l_item_table(1).Segment1 := '001100002234'; -- item code---
l_item_table(1).Description := 'TEST ITEM'; -- item description ----
l_item_table(1).Organization_Code := 'IMO'; --inventory master org
code--
l_item_table(1).Template_Name := '@PURCHASED GOOD'; -- inventory
template name from which item will inherit the item attributes
values--

EGO_ITEM_PUB.Process_Items(
p_api_version => 1.0
,p_init_msg_list => FND_API.g_TRUE
,p_commit => FND_API.g_TRUE
,p_Item_Tbl => l_item_table
,x_Item_Tbl =>v_item_tabl_type
,x_return_status => x_return_status
,x_msg_count => x_msg_count);
DBMS_OUTPUT.PUT_LINE('API Return Status ==>' ||x_return_status);
IF (x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
DBMS_OUTPUT.PUT_LINE('SUCCESS');
FOR i IN 1..v_item_tabl_type.COUNT LOOP
DBMS_OUTPUT.PUT_LINE('Inventory Item Id
Created:'||to_char(v_item_tabl_type(i).Inventory_Item_Id));
DBMS_OUTPUT.PUT_LINE('Organization Id
:'||to_char(v_item_tabl_type(i).Organization_Id));
END LOOP;
ELSE
DBMS_OUTPUT.PUT_LINE('Error Messages :');
Error_Handler.GET_MESSAGE_LIST(x_message_list=>x_message_list);
FOR i IN 1..x_message_list.COUNT LOOP
DBMS_OUTPUT.PUT_LINE(x_message_list(i).message_text);
END LOOP;
END IF;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Error has Occure d and error is
'||SUBSTR(SQLERRM,1,200));
END;

Вам также может понравиться