14 March 2013

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

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

Set org context in R12
The SQL command to set the ORG_ID prior to running a script is:
SQL> exec mo_global.init('AR');
exec mo_global.set_policy_context('S','&org_id');
Enter the org_id when prompted.

The procedure - mo_global.set_policy_context has two parameters
p_access_mode & p_org_id

p_access_mode
Description
S
In case you want your current session to work against SingleORG_ID
M
In case you want your current session to work against multiple ORG_IDs

          p_org_id: Only applicable if p_access_mode is passed value of "S"


If using Toad
Begin
mo_global.set_policy_context(‘S’, &org_id);
End;

Set org context in 11i:
The SQL command to set the ORG_ID prior to running a script is:
SQL> execute dbms_application_info.set_client_info(&org_id);
Enter the org_id when prompted.


If using Toad

Begin
fnd_client_info.set_org_context(&org_id);
End;


Multiple Organizations Partitioned Objects

Tables that contain Multiple Organizations data can be identified by the suffix "_ALL" in the table name. These tables include a column called ORG_ID, which partitions Multiple Organizations data by organization.

Every Multiple Organizations table has a corresponding view that partitions the table's data by operating unit. Multiple Organizations views partition data by including a DECODE on the internal variable CLIENT_INFO. This variable is set by the security system to the operating unit designated for the responsibility. It operates is a similar way to the LANGUAGE variable, which returns the language of the current session.

Note: If accessing data from a Multiple Organizations partitioned object when CLIENT.INFO has not been set (for example, from SQL*Plus), you must use the _ALL table, not the view.

SO_HEADERS_ALL, with its corresponding view SO_HEADERS, is an example of a Multiple Organizations partitioned object.

No comments: