Pages

OracleEBSpro is purely for knowledge sharing and learning purpose, with the main focus on Oracle E-Business Suite Product and other related Oracle Technologies.

I'm NOT responsible for any damages in whatever form caused by the usage of the content of this blog.

I share my Oracle knowledge through this blog. All my posts in this blog are based on my experience, reading oracle websites, books, forums and other blogs. I invite people to read and suggest ways to improve this blog.


Thursday, August 25, 2016

How to set org context in Oracle apps R12 and 11i?

In 11i:

Begin
dbms_application_info.set_client_info('&ORG_ID');
End;




In R12:

BEGIN
   MO_GLOBAL.SET_POLICY_CONTEXT('S', <orgid>);
END; 
To set the mo security profile so that sqlplus will have same org context as given responsibility 
DECLARE
   l_resp_id number;
   l_user_id number;
   l_security_profile_id number;
   l_org_id number;

BEGIN

   SELECT user_id
     INTO l_user_id
     FROM fnd_user
    WHERE user_name LIKE '&USER_NAME';

   SELECT responsibility_id
     INTO l_resp_id
     FROM FND_RESPONSIBILITY_VL
    WHERE responsibility_name LIKE '&responsibility_name';

   FND_GLOBAL.APPS_INITIALIZE(l_user_id,
                              l_resp_id,
                              <Application ID>); -- APPLICATION_ID: Oracle Payables is 200
   MO_GLOBAL.INIT('SQLAP');
END;
/
In SQL*plus

SQL> exec mo_global.init('SQLAP');
exec mo_global.set_policy_context('S','&org_id');

select count(1)

from ECE_POO_LINES_V; --43721

2 comments: