Search code examples
oracleoracle-apps

Items assigned using API does not appear in Oracle EBS application windows


I used the following API to assign multiple items (one by one) from one organization to another.I had created test items through the inventory responsibility using master item window and then assign them to another organization using the following code:

BEGIN 
DECLARE 
l_api_version NUMBER := 1.0; 
l_init_msg_list VARCHAR2(2) := FND_API.G_TRUE; 
l_commit VARCHAR2(2) := FND_API.G_FALSE; 
x_message_list error_handler.error_tbl_type; 
itemid mtl_system_items_b.inventory_item_id %TYPE; 
segment1 mtl_system_items_b.segment1 %TYPE; 
primary_uom_code mtl_system_items_b.primary_uom_code %TYPE; 
x_return_status VARCHAR2(2); 
x_msg_count NUMBER := 0; 
BEGIN 
SELECT inventory_item_id INTO itemid FROM mtl_system_items_b WHERE inventory_item_id=2447106 and organization_id=116; 
SELECT segment1 
INTO segment1 FROM mtl_system_items_b WHERE inventory_item_id=2447106 and organization_id=116; 
SELECT primary_uom_code INTO primary_uom_code FROM mtl_system_items_b WHERE inventory_item_id=2447106 and organization_id=116; 

EGO_ITEM_PUB.ASSIGN_ITEM_TO_ORG( 
P_API_VERSION => l_api_version 
, P_INIT_MSG_LIST => l_INIT_MSG_LIST 
, P_COMMIT => l_COMMIT 
, P_INVENTORY_ITEM_ID => itemid --(item id from the above Query) 
, P_ITEM_NUMBER => segment1 --(Item Code from the above Query) 
, P_ORGANIZATION_ID => 117 --(Organization Id for assingment) 
, P_ORGANIZATION_CODE => 'D12'--v_organization_code 
, P_PRIMARY_UOM_CODE =>primary_uom_code --(UOM from the above Query) 
, X_RETURN_STATUS => X_RETURN_STATUS 
, X_MSG_COUNT => X_MSG_COUNT 
); 
DBMS_OUTPUT.PUT_LINE('Status: '||x_return_status); 
IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN 
DBMS_OUTPUT.PUT_LINE('Error Messages :'); 
Error_Handler.GET_MESSAGE_LIST(x_message_list=> x_message_list); 
FOR j IN 1..x_message_list.COUNT LOOP 
DBMS_OUTPUT.PUT_LINE(x_message_list(j).message_tex t); 
END LOOP; 
END IF; 
EXCEPTION 
WHEN OTHERS THEN 
dbms_output.put_line('Exception Occured :'); 
DBMS_OUTPUT.PUT_LINE(SQLCODE ||':'||SQLERRM); 

END; 
END; 

After completion, I checked into the database and the items were assigned to the organization i wanted to. However, these items were not appearing in any of the windows when i searched through GUI (Item information window or item search window) under the new organization that i assigned them too.

I tried changing few values that appeared to be abnormal (E.g: last update time was '-1' probably because i used API and not GUI using my user id and password).

Why are not the items appearing in GUI?Is there a step other than executing the above code correctly that I am missing? Please help.


Solution

  • You are not committing the transaction. You declare:

    l_commit VARCHAR2(2) := FND_API.G_FALSE; 
    

    Which you then pass into the API. If you then query the tables using the same transaction, you will see the modified data. But the application forms are using another session.

    You need to add a commit at the end. As to whether to pass in G_TRUE, you need to read the API documentation.