Oracle R12 APPS Initialization

Oracle has a delivered API to initialize the applications context in standalone sessions that are not initialized directly via the application (SQL Editor). Every time you need to view secure data, you have to call the oracle initialization API – fnd_global.apps_initalize to see secured data.

An example would be querying AP_INVOICES (a synonym for the table AP_INVOICES_ALL) vs. querying AP_INVOICES_ALL.


select * from apps.AP_INVOICES;

select * from apps.AP_INVOICES_ALL;

The AP_INVOICES_ALL must have fetched data, however the AP_INVOICES synonym must have NOT fetched any data. This is because AP_INVOICES is not outside Oracle VPD security (database level security). After initializing using the script below, you will then be able to query AP_INVOICES synonym and see all data based on the security rules defined for the responsibility/user.

There are 4 parameters used to do the apps initialize:

User Id, Responsibility Id, Application Id, Security Group Id

The FND_GLOBAL.APPS_INITIALIZE can be called using the 4 parameters as shown below:


exec fnd_global.apps_initialize(1013415, 50559, 222, 0);

The below script will prompt for a User Name (from FND_USER) and display the APPS.INITIALIZE script with the defined parameters(user id, responsibility id, application id, business group id) to easily copy and execute to initialize the Oracle Applications.

SELECT resp.responsibility_name,
          'exec fnd_global.apps_initialize('
       || fu.user_id
       || ', '
       || resp.responsibility_id
       || ', '
       || furg.responsibility_application_id
       || ', '
       || furg.security_group_id
       || ');'
          text_apps_initialize,
       'exec mo_global.init(' || '''' || fa.application_short_name || ''');'
          mo_global_init
  FROM apps.fnd_user_resp_groups furg,
       fnd_application fa,
       apps.fnd_user fu,
       apps.fnd_responsibility_vl resp
 WHERE     furg.user_id = fu.user_id
       AND furg.responsibility_id = resp.responsibility_id
       AND fa.application_id = furg.responsibility_application_id       
       AND fu.user_name = '&User_Name';

Leave a comment