Item Update Script Oracle apps


Below is a simple Item upload Script. The Mandatory Information that we have to pass is the Inventory_item_id and organization_id so once the other Information is given then the script will update the items.
—————————-
–UPDATE
—————————-
DECLARE
l_item_table EGO_Item_PUB.Item_Tbl_Type;
x_item_table 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;
cursor c is select * from mtl_system_items_b where RECEIPT_REQUIRED_FLAG =
nvl(‘N’, ‘N’);
BEGIN

for item_rec_req in c_item_rec_req loop
–Apps Initialization
–select * from fnd_user where user_name = ‘4IAPPS’;

–select * from fnd_responsibility_tl where responsibility_name like ‘Inventory Super User’

FND_GLOBAL.APPS_INITIALIZE(USER_ID=>1110,RESP_ID=>20634,RESP_APPL_ID=>401);

–FIRST Item definition
l_item_table(1).Transaction_Type := ‘UPDATE’;
— Replace this with ‘UPDATE’ for update transaction.
–l_item_table(1).Segment1 := ‘TESTAPEXITEM’;
l_item_table (1).inventory_item_id := item_rec_req.inventory_item_id;
–l_item_table(1).Description := ‘UPDATED – TESTAPEXITEM’;
–l_item_table(1).Organization_Code := ‘IMO’; –masterorg
l_item_table(1).Organization_id := item_rec_req.organization_id;
–l_item_table(1).Template_Name := ‘BPI FINISHED GOOD-MAKE’; –template
l_item_table(1).RECEIPT_REQUIRED_FLAG := ‘Y’;
DBMS_OUTPUT.PUT_LINE(‘Calling API to Create Item’);

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 => x_item_table
,x_return_status => x_return_status
,x_msg_count => x_msg_count);

DBMS_OUTPUT.PUT_LINE(‘Sucess:’);
DBMS_OUTPUT.PUT_LINE(‘Return Status ==>’ ||x_return_status);

IF (x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
FOR i IN 1..x_item_table.COUNT LOOP
DBMS_OUTPUT.PUT_LINE(‘Inventory Item Id Created:’||to_char(x_item_table(i).
Inventory_Item_Id));
DBMS_OUTPUT.PUT_LINE(‘Organization Id :’||to_char(x_item_table(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;
end loop;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(‘Error has Occured and error is ‘||SUBSTR(SQLERRM,1,200))
;
END;

Thank you.

About pacesettergraam

A good and realistic person

Posted on May 15, 2016, in Oracle, oracle apps and tagged , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: