Applications Context FND_GLOBAL.APPS_INITIALIZE

on Tuesday, July 9, 2013


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.

procedure APPS_INITIALIZE(user_id IN number,resp_id IN number,resp_appl_id IN number security_group_id IN number);
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.

Usage: fnd_global.APPS_INITIALIZE (1010,20417,201)

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

1 comment:

Chris said...

Good post. You can also use this query to look up the values to use in the apps_initialize API:

SELECT
USER_ID,
RESPONSIBILITY_ID,
RESPONSIBILITY_APPLICATION_ID,
SECURITY_GROUP_ID
FROM
FND_USER_RESP_GROUPS
WHERE
USER_ID = (
SELECT
USER_ID
FROM
FND_USER
WHERE
USER_NAME = UPPER('&user_name')
)
AND RESPONSIBILITY_ID = (
SELECT
RESPONSIBILITY_ID
FROM
FND_RESPONSIBILITY_VL
WHERE
RESPONSIBILITY_NAME = '&resp_name'
)
;