Friday, June 15, 2007

How to Setting your Oracle Applications session: fnd_global.apps_initialize (org_id)

If we are working with Oracle Applications, here how we can initialize our session in whichever tool we are using to take off the login process and pick up profile option values.

The key profile option is usually org_id (organization id in Multi-Org Environment) so we can select from organization aware views, but it applied equally to other profile options,

For Example.

We can then use FND_PROFILE.VALUE('PROFILE_OPTION_NAME') to get values from profile options.
We need to be logged into the database as the APPS user. The examples set up the session for SYSADMIN user, System Administrator responsibility.
E.g. SQL*Plus

Exec fnd_global.apps_initialize(0,20420,1);


E.g. for PL/SQL, TOAD, SQLDeveloper, SQL Navigator etc.:

Begin fnd_global.apps_initialize(0,20420,1); end;


The parameters used
in above example are:

1. User_ID

SELECT user_id, user_name, description FROM applsys.fnd_user

2. Responsibility_ID

SELECT application_id, responsibility_id, LANGUAGE, responsibility_name, created_by, creation_date, last_updated_by, last_update_date, last_update_login, description, source_lang, security_group_id FROM applsys.fnd_responsibility_tl

3. Responsibility_Application_ID

SELECT application_id, responsibility_id, LANGUAGE, responsibility_name, created_by, creation_date, last_updated_by, last_update_date, last_update_login, description, source_lang, security_group_id FROM applsys.fnd_responsibility_tl

To get these we have a couple of choices

1. SQL - Replace SYSADMIN and System Administrator with your user and responsibility:

2. In Oracle Applications forms session. Login as your user and navigate to the required responsibility.
Open a function that uses Oracle forms. Go to Help > Diagnostics > Examine. In the Block enter $PROFILES$. In the field enter the appropriate field name for the parameter:

User_ID = USER_ID

Responsibility_ID = RESP_ID

Responsibility_Application_ID = RESP_APPL_ID