0% found this document useful (0 votes)
360 views

API To Create Item

This document declares variables and then uses a loop to populate an item table with sample data. It calls a process to create inventory items, checks the status, and outputs any error messages.

Uploaded by

bcmohan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
360 views

API To Create Item

This document declares variables and then uses a loop to populate an item table with sample data. It calls a process to create inventory items, checks the status, and outputs any error messages.

Uploaded by

bcmohan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

DECLARE

l_item_table EGO_Item_PUB.Item_Tbl_Type;
x_item_table EGO_Item_PUB.Item_Tbl_Type;
x_message_list Error_Handler.Error_Tbl_Type;
x_return_status VARCHAR2(1);
x_msg_count NUMBER(10);
l_user_id NUMBER(10);
l_application_id NUMBER(10);
l_resp_id NUMBER(10);
l_org_id NUMBER(10);
gn_msg_count NUMBER(10);
l_rowcnt NUMBER := 1;

BEGIN
-- Get the user_id
SELECT user_id
INTO l_user_id
FROM fnd_user
WHERE user_name = 'CONVERSION';
-- Get the application_id and responsibility_id
SELECT application_id, responsibility_id
INTO l_application_id, l_resp_id
FROM fnd_responsibility
WHERE responsibility_key ='INVENTORY';
for i in 1..2 loop
l_Item_Table(l_rowcnt).Segment1
:= '20191';
l_item_Table(l_rowcnt).Transaction_Type
:= 'CREATE';
l_Item_Table(l_rowcnt).description
:= '12x40 DSA LB';
l_Item_Table(l_rowcnt).template_name
:= '@Purchased Item';
l_Item_Table(l_rowcnt).Item_number
:= '20191';
-- l_Item_Table(j).purchasing_item_flag
:= i.purchasing_item_flag;
-- l_Item_Table(j).taxable_flag
:= i.taxable_flag;
l_Item_Table(l_rowcnt).list_price_per_unit
:= 1000;
l_Item_Table(l_rowcnt).primary_uom_code
:= 'Ea';
--l_Item_Table(j).invoiceable_item_flag
:= i.invoiceable_item_flag;
l_Item_Table(l_rowcnt).organization_code
:= 'MIM';
l_Item_Table(l_rowcnt).item_type
:= 'Purchased item';
--l_item_Table(l_rowcnt).Inventory_Item_St
atus_Code := 'Active';
--l_item_table(j).process_item_record
:= i.record_ind;
l_rowcnt := l_rowcnt + 1;
end loop;
FND_GLOBAL.APPS_INITIALIZE(l_user_id, l_resp_id, l_application_id); -- MGRP
LM / Development Manager / EGO
dbms_output.put_line('Initialized applications context: '|| l_user_id || ' '
|| l_resp_id ||' '|| l_application_id );
l_org_id := fnd_profile.value('ORG_ID');
MO_GLOBAL.SET_POLICY_CONTEXT('S',l_org_id);
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_t
able
,x_Item_Tbl => x_item_t
able
,x_return_status => x_return
_status
,x_msg_count => gn_msg_c
ount);

commit;
DBMS_OUTPUT.PUT_LINE('=====================================');
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 :'||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;
DBMS_OUTPUT.PUT_LINE('=====================================');
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Exception Occured :');
DBMS_OUTPUT.PUT_LINE(SQLCODE ||':'||SQLERRM);
DBMS_OUTPUT.PUT_LINE('=====================================');
END;

OUTPUT(ERRORMESSAGE)
=====================
The ITEM_TYPE specified is not a valid Item Type or is not enabled.
Definition of category set Inventory, assigned to functional area Cost, does not
have a default category specified.
The ITEM_TYPE specified is not a valid Item Type or is not enabled.
Definition of category set Inventory, assigned to functional area Cost, does not
have a default category specified.
=====================================

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy