Thursday 10 June 2010

How To Set the Applications Context - FND_GLOBAL.APPS_INITIALIZE

In Release 12, the architecture of multi-org and the way in which data is partitioned by operating unit has changed significantly. As a result the ways in which data are stored and accessed has changed.

To set the Application Context value, call procedure
FND_GLOBAL.APPS_INITIALIZE(user_id in number,resp_id in number, resp_appl_id in number security_group_id in number);

This procedure sets up global variables and profile values in a database session. Call this procedure to initialize the global security context for a database session. You can use it for routines such as PL/SQL or other programs that are not integrated with either the Oracle Applications concurrent processing facility or Oracle Forms (both of which already do a similar initialization for a database session). The typical use for this routine would be as part of the logic for launching a separate non–Forms session from an established Oracle Applications form session. You can also use this procedure to set up a database session for manually testing application code using SQL*Plus. This routine should only be used when the session must be established outside of a normal form or concurrent program connection.

EXEC FND_GLOBAL.APPS_INITIALIZE(p_user_id, p_resp_id, p_resp_appl_id);

To get the values of
p_user_id,
p_resp_id
p_resp_appl_id
use the following sql from sqlplus as apps user:

select application_id, Responsibility_id, responsibility_name
from fnd_responsibility_vl
where responsibility_name like 'your_reponsibility_name'

select user_id, user_name
from fnd_user
where user_name = 'your_user_name'

For example:
exec fnd_global.APPS_INITIALIZE (1271,50243,222);

OR:

You can obtain valid values to use with this procedure by using profile option routines to retrieve these values in an existing Oracle Applications form session. 

USER_ID - The User ID number.
RESP_ID - The ID number of the responsibility.
RESP_APPL_ID - The ID number of the application to which the responsibility belongs. 
SECURITY_GROUP_ID - The ID number of the security group. This argument is automatically defaulted by the API. The caller should not pass a value for it. 

You can obtain the values for the input parameters from within Oracle Applications.

To do this:
1. From the top menu, navigate to Help->Examine
2. You will be asked to enter an ORACLE password. Enter the password for the APPS database user.
3. Click on the LOV for Block, and select block $PROFILES$
4. Click on the Field LOV, and select field USER_ID
5. Make a note of the value returned in the Value field.
6. Click on theField LOV again, and select field RESP_ID
7. Make a note of the value returned in the Value field.

Use these values for the USER_ID nad RESP_ID parameters. You can get the application Id from the Diagnostic Apps Check report.

Products must call the MO_GLOBAL.init() API to execute the multiple organizations initialization.

Multiple organizations initialization performs the following:

1.Initializes the security policy predicate
2.Populates a global temporary table that is used in the user interfaces and the security policy function.
The FND_GLOBAL.APPS_INITIALIZE routine does NOT automatically call mo_global.init routine.
You must explicitly invoke the mo_global.init routine to initialize the organization context.

EXEC mo_global.init (p_appl_short_name);

Related Posts by Categories



2 comments:

Raúl Jaimes said...

hi Ajikumar!!

question: if i want execute fnd_global.APPS_INITIALIZE with a different user than APPS in r12??

i found this note in Metalink(Oracle Support) ID 822225.1 but it didn't work. Send me insufficient privileges when i execute fnd_global.apps_initialize ( 3990,50658,200,0). I tried add the missing procedures and packages.

Any suggestion??

Thanks, !!

Unknown said...

How to return data from oracle form depending on global.fnd_user