Sunday, August 16, 2015

Item Assignment in Oracle Apps R12

Item Assignment to another inventory organization

There are two ways to assign the master item for inventory child organization.

Through master item form directly assigning to child organization. In case if we have multiple child organizations then we have to chose through API.

Below is an example of how to assign an organizations by using Plsql APIs.

'PVMDL012','PVTTV012','PVRCF012','PVSER012','PVCE2012','PVSEC012','PVITM012' all this items are represented in master organization (i.e. 118 in below example) and now my business requirement to assign 667 (As below example) inventory organization.

Declare
l_mesg VARCHAR2(1000);
l_count number;
cursor c1 is SELECT segment1
from apps.mtl_system_items_b
where segment1 in ('PVMDL012'
,'PVTTV012'
,'PVRCF012'
,'PVSER012'
,'PVCE2012'
,'PVSEC012'
,'PVITM012'
)
and organization_id = 118;--118 is a master organization 
BEGIN
 fnd_global.apps_initialize (user_id           => 78847,
                               resp_id           => 60823,
                               resp_appl_id      => 401
                              );
for f1 in c1
loop
EGO_ITEM_PUB.Assign_Item_To_Org(
  p_api_version => 1.0
 ,p_Item_Number => f1.segment1
 ,p_Organization_Id => 669
 ,x_return_status => l_mesg
 ,x_msg_count => l_count);

Commit;

IF l_count =1 THEN
 dbms_output.put_line( 'Error in API is '|| l_mesg);
ELSIF l_count >1 THEN
 LOOP
l_count := l_count+1;
l_mesg := FND_MSG_PUB.Get(FND_MSG_PUB.G_NEXT,FND_API.G_FALSE);
if l_mesg is NULL Then
EXIT;
END IF;
dbms_output.put_line('Message' || l_count ||' ---'||l_mesg);
END LOOP;
END IF;
end loop;

END;


No comments:

Post a Comment