Sunday, October 22, 2017

How to set the Organization Context in R12?

1. To set org context to any specific single org:

BEGIN
   MO_GLOBAL.SET_POLICY_CONTEXT('S', <orgid>);
END;

2. 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_org_id number;
   l_resp_appl_id number;

BEGIN

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

   SELECT responsibility_id, application_id
     INTO l_resp_id
     FROM FND_RESPONSIBILITY_TL a    
    WHERE responsibility_name LIKE '&responsibility_name'
      AND language = USERENV('LANG');

  mo_global.init ('AR');
   fnd_global.apps_initialize ( l_user_id
                                              , l_resp_id
                                              , l_resp_appl_id) ; -- pass in user_id,  responsibility_id and application_id
   mo_global.set_policy_context ('S', l_org_id);

END;
/

No comments:

Post a Comment

SupplierAddressImportTemplate.xlsm South Africa Suburb Field mapping in POZ_SUPPLIER_ADDRESSES_INT

Suburb mpping in Supplier Address Import Template will be mapped to Address Element Attribute2 (HZ_LOCATIONS. ADDR_ELEMENT_ATTRIBUTE2)