Monday, 16 July 2012

How to view org-specific data in a Multi-Org environment

Background:
This article explaing how to access org-specific data from Sqlplus in Multi-Org (MOAC) environment

Solution:
You have to run the following:

begin
 fnd_global.apps_initialize(&user_id,&responsibility_id,&responsibility_application_id);
 mo_global.init('&product_short_name');
end;

To find the user_id and responsibility_id:
select user_id 
  from fnd_user 
 where user_name = <username>;

select responsibility_id 
  from fnd_responsibility_tl
 where responsibility_name = <responsibility_name>;

Example:

select user_id
  from fnd_user
 where user_name = 'USER1';
-- returns 12345 (say)

select responsibility_id
  from fnd_responsibility_tl
 where responsibility_name = 'Receivables Manager';
-- returns 20678

begin
 fnd_global.apps_initialize(12345, 20678, 222);
 mo_global.init('AR');
end;

After the above, if the user USER1 has access to the responsibility 'Receivables Manager'  org specific data can be viewed from sqlplus.


Note:
Alternatively, you can set the Org Context.
Provide operating_unit_id for the following.
exec apps.fnd_client_info.set_org_context ('&org_id');

No comments:

Post a Comment