Inventory api in oracle apps r12
In this post , We 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. We 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.
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 Occured and error is '||SUBSTR(SQLERRM,1,200));
END;
0 comments:
Post a Comment