Setting Applications Context

http://www.thotasuman.com/

When running the queries against multi-org views from your sql developer or some sql sessions you need to set the Apps Context so that the rows are retrieved.

Example: ap_invoices_all is a table, ap_invoices is a view. Running a query such as below will not result in any rows if apps context is not set prior to running the query.

sql>select * from ap_invoices;
No rows returned

For 11i
-----------
You can set the context using fnd_global.apps_initialize(user_id, resp_id, application_id);
  or
dbms_application_info.set_client_info(org_id);
user_id -> From fnd_user table
resp_id -> From fnd_responsibility, fnd_responsibility_tl tables
application_id -> From fnd_application table
org_id -> org id or the operating unit id

For R12
------------
We can use the mo global apis here:
begin
mo_global.init('AR');
mo_global.set_policy_context('S',84);
end;

Here 'AR' is a valid application name where multi org access is enabled, you can give any relevant application name also. 'S' for single and 84 is the org id or the operating unit id

--Happy Context' ing
http://www.thotasuman.com/

No comments:

Post a Comment