Friday, 14 May 2010

How To Set the Applications Context FND_GLOBAL.APPS_INITIALIZE

Use the API FND_GLOBAL.APPS_INITIALIZE to set the applications context in standalone sessions that were not initialized through normal means. Typically, you would use this API in external custom programs that are establishing their own connections.

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.

Example
fnd_global.APPS_INITIALIZE (1010,20417,201);

Parameters
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 also use sql like the following to get the values from sqlplus (as apps):

select application_id, Responsibility_id, responsibility_name
from fnd_responsibility_vl
where responsibility_name like 'Sys%';
- change Terr to identify your responsibility.

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

OR:

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.

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. 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.

begin
fnd_global.APPS_INITIALIZE(200131258,20004,51710);
end;

SELECT fnd_profile.value (‘RESP_ID’) FROM dual
SELECT fnd_profile.value (‘USER_ID’) FROM dual
SELECT fnd_profile.value (‘APPLICATION_ID’) FROM dual
SELECT TO_NUMBER (FND_PROFILE.VALUE( ‘LOGIN_ID ‘)) FROM dual
SELECT FND_PROFILE.VALUE(‘ORG_ID’) FROM dual
SELECT FND_PROFILE.VALUE(‘SO_ORGANIZATION_ID’) FROM dual
SELECT FND_PROFILE.VALUE(‘USERNAME’) FROM dual
SELECT FND_PROFILE.VALUE(‘GL_SET_OF_BKS_ID’) FROM dual

Related Posts by Categories



No comments: