Friday, June 27, 2014

FND_GLOBAL.APPS_INITIALIZE – Setting the Applications Context

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

FND_GLOBAL.APPS_INITIALIZE:

1
2
3
4
5
procedure 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.

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.

Arguments (input) 
  • 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.
Example:

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

How to get the Argument values?
1
2
3
4
5
6
7
8
9
10
11
        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 = '&user_name')
           AND responsibility_id = (SELECT responsibility_id
                                      FROM FND_RESPONSIBILITY_VL
                                     WHERE responsibility_name = '&resp_name');

An alternative way to retrieve these values is to log into the application and choose the appropriate Receivables responsibility.

Then navigate to any data entry form and use the Help > Diagnostics > Examine feature to get the values for:

Block                                                   Field

$PROFILE$RESP_ID                 Responsibility Id
$PROFILE$USER_ID                      User Id

Challa.

No comments:

Post a Comment