Search 800 + Posts

Oct 22, 2011

How to Set MOAC Context in R12i (MOAC - Enabled)


In this post I will explain how to set the context to use secured synonym in oracle R12i. Please make a note that in R12i Oracle has removed all the context-based views with Secured Synonym.
All the context-based views like
1. OE_ORDER_HEAREDS
2. OE_ORDER_LINES
3. PO_HEADERS
4. PO_LINES etc has been replaced with Synonym.
Now on if user want to set the context to get the data for particular operating unit they need to use the new apis to set the context
The new API to set the context in R12 is
MO_GLOBAL.Set_Policy_Context.

This API has 2 parameters
1. Operating unit
2. Context
Context has 2 values
1. M
2. S
When policy context is set to ‘M’, data from all accessible Operating Units will be returned.
When policy context is set to ‘S’, then only data from the specified Org_Id will be returned.
Example for R12 –



· Try to run
select * from oe_order_headers

· Set the Context
begin
MO_GLOBAL.Set_Policy_Context('S',204);
end;

· Run Again
· select * from oe_order_headers

But for R11i it is still the same
· Set Context
begin
dbms_application_info.set_client_info('204');
end;

· Run Query
· select * from oe_order_headers

No comments:

Post a Comment