You are on page 1of 59

4/25/13

PowerView is Off Dashboard Knowledge Service Requests Patches & Updates

Document 420787.1
Nori Ramalingeswara Search Knowledge Base (0) Contact Us Help

Advanced

Oracle Applications Multiple Organizations Access Control for Custom Code [ID 420787.1]
Modified: Apr 19, 2013 Type: WHITE PAPER Status: PUBLISHED Priority: 3 Comments (0)

To Bottom

White Paper Oracle Applications Multiple Organizations Access Control for Custom Code
Checked for relevance on 12-JAN-2011 See Change Record This document discusses how to update the customization code that is affected by the access control feature in Oracle Applications Multiple Organizations. This document is provided to customers as a reference to analyze and update customization code that is affected by the multiple organizations access control feature. Oracle does not guarantee that customization code may work or is responsible for any issues in the code after you follow the guidelines described in this document as various techniques are used in customization code.

TOC/Navigation Title
This white paper contains the following information. 1. 2. 3. 4. Introduction Technical Details Public APIs Change Record

Introduction
Multiple Organizations architecture (Multi-Org) includes a new feature Multiple Organizations Access Control (MOAC) in Release 12. The Access Control feature is backward compatible, which means that there are no code or procedural changes if MOAC is not implemented (i.e. The user is assigned one operating unit for a responsibility). . This document assumes that the reader is familiar with Oracle Applications Multiple Organizations architecture. Please contact Oracle Consulting if you need help in upgrading to custom code.

Overview of Multiple Organizations Architecture (prior to Release 12)


The primary objective of multiple organizations architecture, introduced in Oracle Applications Release 10.6, is to secure data from unauthorized access by individuals belonging to different operating units in an enterprise. A new or fresh installation of an Oracle Applications instance does not automatically enable multiple organizations. The system administrator creates operating units using the Define Organizations window in Oracle Human Resources Management System (HRMS), and runs the Convert to Multiple Organization program from AD Administrator to enable the multiple organizations feature. Typically, the system administrator defines "MO: Operating Unit" profile at Responsibility and/or User level. The "organization_id" of the "MO: Operating Unit" profile option value filters the transactional data. The CLIENT_INFO application context space stores the multiple organizations context value. Multi-Org views use the following WHERE clause to filter application records:
' o r g _ i d=s u b s t r b ( u s e r e n v ( ' ' C L I E N T _ I N F O ' ' ) , 1 , 1 0 ) '

Overview of Multiple Organizations Access Control Architecture (Release 12)


The Access Control feature in Release 12 allows the user to enter or query records in one or more operating units without changing application responsibility. It is the system administrators discretion to either implement the feature or use the same multiple organizations profile option setting available before Release 12 by using the single operating unit mode (i.e. one operating unit for a responsibility). In Release 12, the multiple organizations context value is no longer initialized by the FND_GLOBAL.APPS_INITIALIZE routine thereby reducing unnecessary context setting and resource consumption for applications that do not use operating unit context for data security. To use the single operating unit mode, you must set the value for the "Initialization SQL Statement Custom profile" to "mo_global.init('S',null);". This initializes the operating unit context based on the "MO: Operating Unit" profile option and the "MO: Security Profile" profile option must not be set. Fresh install of Release 12 Application is enabled with multiple organizations, however, the system administrator must create operating units to use multi organizations sensitive application products. The user can create new operating units in the Accounting Setup Manager page in addition to HRMSs Define Organizations page.

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

1/59

4/25/13

Document 420787.1

The following section provides guidelines to enable the multiple organizations access control feature to your custom code.

Guidelines for Forms Based Applications


Operating Unit Field in Forms Users can query or update multiple organizations-striped data by selecting the operating unit. The Operating Unit field list of values (LOV) displays the operating units of the organization that the user's application responsibility can access. General Recommendations Display the Operating Unit field on the top left corner of the form as the first navigatable field. The LOV window size of the Operating Unit should measure 3 inches x 3 inches. If the user can access one operating unit only, then the operating unit field displays the default value and its dependent attributes User can enter non-multiple organizations stripped data before specifying the operating unit for a record. The operating unit specific data can be entered only after user sets the operating unit context. The position of the Operating Unit field on the window depends on the window type. Child windows must display the Operating Unit name in the title bar on saving the parent record. The following screenshot shows the operating unit in a forms window (Payables - Distribution Sets window):

Default Operating Unit The user can define a default operating unit. A new profile option, MO: Default Operating Unit, is available to define the defaulting operating unit, which can be set at the Responsibility and User levels. The default operating unit is visible in the Operating Unit field when the form is opened.The user, however, must have access to the default operating unit in his security profile definition. The user can overwrite the default value with another operating unit which the user can access. If the user updates the operating unit, all operating unit sensitive data should be cleared. Alternatively, the entire record can be cleared which is more cost effective in development. If a user can access only one operating unit, then the operating unit defaults in the operating unit field. This eliminates the task of explicitly defining the default operating unit when the user accesses only a single operating unit.

Guidelines for Oracle Applications (OA) Framework Pages Based Applications


The Operating unit field is visible on OA Framework or JTT based user interfaces, similar to the Oracle Forms user interface. Operating Unit Field in OA Pages The Operating Unit field is available as the first field in the page. If the operating unit is the control field for a particular page, for example create or search page, selecting the operating unit form the Operating Unit field list of values displays the same or different fields and restricts the valid list of values in other related fields. Fields that depend on the operating unit, are visible after selecting the operating unit or if the profile option defaults the operating unit. The user cannot update the operating unit value once the user saves the record. In OA Framework pages, if the user saves the transaction using the feature Save for Later, then the user can still update the operating unit. Changing the operating unit before saving a record clears the operating unit specific fields. Alternately, the user can also clear the record instead of clearing the organization specific fields. The following screenshot shows the operating unit in a OA Framework pages (Oracle Purchasing - Create Blanket Purchase Agreement page):

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

2/59

4/25/13

The following screenshot shows the operating unit in a OA Framework pages (Oracle Purchasing - Create Blanket Purchase Agreement page):

Document 420787.1

Default Operating Unit Similar to forms, the OA Framework pages allows users to default an operating unit using the profile option: "MO: Default Operating Unit", which is set at the Responsibility and User levels. The user must specify a valid operating unit, which is available in the users security profile. This feature is useful when the user needs to transact in multiple Operating Units, but usually transacts in one Operating Unit. If a user can access only one operating unit in the users security profile, then the single operating unit defaults in the operating unit field. This eliminates the task of explicitly defining the default operating unit when the user accesses only a single Operating Unit . If the user can access multiple operating units, then the user can override the default Operating Unit profile option. The Operating Unit dependent default values are cleared when the user overrides the operating unit to ensure data consistency. However, when overwriting, the operating unit reverts to the default when subsequently entering the data .

Concurrent Programs/Reporting
Single Org Reports A new field "Operating Unit Mode" is added in the Define Concurrent Programs in the OA Framework pages. The user can query the program or report based on an operating unit by updating the "Operating Unit Mode" field with one of the following values: Single Multiple Empty The default value is Empty. The multiple organizations context is automatically initialized by the concurrent program if the "Operating Unit Mode" is set to either single or multiple. The user can also select a value from the operating unit field's list of values when the mode is single. The value of the "Operating Unit Mode" must be Single for a majority of the existing operating unit context sensitive reports. There is no need to change the code for single org reports. Note: The Operating Unit Mode field is added to the Define Concurrent Program in OA Framework pages only.

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

3/59

4/25/13

Document 420787.1

The following screenshot illustrates the Operating Unit field enabled in the Submit Request window.

Technical Details
This section provides information for developers for implementing the multiple organizations access control feature. Access Control Architecture describes the Virtual Private Database technology and the components for the multiple organizations access control foundation. Multiple Organizations Views/Tables Changes provides guidelines to change the multiple organization views. Enhancements to Forms provides guidelines to display the Operating Unit field and Operating Unit field validations. Enhancements to Reports provides guidelines to modify reports. Enhancements to Concurrent Programs provides guidelines to modify concurrent programs. Enhancements to Public APIs provides guidelines to modify Public APIs.

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

4/59

4/25/13
Enhancements Enhancements Enhancements Enhancements to to to to

Document 420787.1
Public APIs provides guidelines to modify Public APIs. Workflows provides guidelines for modifying Workflows. OA Framework Pages provides guidelines to modify OA Framework pages. JTT Pages provides guidelines to modify JTT pages.

Access Control Architecture


Background Multiple organizations architecture (Multi-Org) was introduced in Release 10.6 to secure the data by operating unit. In Release 10.7, Oracle added a column ORG_ID to each base table to partition the data by operating units. The partitioned tables are renamed with the suffix, '_ALL', and their corresponding secured views are created in Applications (APPS) schema. The following diagram shows a single organization view in the APPS schema.

Figure 1: Database Schema Multiple organizations views restrict access by filtering records for an operating unit assigned to the application responsibility set for the "MO: Operating Unit" profile option. This profile option value is cached in application context, and is initialized when calling the FND initialization routine. The FND CLIENT_INFO predicate includes all multiple organizations views and SQL statements that require multiple organizations security. The FND_CLIENT_INFO function retrieves the ORG_ID value stored in the application context. This value is valid for a session, unless explicitly changed by the calling procedure. Use the _ALL table in the SQL statement to retrieve information irrespective of the operating unit. To increase the flexibility and performance in a multiple organizations environment and provide the same level of data security, the DBMS Virtual Private Database (VPD) feature replaces the CLIENT_INFO function. Virtual Private Database (VPD) The Virtual Private Database (VPD) feature allows developers to enforce security by attaching a security policy to database objects such as tables, views and synonyms. It attaches a predicate function to every SQL statement to the objects by applying security policies. When a user directly or indirectly accesses the secure objects, the database rewrites the user's SQL statement to include conditions set by security policy that are visible to the user.

Figure 2: Database Schema - Access to one operating unit

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

5/59

4/25/13

Document 420787.1

Figure 3: Database Schema - Access to multiple operating units You can rewrite reference views that join data from multiple single organization views with the security policy attached to one secured synonym and the remaining reference to _ALL tables instead of single organization views. This improves performance because the policy is used once for the reference views that join data from multiple single organization views. Multiple Organizations Security Policy Predicate Synonyms replace single organization views that contain the CLIENT_INFO predicate attached to them. When installing, you must attach a security policy function to the multiple organizations synonyms. This indicates that the security is in place irrespective of the tools used to access the data. The security policy function returns different predicate based on the number of accessible operating units. An application context attribute ACCESS_MODE is set based on the accessible operating units. Context sensitive security policy is used for multiple organizations access control to minimize the coding impact. The multiple organizations code in previous releases works in the context of only one operating unit. It was not anticipated that multiple organizations access would be supported. A solution to code impact is to change the policy predicate whenever needed. For example, when you open a form using a responsibility that can access multiple operating units and when you select an operating unit, the operating unit context is established and you do not need to modify the code that is used for validation from that point onwards, if the synonyms return data for the selected operating unit. If the access mode is M (Multiple), then the policy predicate issues an EXISTS sub-query to a global temporary table. The global temporary table is a new feature in Oracle 8i. The table stores and manipulates data specific to a SESSION or TRANSACTION. If the access_mode is S (Single), then a simple equality predicate is used for performance reasons, since it is cost effective in comparison to the temporary table. An access mode A (All) is incorporated to bypass the security for functionality that needs full table access. If the access mode is not set or is NULL, then a simple predicate that uses the CLIENT_INFO value for ORG_ID is used for the policy predicate to support backward compatibility. MO_GLOBAL.Org_Security function:
F U N C T I O No r g _ s e c u r i t y ( o b j _ s c h e m aV A R C H A R 2 o b j _ n a m eV A R C H A R 2 ) R E T U R NV A R C H A R 2 I S B E G I N -R e t u r n sd i f f e r e n tp r e d i c a t e sb a s e do nt h ea c c e s s _ m o d e -T h ec o d e sf o ra c c e s s _ m o d ea r e -M-M u l t i p l eO UA c c e s s -A-A l lO UA c c e s s -S-S i n g l eO UA c c e s s -N u l l-B a c k w a r dC o m p a t i b i l i t y-C L I E N T _ I N F Oc a s e I Fg _ a c c e s s _ m o d eI SN O TN U L LT H E N I Fg _ a c c e s s _ m o d e=' M 'T H E N R E T U R N' E X I S T S( S E L E C T1 F R O Mm o _ g l o b _ o r g _ a c c e s s _ t m po a W H E R Eo a . o r g a n i z a t i o n _ i d=o r g _ i d ) ' ; E L S I Fg _ a c c e s s _ m o d e=' A 'T H E N-f o rf u t u r eu s e R E T U R NN U L L ; E L S I Fg _ a c c e s s _ m o d e=' S 'T H E N R E T U R N' o r g _ i d=s y s _ c o n t e x t ( ' ' m u l t i _ o r g 2 ' ' , ' ' c u r r e n t _ o r g _ i d ' ' ) ' ; E N DI F ; E L S E R E T U R N' o r g _ i d=s u b s t r b ( u s e r e n v ( ' ' C L I E N T _ I N F O ' ' ) , 1 , 1 0 ) ' ; E N DI F ; E N Do r g _ s e c u r i t y ;

The simple predicate using CLIENT_INFO is used for the following case: Access control is not enabled for older releases of the applications, it is not backward compatible: You cannot enable the multiple organizations access control feature for all products simultaneously because multiple organizations views are shared between products at different levels. For example, if you choose to upgrade Payables but choose to keep an earlier version of Purchasing then Payables is access control enabled, but Purchasing is not. Therefore, Purchasing must replace the views it shares with Payables, such as PO_VENDOR_SITES, and PO_HEADERS, with secured synonyms. The secured synonyms must work as before for Purchasing, since you have not upgraded Purchasing and Purchasing still relies on CLIENT_INFO. The simple predicate using current_org_id is used for the following cases: Access control is limited to only one operating unit: In this case, the access mode is 'S'. An example is when a user can access to only one operating unit through the MO: Security Profile or the MO: Security Profile is not set and the user access depends on MO: Operating Unit. Access control is enabled with access to multiple operating units: The security profile provides access to multiple operating units, but in the scope of a transaction since the operating unit is controlled, a simple predicate eliminates additional changes to the server and client side code. The complex predicate is used for these cases: Access is enabled and the security profile gives access to multiple Operating Units. The access mode is set to 'M' for this case. For example, any statement on RA_CUSTOMER_TRX (synonym to which the security policy is attached) is dynamically modified to use the policy predicate. A simple query by the user:
S E L E C Tt r x _ n u m b e rf r o mr a _ c u s t o m e r _ t r x

is modified at runtime if the responsibility can access multiple operating units to:

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

6/59

4/25/13

is modified at runtime if the responsibility can access multiple operating units to:
S E L E C Tt r x _ n u m b e rf r o mr a _ c u s t o m e r _ t r x W H E R E( E X I S T S( S E L E C T1 F R O Mm o _ g l o b _ o r g _ a c c e s s _ t m po a W H E R Eo a . o r g a n i z a t i o n _ i d=o r g _ i d ) )

Document 420787.1

or is modified at runtime if the users access responsibility can access one Operating Unit with access control enabled for the module to:
S E L E C Tt r x _ n u m b e rf r o mr a _ c u s t o m e r _ t r x O R G _ I D=s y s _ c o n t e x t ( ' m u l t i _ o r g 2 ' , ' c u r r e n t _ o r g _ i d ' )

Multiple Organizations Initialization The profile options MO: Security Profile or MO: Operating Unit populate the multiple organizations global temporary table. The profile option MO: Security Profile takes precedence over MO: Operating Unit. You can combine the following under one application menu: Products at different levels Products that are access control enabled Products that are not access control enabled (i.e. in transition) In such cases, initializing the multiple organizations depends on the application of the calling module and not the application tied to the responsibility, since the profile Option MO: Security Profile must be ignored for products that are not access control enabled or are in the transition phase. A new table (FND_MO_PRODUCT_INIT) is introduced which contains a value Y for products that are enabled with the multiple organizations access control feature. The multiple organizations initialization API uses the module owner to initialize the temporary table depending on the value for the product in the FND_MO_PRODUCT_INIT table. Application_Short_Name AR JTF <Custom application short code> Status Y Y Y or N

Legend: Y indicates multiple organizations access control is enabled, N indicates otherwise. Use the shared services API to register products that are enabled with access control. For example to enable or remove access control for Payables (SQLAP), enter the following code:
T oe n a b l ea c c e s s : F N D _ M O _ P R O D U C T _ I N I T _ P K G . r e g i s t e r _ a p p l i c a t i o n ( ' S Q L A P ' , ' S E E D ' , ' Y ' ) ; T od e l e t ey o u ra p p l i c a t i o ne n t r y : F N D _ M O _ P R O D U C T _ I N I T _ P K G . r e m o v e _ a p p l i c a t i o n ( ' S Q L A P ' ) ;

The Payables system administrator must then seed a row in the Multiple Organizations table to indicate that Payables is enabled with access control. Note: Multiple Organizations API FND_MO_PRODUCT_INIT_PKG.register_application is available to register this information in the Multiple Organizations table. See Multiple Organizations Public APIs for details regarding this API.

Products must call the MO_GLOBAL.init() API to execute the multiple organizations initialization. Multiple organizations initialization performs the following: 1. Initializes the security policy predicate 2. Populates a global temporary table that is used in the user interfaces and the security policy function. Attention: Do not access the global temporary table directly. Instead, use the PL/SQL functions to access data from the temporary table. The FND_GLOBAL.APPS_INITIALIZE routine does NOT automatically call mo_global.init routine. You must explicitly invoke the mo_global.init routine to initialize the organization context.

Data Model Design New Tables MO_GLOB_ORG_ACCESS_TMP This table is a session-specific global temporary table that stores the operating units available in the current responsibility's (or site's) MO: Security Profile profile option. If you do not define the profile option, MO: Security Profile, then the operating unit available in the current responsibility's (or site's) MO: Operating Unit profile option is stored in the table. The tables/views PER_ORGANIZATION_LIST and HR_OPERATING_UNITS populate the records of this table. Use this table to initialize multiple organizations security policy.

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

Column Name

Type

Null

Unique

Column Description

Translatable

7/59

4/25/13
Column Name ORGANIZATION_ID NAME Type Number(15) Varchar2(240) Null Not Null Null Unique Yes

Document 420787.1
Column Description Operating unit identifier Name of the operating unit Translatable No Yes

A unique index MO_GLOB_ORG_ACCESS_TMP_U1 exists on ORGANIZATION_ID column. Note: The operating unit is stored in the language set at client environment or server environment. The legal entity information is no longer stored in the Multiple Organizations temporary table. The org_classification column is not added to the temporary table as the temporary table contains only operating units.

FND_MO_PRODUCT_INIT This table stores information about a product that implements multiple organizations access control. An entry in this table indicates that the product implements access control and the multiple organizations initialization code uses MO: Security Profile and not MO: Operating Unit. Column Name APPLICATION_SHORT_NAME CREATION_DATE CREATED_BY LAST_UPDATED_BY LAST_UPDATE_DATE LAST_UPDATE_LOGIN Type Varchar2(50) Date Number(15) Number(15) Date Number(15) Null Not Null Not Null Not Null Not Null Not Null Unique Yes Column Description Application Short Name Creation Date Created By Last Updated By Last Update Date Last Update Login Translatable No No No No No No

A unique index FND_MO_PRODUCT_INIT_U1 exists on APPLICATION_SHORT_NAME column. Note: The APPLICATION_ID column is not used in this table, since ID column values are not portable.

Multiple Organizations Public APIs The multiple organizations public APIs are described at the end of this document. BC4J Objects The following BC4J components are available for uptaking multiple organizations access control in OA Framework pages. Operating Unit LOV View Object The operating unit list of values uses this View Object (VO). Generate Java Class for View Object False Generate Java Class for View Generate Row Accessors True True

Package

Application Module

Generate Java Files for View Object AM Instances OperatingUnitsVO

View Object Query select ou.organization_id org_id, ou.name operating_unit, FROM hr_operating_units ou, WHERE mo_global.check_access(ou.organization_id) = 'Y'

oracle.apps.fnd.multiorg.lov.server OperatingUnitLovAM False

O p e r a t i n g U n i t s R N O p e r a t i n g U n i t s T a b l e O U N a m e O r g a n i z a t i o n I d

OperatingUnitsRN Region

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

8/59

4/25/13
ID Style AM Definition

Document 420787.1

OperatingUnitsRN ListOfValues oracle.apps.fnd.multiorg.lov.server.OperatingUnitLovAM OperatingUnitsTable Region Style

ID

OperatingUnitsTable Table OUName Search Allowed View Instance OperatingUnitsVO1 View Attribute OperatingUnit

ID

Item Style

Attribute Set

OUName messageStyledText /oracle/apps/fnd/attributesets/HrOperatingUnits/OperatingUnitName_Persistent True

OrganizationId ID OrganizationId Item Style formValue Data Type Number View Instance OperatingUnitsVO1 View Attribute OrgId

AttributeSets There are two new attribute sets available for uptaking multiple organizations access control in OA Framework pages: OperatingUnitName_Transient Use this attribute set for transient items of the operating units, such as list of values or search criteria. OperatingUnitName_Persistent Use this attribute set for persistent items of the operating units such as displaying the fields in the search results region or displaying the columns in the list of values. OperatingUnitName_Transient Property Prompt Columns Comment Data type Document Name Property Description Text label for the component Item display length Describes attribute set usage Data type Property Name Value Operating unit 30 Operating unit name for transient items VARCHAR2 OperatingUnitName_Transient 240

Maximum Length Maximum number of characters allowed in the item value

Some transient items of the operating unit are mandatory, for example, items in the list of values and some are optional, which include items in the search value. Oracle recommends that you specify the transient items as 'Required' depending on the item's usage. Providing two attribute sets, one for the required items and another for the optional items, nullifies the purpose of attribute sets. OperatingUnitName_Persistent Property Prompt Columns Comment Document Name Property Description Text label for the component Item display length Describes attribute set usage Property Name Value Operating unit 30 Operating unit name for persistent items OperatingUnitName_Persistent

The attributesets are available in this file and location: File Name: HrOperatingUnits.xml File Location: /oracle/apps/fnd/attributesets/

Multiple Organizations Views/Tables Changes


You must carefully review the multiple organizations views/tables and implement the following changes. NOT NULL Logical Constraint on ORG_ID column Multiple organizations architecture is mandatory in Release 12. Therefore, the ORG_ID column in the multiple organizations tables (_ALL, _ALL_TL and _ALL_B) must have a value. An exception to this rule is when you refer to the 'org_id' column for transaction purposes.

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

9/59

4/25/13

Document 420787.1

The application code must enforce 'NOT NULL' constraint logically in the business logic which minimizes the upgrade time. Enforcing NOT NULL constraint on large tables may take several hours. However, this is optional. Modify Your Database Views The multiple organizations access control feature uses a security policy attached to the multiple organizations synonyms to implement the security instead of the CLIENT_INFO predicate in the views. The multiple organizations views are divided into two categories: single organization views and reference views. Single Organization Views are views based on the _ALL, _ALL_B or ALL_TL multiple organizations tables and have the single organization predicate attached to them to return data for the current Operating Unit as specified by the CLIENT_INFO environment variable. The tables _ALL_B and _ALL_TL are introduced for MultiLingual Support (MLS). Reference Views are the views that are joined to single organization views. They do not have the single organization predicate attached to them. They may or may not have the ORG_ID column in their view definition. Single Organization Views Replace all single organization views by synonyms to _ALL tables and. attach the security policy function to the synonyms to enforce operating unit security. Attention: Do not attach the security policy to base tables directly because there is code around the base tables (_ALL, ALL_B, _ALL_TL) that must access the operating units.

Case 1: Single Organization view Example 1: The following is an example of the view definition of a single organization view: RA_BATCHES.
C R E A T EO RR E P L A C EV I E WR A _ B A T C H E SA S S E L E C T" B A T C H _ I D " , " L A S T _ U P D A T E _ D A T E " , " L A S T _ U P D A T E D _ B Y " , " C R E A T I O N _ D A T E " , . . . " O R G _ I D " , " P U R G E D _ C H I L D R E N _ F L A G " , " I S S U E _ D A T E " , " M A T U R I T Y _ D A T E " , " S P E C I A L _ I N S T R U C T I O N S " , " B A T C H _ P R O C E S S _ S T A T U S " , " S E L E C T I O N _ C R I T E R I A _ I D " F R O MR A _ B A T C H E S _ A L L W H E R E N V L ( O R G _ I D , N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' , N U L L , S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) )= N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' , N U L L , S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 )

A synonym replaces the single organization view RA_BATCHES.


C R E A T ES Y N O N Y MR A _ B A T C H E SF O RA R . R A _ B A T C H E S _ A L L

The following summarizes the changes for joining the single organization views to one _ALL table: Drop the single organization view Create a synonym with the same name as the obsolete single organization view Attach a policy function to the synonym Example 2: The following is an example of the view definition of a simple single organization view AR_VAT_TAX_B.
C R E A T EO RR E P L A C EV I E WA R _ V A T _ T A X _ BA S S E L E C T" V A T _ T A X _ I D " , " S E T _ O F _ B O O K S _ I D " , " T A X _ C O D E " , . . . " O R G _ I D " , . . . F R O MA R _ V A T _ T A X _ A L L _ B W H E R E N V L ( O R G _ I D , N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' , N U L L , S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) ) =N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' , N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 )

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

A synonym attached with the security policy replaces this single organization view AR_VAT_TAX_B.

10/59

4/25/13
C R E A T ES Y N O N Y MA R _ V A T _ T A X _ BF O RA R . A R _ V A T _ T A X _ A L L _ B

Document 420787.1

A synonym attached with the security policy replaces this single organization view AR_VAT_TAX_B.

Example 3: The following is an example of AP_CARD_SUPPLIERS. This view uses ROWID alias for the ROW_ID column of the underlying AP_CARD_SUPPLIERS_ALL table.
C R E A T EO RR E P L A C EV I E WA P _ C A R D _ S U P P L I E R SA S S E L E C TR O W I D , C A R D _ I D , V E N D O R _ I D , O R G _ I D , . . . F R O MA P _ C A R D _ S U P P L I E R S _ A L L W H E R EN V L ( O R G _ I D , N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L , S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1, 1 0 ) ) ) ,9 9 ) )= N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' , N U L L , S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 )

A synonym attached with the security policy replaces this single organization view AP_CARD_SUPPLIERS.
C R E A T ES Y N O N Y MA P _ C A R D _ S U P P L I E R SF O RA P . A P _ C A R D _ S U P P L I E R S _ A L L

On replacing the view with a synonym, the code depending on the ROWID column becomes INVALID since the synonym AP_CARD_SUPPLIERS does not have this column. You must fix the code for the incorrect columns. Example 4: The following is an example of the view definition of single organization view AR_PAYMENT_SCHEDULES_V. This is a special case, where the CLIENT_INFO predicate is coded in the view definition for performance reasons. You cannot merge this view definition because of its union clause. Therefore, you use the base tables of the views in the FROM clause, instead.
C R E A T EO RR E P L A C EV I E WA R _ P A Y M E N T _ S C H E D U L E S _ VA S S E L E C TP S . R O W I D , P S . P A Y M E N T _ S C H E D U L E _ I D , P S . T R X _ N U M B E R , . . . F R O Ma r _ l o o k u p sa l _ s t a t u s , a r _ c o l l e c t o r sa r _ c o l l , a r _ c o n s _ i n v _ a l lc o n s , r a _ c u s t _ t r x _ t y p e s _ a l lc t t , r a _ b a t c h _ s o u r c e s _ a l lb s , r a _ c u s t o m e r _ t r x _ a l lc t , h z _ c u s t _ s i t e _ u s e s _ a l ls u , h z _ c u s t _ a c c o u n t sc u s t _ a c c t , h z _ p a r t i e sp a r t y , a r _ p a y m e n t _ s c h e d u l e s _ a l lp s W H E R EP S . C U S T O M E R _ I D=C U S T _ A C C T . C U S T _ A C C O U N T _ I D A N DC U S T _ A C C T . P A R T Y _ I D=P A R T Y . P A R T Y _ I D A N DP S . C U S T O M E R _ S I T E _ U S E _ I D=S U . S I T E _ U S E _ I D A N DP S . C U S T O M E R _ T R X _ I D=C T . C U S T O M E R _ T R X _ I D A N DC T . B A T C H _ S O U R C E _ I D=B S . B A T C H _ S O U R C E _ I D A N DC T . C U S T _ T R X _ T Y P E _ I D=C T T . C U S T _ T R X _ T Y P E _ I D A N DP S . S T A T U S=A L _ S T A T U S . L O O K U P _ C O D E A N DA L _ S T A T U S . L O O K U P _ T Y P E=' I N V O I C E _ T R X _ S T A T U S ' A N DP S . C O L L E C T O R _ L A S T=A R _ C O L L . C O L L E C T O R _ I D( + ) A N DP S . C O N S _ I N V _ I D=C O N S . C O N S _ I N V _ I D( + ) A N D N V L ( C O N S . O R G _ I D , N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) )= N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) A N D N V L ( C T T . O R G _ I D , N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) )= N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) A N D N V L ( B S . O R G _ I D , N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) )= N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , -9 9 ) A N D N V L ( C T . O R G _ I D , N V L ( T O _ N U M B E R ( D E C O D E (S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) ) = N V L ( T O _ N U M B E R ( D E C O D E ( SU B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 ,1 0 ) ) ) , 9 9 ) A N D N V L ( S U . O R G _ I D , N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) )= N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) A N D

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

11/59

4/25/13

Document 420787.1

A N D N V L ( P S . O R G _ I D , N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) )= N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) A N DP S . S T A T U S=N V L ( A R P _ V I E W _ C O N S T A N T S . G E T _ S T A T U S , P S . S T A T U S ) U N I O NA L L S E L E C TP S . R O W I D , P S . P A Y M E N T _ S C H E D U L E _ I D , P S . T R X _ N U M B E R , . . . F R O M a r _ l o o k u p sa l _ r i s k _ r e c e i p t , a r _ c o n s _ i n v _ a l lc o n s , a r _ r e c e i p t _ m e t h o d sr m , a r _ b a t c h _ s o u r c e s _ a l lb s , a r _ b a t c h e s _ a l la r b 2 , a r _ c a s h _ r e c e i p t _ h i s t o r y _ a l lc r h , a r _ c a s h _ r e c e i p t _ h i s t o r y _ a l lc r h _ c u r r e n t , a r _ c a s h _ r e c e i p t s _ a l lc r , h z _ c u s t _ s i t e _ u s e s _ a l ls u , h z _ c u s t _ a c c o u n t sc u s t _ a c c t , h z _ p a r t i e sp a r t y , a r _ p a y m e n t _ s c h e d u l e s _ a l lp s , a r _ c a s h _ r e c e i p t _ h i s t o r y _ a l lc r h _ r e m i t , a r _ b a t c h e s _ a l la r b _ r e m i t , f n d _ c u r r e n c i e sf c W H E R EP S . C U S T O M E R _ I D=C U S T _ A C C T . C U S T _ A C C O U N T _ I D( + ) A N DC U S T _ A C C T . P A R T Y _ I D=P A R T Y . P A R T Y _ I D( + ) A N DP S . C U S T O M E R _ S I T E _ U S E _ I D=S U . S I T E _ U S E _ I D( + ) A N DP S . C A S H _ R E C E I P T _ I D=C R . C A S H _ R E C E I P T _ I D A N DC R . C A S H _ R E C E I P T _ I D=C R H . C A S H _ R E C E I P T _ I D A N DC R H . F I R S T _ P O S T E D _ R E C O R D _ F L A G=' Y ' A N DC R . R E C E I P T _ M E T H O D _ I D=R M . R E C E I P T _ M E T H O D _ I D A N DC R H . B A T C H _ I D=A R B 2 . B A T C H _ I D( + ) A N DA R B 2 . B A T C H _ S O U R C E _ I D=B S . B A T C H _ S O U R C E _ I D ( + ) A N DC R . C A S H _ R E C E I P T _ I D=C R H _ C U R R E N T . C A S H _ R E C E I P T _ I D A N DC R H _ C U R R E N T . C U R R E N T _ R E C O R D _ F L A G=' Y ' A N DP S . C O N S _ I N V _ I D=C O N S . C O N S _ I N V _ I D( + ) A N DC R . C A S H _ R E C E I P T _ I D=C R H _ R E M I T . C A S H _ R E C E I P T _ I D ( + ) A N DC R H _ R E M I T . S T A T U S ( + )=' R E M I T T E D ' A N DC R H _ R E M I T . B A T C H _ I D=A R B _ R E M I T . B A T C H _ I D ( + ) A N DF C . C U R R E N C Y _ C O D E=C R . C U R R E N C Y _ C O D E A N DA L _ R I S K _ R E C E I P T . L O O K U P _ T Y P E=' Y E S / N O ' A N DA L _ R I S K _ R E C E I P T . L O O K U P _ C O D EI N ( D E C O D E ( C R H _ C U R R E N T . S T A T U S , ' C L E A R E D ' , ' Y ' , ' N ' ) , D E C O D E ( N V L ( A R P _ V I E W _ C O N S T A N T S . G E T _ I N C L _ R E C E I P T S _ A T _ R I S K , ' N ' ) , ' Y ' ,' Y ' , N U L L)) A N DA R P _ V I E W _ C O N S T A N T S . G E T _ S A L E S _ O R D E RI SN U L L A N D N V L ( C O N S . O R G _ I D , N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) )= N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) A N D N V L ( B S . O R G _ I D , N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) )= N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) A N D N V L ( A R B 2 . O R G _ I D , N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) )= N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) A N D N V L ( C R H . O R G _ I D , N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) )= N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) A N D N V L ( C R H _ C U R R E N T . O R G _ I D , N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) )= N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) A N D N V L ( C R . O R G _ I D , N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L , S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) )= N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) A N D N V L ( S U . O R G _ I D , N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) )= N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 )

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

12/59

4/25/13

'' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) A N D N V L ( P S . O R G _ I D , N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L , S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) )= N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) A N D N V L ( C R H _ R E M I T . O R G _ I D , N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) )= N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L , S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) A N D N V L ( A R B _ R E M I T . O R G _ I D , N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) )= N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' ,N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) A N DP S . S T A T U S =N V L ( A R P _ V I E W _ C O N S T A N T S . G E T _ S T A T U S , P S . S T A T U S )

Document 420787.1

This single organization view AR_PAYMENT_SCHEDULES_V in addition to the CLIENT_INFO predicate includes an additional filter condition, which must remain as is. Therefore, you must rewrite this single organization view to a reference view following the guidelines in the subsequent section. You must remove the CLIENT_INFO predicate from the where clause, add the ORG_ID column to the view, and add the ORG_ID filter to tables in which the the ORG_ID is a composite key (as in setup tables that contain seed data replicated for every organization) because the ORG_ID is the driving key for the table (as in product system options tables) and the driving table for the view is replaced by the secured synonym (AR_PAYMENT_SCHEDULES):
C R E A T EO RR E P L A C EV I E WA R _ P A Y M E N T _ S C H E D U L E S _ VA S S E L E C TP S . R O W I D , P S . P A Y M E N T _ S C H E D U L E _ I D , P S . T R X _ N U M B E R , . . . P S . O R G _ I D F R O Ma r _ l o o k u p sa l _ s t a t u s , a r _ c o l l e c t o r sa r _ c o l l , a r _ c o n s _ i n v _ a l lc o n s , r a _ c u s t _ t r x _ t y p e s _ a l lc t t , r a _ b a t c h _ s o u r c e s _ a l lb s , r a _ c u s t o m e r _ t r x _ a l lc t , h z _ c u s t _ s i t e _ u s e s _ a l ls u , h z _ c u s t _ a c c o u n t sc u s t _ a c c t , h z _ p a r t i e sp a r t y , a r _ p a y m e n t _ s c h e d u l e sp s W H E R EP S . C U S T O M E R _ I D=C U S T _ A C C T . C U S T _ A C C O U N T _ I D A N DC U S T _ A C C T . P A R T Y _ I D=P A R T Y . P A R T Y _ I D A N DP S . C U S T O M E R _ S I T E _ U S E _ I D=S U . S I T E _ U S E _ I D A N DP S . C U S T O ME R _ T R X _ I D=C T . C U S T O M E R _ T R X _ I D A N DC T . B A T C H _ S O U R C E _ I D=B S . B A T C H _ S O U R C E _ I D A N DC T . O R G _ I D=B S . O R G _ I D A N DC T . C U S T _ T R X _ T Y P E _ I D=C T T . C U S T _ T R X _ T Y P E _ I D A N DC T . O R G _ I D=C T T . O R G _ I D A N DP S . S T A T U S=A L _ S T A T U S . L O O K U P _ C O D E A N DA L _ S T A T U S . L O O K U P _ T Y P E=' I N V O I C E _ T R X _ S T A T U S ' A N DP S . C O L L E C T O R _ L A S T=A R _ C O L L . C O L L E C T O R _ I D( + ) A N DP S . C O N S _ I N V _ I D=C O N S . C O N S _ I N V _ I D( + ) A N DP S . S T A T U S=N V L ( A R P _ V I E W _ C O N S T A N T S . G E T _ S T A T U S , P S . S T A T U S ) U N I O NA L L S E L E C TP S . R O W I D , P S . P A Y M E N T _ S C H E D U L E _ I D , P S . T R X _ N U M B E R , . . . P S . O R G _ I D F R O M a r _ l o o k u p sa l _ r i s k _ r e c e i p t , a r _ c o n s _ i n v _ a l lc o n s , a r _ r e c e i p t _ m e t h o d sr m , a r _ b a t c h _ s o u r c e s _ a l lb s , a r _ b a t c h e s _ a l la r b 2 , a r _ c a s h _ r e c e i p t _ h i s t o r y _ a l lc r h , a r _ c a s h _ r e c e i p t _ h i s t o r y _ a l lc r h _ c u r r e n t , a r _ c a s h _ r e c e i p t s _ a l lc r , h z _ c u s t _ s i t e _ u s e s _ a l ls u , h z _ c u s t _ a c c o u n t sc u s t _ a c c t , h z _ p a r t i e sp a r t y , a r _ p a y m e n t _ s c h e d u l e sp s , a r _ c a s h _ r e c e i p t _ h i s t o r y _ a l lc r h _ r e m i t , a r _ b a t c h e s _ a l la r b _ r e m i t , f n d _ c u r r e n c i e sf c W H E R EP S . C U S T O M E R _ I D=C U S T _ A C C T . C U S T _ A C C O U N T _ I D( + ) A N DC U S T _ A C C T . P A R T Y _ I D=P A R T Y . P A R T Y _ I D( + ) A N DP S . C U S T O M E R _ S I T E _ U S E _ I D=S U . S I T E _ U S E _ I D( + ) A N DP S . C A S H _ R E C E I P T _ I D=C R . C A S H _ R E C E I P T _ I D A N DC R . C A S H _ R E C E I P T _ I D=C R H . C A S H _ R E C E I P T _ I D A N DC R H . F I R S T _ P O S T E D _ R E C O R D _ F L A G=' Y ' A N DC R . R E C E I P T _ M E T H O D _ I D=R M . R E C E I P T _ M E T H O D _ I D A N DC R H . B A T C H _ I D=A R B 2 . B A T C H _ I D( + ) A N DA R B 2 . B A T C H _ S O U R C E _ I D=B S . B A T C H _ S O U R C E _ I D ( + )

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

13/59

4/25/13

Document 420787.1

A N DA R B 2 . O R G _ I D=B S . O R G _ I D ( + ) A N DC R . C A S H _ R E C E I P T _ I D=C R H _ C U R R E N T . C A S H _ R E C E I P T _ I D A N DC R H _ C U R R E N T . C U R R E N T _ R E C O R D _ F L A G=' Y ' A N DP S . C O N S _ I N V _ I D=C O N S . C O N S _ I N V _ I D( + ) A N DC R . C A S H _ R E C E I P T _ I D=C R H _ R E M I T . C A S H _ R E C E I P T _ I D ( + ) A N DC R H _ R E M I T . S T A T U S ( + )=' R E M I T T E D ' A N DC R H _ R E M I T . B A T C H _ I D=A R B _ R E M I T . B A T C H _ I D ( + ) A N DF C . C U R R E N C Y _ C O D E=C R . C U R R E N C Y _ C O D E A N DA L _ R I S K _ R E C E I P T . L O O K U P _ T Y P E=' Y E S / N O ' A N DA L _ R I S K _ R E C E I P T . L O O K U P _ C O D EI N( D E C O D E ( C R H _ C U R R E N T . S T A T U S , ' C L E A R E D ' , ' Y ' , ' N ' ) , D E C O D E ( N V L ( A R P _ V I E W _ C O N S T A N T S . G E T _ I N C L _ R E C E I P T S _ A T _ R I S K , ' N ' ) , ' Y ' ,' Y ' , N U L L) ) A N DA R P _ V I E W _ C O N S T A N T S . G E T _ S A L E S _ O R D E RI SN U L L A N DP S . S T A T U S =N V L ( A R P _ V I E W _ C O N S T A N T S . G E T _ S T A T U S , P S . S T A T U S )

Example 5: The following is an example of the view definition of the single organization view RA_ADDRESSES. The view depends on the RA_ADDRESSES_ALL synonym and includes the CLIENT_INFO filter. The synonym RA_ADDRESSES_ALL in turn depends on the RA_ADDRESSES_MORG view. The RA_ADDRESSES_MORG view depends on several HZ tables (HZ_CUST_ACCT_SITES_ALL, HZ_LOC_ASSIGNMENTS, HZ_LOCATIONS and HZ_PARTY_SITES). This view is created for backward compatibility to migrate customers to Trading Community Architecture.
C R E A T EO RR E P L A C EV I E WR A _ A D D R E S S E SA S S E L E C TR O W _ I D , K E Y _ A C C O U N T _ F L A G , O R G _ I D , F R O MR A _ A D D R E S S E S _ A L LW H E R E N V L ( O R G _ I D , N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' , N U L L , S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) ,1 , 1 0 ) ) ) ,9 9 ) )= N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) ,'' , N U L L , S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 )

You must rewrite this single organization view RA_ADDRESSES as a reference view following the guidelines of reference views in the subsequent section. RA_ADDRESSES must remain a view, which depends on HZ_CUST_ACCT_SITES (secured synonym), HZ_LOC_ASSIGNMENTS, HZ_LOCATIONS and HZ_PARTY_SITES. You must also remove the CLIENT_INFO predicate from the view. There are two additional cases, where the single organization views have either MLS logic or MRC logic embedded in the where clause in addition to the single organization predicate. Case 2: Single Organization View with Multi-Lingual Support Example: Original Single Organization View definition with MLS logic
C R E A T EO RR E P L A C EV I E WA R _ V A T _ T A X _ V LA S S E L E C TB . R O W I DR O W _ I D , B . A D J _ N O N _ R E C _ T A X _ C C I D , B . E D I S C _ N O N _ R E C _ T A X _ C C I D , B . U N E D I S C _ N O N _ R E C _ T A X _ C C I D , . . . B . E N A B L E D _ F L A G , B . T A X _ C L A S S , B . D I S P L A Y E D E D _ F L A G , B . T A X _ C O N S T R A I N T _ I D F R O M A R _ V A T _ T A X _ A L L _ T LT , A R _ V A T _ T A X _ A L L _ BB W H E R EB . V A T _ T A X _ I D=T . V A T _ T A X _ I DA N DN V L ( B . O R G _ I D ,9 9 )=N V L ( T . O R G _ I D ,9 9 ) A N D N V L ( B . O R G _ I D , N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) ,1, 1 ) , '' , N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) )=N V L ( T O _ N U M B E R ( D E C O D E ( S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 ) , '' , N U L L ,S U B S T R B ( U S E R E N V ( ' C L I E N T _ I N F O ' ) , 1 , 1 0 ) ) ) , 9 9 ) A N DT . L A N G U A G E=u s e r e n v ( ' L A N G ' )

The above view definition includes the CLIENT_INFO predicate and the filter condition for MLS logic, which must remain as is. Therefore, you must rewrite the single organization view to a reference view as shown in the following code: Modified View Definition with MLS Logic The line AND NVL(B.ORG_ID, -99) = NVL(T.ORG_ID, -99) is not necessary as vat_tax_id is unique across organizations.
C R E A T EO RR E P L A C EV I E WA R _ V A T _ T A X _ V LA S S E L E C TB . R O W I DR O W _ I D ,B . A D J _ N O N _ R E C _ T A X _ C C I D , B . E D I S C _ N O N _ R E C _ T A X _ C C I D , B . U N E D I S C _ N O N _ R E C _ T A X _ C C I D , B . O R G _ I D . . . B . E N A B L E D _ F L A G , B . T A X _ C L A S S , B . D I S P L A Y E D E D _ F L A G , B . T A X _ C O N S T R A I N T _ I D F R O M A R _ V A T _ T A X _ A L L _ T LT , A R _ V A T _ T A X _ BB W H E R EB . V A T _ T A X _ I D=T . V A T _ T A X _ I D A N DT . L A N G U A G E=u s e r e n v ( ' L A N G ' )

The following are the changes for single organization views with MLS logic:

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

14/59

4/25/13

Document 420787.1
Add the ORG_ID column to view definition, if it does not exist Remove the Client Info predicate from the where clause Replace the multiple organizations base table reference with secured synonym Add the ORG_ID filters if the underlying multiple organizations tables in the join condition include the ORG_ID as part of the composite key or the ORG_ID is the driving key to avoid cartesian joins

In the above example, the ORG_ID filter in the where clause is not present as it is not part of the composite index for the joined tables. Reference Views The reference views join one or more single organization views. You must modify these views to include one secured synonym in the join condition. Use the _ALL tables to refer to the single organization views. The criteria for selecting the secured synonym are: 1. The secured synonym is a driving table 2. The secured synonym includes small volume of data (typically a setup table and not a transaction table) You must add the ORG_ID filter to the where clause condition to avoid Cartesian products for tables that include ORG_ID as the composite index (as in tables that contain replicate seed data for every organization) because the ORG_ID is the driving key for the table (as in product system options tables). Attention: Every reference view must have only one secured synonym. Limiting the number of secured synonyms to one synonym improves performance.

Example 1: Original Referenced View Definition


C R E A T EO RR E P L A C EV I E WR A _ C U S T O M E R _ T R X _ P A R T I A L _ VA S S E L E C TC T . R O W I D" R O W _ I D " , C T . C U S T O M E R _ T R X _ I D" C U S T O M E R _ T R X _ I D " , C T . T R X _ N U M B E R" T R X _ N U M B E R " , C T . O L D _ T R X _ N U M B E R" O L D _ T R X _ N U M B E R " , C T _ R E L . T R X _ N U M B E R" C T _ R E L A T E D _ T R X _ N U M B E R " . . . A R P T _ S Q L _ F U N C _ U T I L . g e t _ s a l e s r e p _ n a m e _ n u m b e r ( C T . P R I M A R Y _ S A L E S R E P _ I D , ' N A M E ' ) " R A S _ P R I M A R Y _ S A L E S R E P _ N A M E " , A R P T _ S Q L _ F U N C _ U T I L . g e t _ s a l e s r e p _ n a m e _ n u m b e r ( C T . P R I M A R Y _ S A L E S R E P _ I D , ' N U M B E R ' ) " R A S _ P R I M A R Y _ S A L E S R E P _ N U M " . . . F R O M R A _ C U S T _ T R X _ L I N E _ G L _ D I S T G D ,R A _ C U S T O M E R _ T R XC T , . . . R A _ S I T E _ U S E SS U _ B I L L , R A _ C U S T O M E R SR A C _ P A Y I N G , R A _ C U S T O M E R SR A C _ B I L L , R A _ S I T E _ U S E SS U _ B I L L , R A _ S I T E _ U S E SS U _ S H I P , R A _ S I T E _ U S E SS U _ P A Y I N G , . . . R A _ A D D R E S S E SR A A _ B I L L , R A _ A D D R E S S E SR A A _ S H I P , R A _ A D D R E S S E SR A A _ R E M I T , R A _ C O N T A C T SR A C O _ S H I P , R A _ C O N T A C T SR A C O _ B I L L , A P _ B A N K _ A C C O U N T SA P B A , A P _ B A N K _ B R A N C H E SA P B , A R _ R E C E I P T _ M E T H O D SA R M , A R _ R E C E I P T _ C L A S S E SA R C , R A _ B A T C H _ S O U R C E SB S , R A _ B A T C H E SR A B , R A _ C U S T _ T R X _ T Y P E SC T T , . . . W H E R EC T . C U S T O M E R _ T R X _ I D=G D . C U S T O M E R _ T R X _ I D A N D' R E C '=G D . A C C O U N T _ C L A S SA N D' Y '=G D . L A T E S T _ R E C _ F L A G A N DC T . R E L A T E D _ C U S T O M E R _ T R X _ I D=C T _ R E L . C U S T O M E R _ T R X _ I D ( + ) A N DC T . B I L L _ T O _ C U S T O M E R _ I D=R A C _ B I L L . C U S T O M E R _ I D A N DC T . S H I P _ T O _ C U S T O M E R _ I D=R A C _ S H I P . C U S T O M E R _ I D ( + ) A N DC T . S O L D _ T O _ C U S T O M E R _ I D=R A C _ S O L D . C U S T O M E R _ I D A N DC T . P A Y I N G _ C U S T O M E R _ I D=R A C _ P A Y I N G . C U S T O M E R _ I D ( + ) A N DC T . B I L L _ T O _ S I T E _ U S E _ I D=S U _ B I L L . S I T E _ U S E _ I D . . . A N DC T . B A T C H _ S O U R C E _ I D=B S . B A T C H _ S O U R C E _ I D A N DC T . B A T C H _ I D=R A B . B A T C H _ I D ( + ) A N DC T . C U S T _ T R X _ T Y P E _ I D=C T T . C U S T _ T R X _ T Y P E _ I D A N DC T T . T Y P E< >' B R ' . . .

The view definition is modified for multiple organizations access control by replacing the reference views to single organization views with the _ALL tables. The RA_CUSTOMER_TRX object is not replaced as it is the driving table by retaining the secured synonym as shown in the following code:
C R E A T EO RR E P L A C EV I E WR A _ C U S T O M E R _ T R X _ P A R T I A L _ VA S S E L E C TC T . R O W I D" R O W _ I D " ,

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

15/59

4/25/13

Document 420787.1

S E L E C TC T . R O W I D" R O W _ I D " , C T . C U S T O M E R _ T R X _ I D" C U S T O M E R _ T R X _ I D " , C T . T R X _ N U M B E R" T R X _ N U M B E R " , C T . O L D _ T R X _ N U M B E R" O L D _ T R X _ N U M B E R " , C T _ R E L . T R X _ N U M B E R" C T _ R E L A T E D _ T R X _ N U M B E R " , A R P T _ S Q L _ F U N C _ U T I L . g e t _ s a l e s r e p _ n a m e _ n u m b e r ( C T . P R I M A R Y _ S A L E S R E P _ I D , ' N A M E ' ,C T . O R G _ I D ) " R A S _ P R I M A R Y _ S A L E S R E P _ N A M E " , A R P T _ S Q L _ F U N C _ U T I L . g e t _ s a l e s r e p _ n a m e _ n u m b e r ( C T . P R I M A R Y _ S A L E S R E P _ I D , ' N U M B E R ' ,C T . O R G _ I D ) " R A S _ P R I M A R Y _ S A L E S R E P _ N U M " , C T . O R G _ I D , . . . F R O M R A _ C U S T _ T R X _ L I N E _ G L _ D I S T _ A L LG D , R A _ C U S T O M E R _ T R XC T , . . . R A _ S I T E _ U S E S _ A L LS U _ B I L L , R A _ C U S T O M E R SR A C _ P A Y I N G , R A _ C U S T O M E R SR A C _ B I L L , R A _ S I T E _ U S E S _ A L LS U _ B I L L , R A _ S I T E _ U S E S _ A L LS U _ S H I P , R A _ S I T E _ U S E S _ A L LS U _ P A Y I N G , . . . R A _ A D D R E S S E S _ A L LR A A _ B I L L , R A _ A D D R E S S E S _ A L LR A A _ S H I P , R A _ A D D R E S S E S _ A L LR A A _ R E M I T , R A _ C O N T A C T SR A C O _ S H I P , R A _ C O N T A C T SR A C O _ B I L L , A P _ B A N K _ A C C O U N T S _ A L LA P B A , A P _ B A N K _ B R A N C H E SA P B , A R _ R E C E I P T _ M E T H O D SA R M , A R _ R E C E I P T _ C L A S S E SA R C , R A _ B A T C H _ S O U R C E S _ A L LB S , R A _ B A T C H E S _ A L LR A B , R A _ C U S T _ T R X _ T Y P E S _ A L LC T T , . . . W H E R E C T . C U S T O M E R _ T R X _ I D=G D . C U S T O M E R _ T R X _ I D A N D' R E C '=G D . A C C O U N T _ C L A S S A N D' Y '=G D . L A T E S T _ R E C _ F L A G A N DC T . R E L A T E D _ C U S T O M E R _ T R X _ I D=C T _ R E L . C U S T O M E R _ T R X _ I D ( + ) A N DC T . B I L L _ T O _ C U S T O M E R _ I D=R A C _ B I L L . C U S T O M E R _ I D A N DC T . S H I P _ T O _ C U S T O M E R _ I D=R A C _ S H I P . C U S T O M E R _ I D ( + ) A N DC T . S O L D _ T O _ C U S T O M E R _ I D=R A C _ S O L D . C U S T O M E R _ I D A N DC T . P A Y I N G _ C U S T O M E R _ I D=R A C _ P A Y I N G . C U S T O M E R _ I D ( + ) A N DC T . B I L L _ T O _ S I T E _ U S E _ I D=S U _ B I L L . S I T E _ U S E _ I D . . . A N DC T . B A T C H _ S O U R C E _ I D=B S . B A T C H _ S O U R C E _ I D A N DC T . O R G _ I D =B S . O R G _ I D A N DC T . B A T C H _ I D=R A B . B A T C H _ I D ( + ) A N DC T . C U S T _ T R X _ T Y P E _ I D=C T T . C U S T _ T R X _ T Y P E _ I D A N DC T . O R G _ I D =C T T . O R G _ I D . . .

The following are the changes you must perform for reference views: Add the ORG_ID column if it does not exist Replace single organization views with _ALL tables for all except one, which must be a secured synonym Include the ORG_ID filter in the where clause of the view to avoid the cartesian product, if the ORG_ID is the driving key or part of the composite key Include the ORG_ID parameter in the columns based on functions, if necessary Example 2: Original Reference View Definition
C R E A T EO RR E P L A C EV I E WA R _ T A X _ L I N E S _ VA S S E L E C TC T L _ T A X . R O W I D , C T L _ T A X . C U S T O M E R _ T R X _ I D , C T L _ T A X . C U S T O M E R _ T R X _ L I N E _ I D , C T L _ T A X . P R E V I O U S _ C U S T O M E R _ T R X _ I D , C T L _ T A X . P R E V I O U S _ C U S T O M E R _ T R X _ L I N E _ I D , C T L _ T A X . L I N K _ T O _ C U S T _ T R X _ L I N E _ I D , . . . C T L _ T A X . O R G _ I D F R O M R A _ C U S T O M E R _ T R X _ L I N E SC T L _ I N V _ L I N E , R A _ C U S T O M E R _ T R X _ L I N E SC T L _ I N V _ T A X , A R _ V A T _ T A XI N V _ V A T , R A _ C U S T O M E R _ T R X _ L I N E SC T L _ L I N E , R A _ C U S T O M E R _ T R X _ L I N E SC T L _ T A X , A R _ V A T _ T A XV A T W H E R EC T L _ T A X . L I N K _ T O _ C U S T _ T R X _ L I N E _ I D=C T L _ L I N E . C U S T O M E R _ T R X _ L I N E _ I D A N DC T L _ T A X . L I N E _ T Y P E =' T A X ' A N DC T L _ T A X . V A T _ T A X _ I D=V A T . V A T _ T A X _ I D ( + ) A N DC T L _ T A X . P R E V I O U S _ C U S T O M E R _ T R X _ L I N E _ I D=C T L _ I N V _ T A X . C U S T O M E R _ T R X _ L I N E _ I D( + ) A N DC T L _ I N V _ T A X . L I N K _ T O _ C U S T _ T R X _ L I N E _ I D =C T L _ I N V _ L I N E . C U S T O M E R _ T R X _ L I N E _ I D( + ) A N DC T L _ I N V _ T A X . V A T _ T A X _ I D=I N V _ V A T . V A T _ T A X _ I D( + )

The following code describes the view definition for multiple organizations access control by adding the ORG_ID column to the view definition, replacing all single

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

16/59

4/25/13

The following code describes the view definition for multiple organizations access control by adding the ORG_ID column to the view definition, replacing all single organization views as reference view by the _ALL tables and retaining the RA_CUSTOMER_TRX_LINES (CTL_TAX), which is the driving table, as the secured synonym.
C R E A T EO RR E P L A C EV I E WA R _ T A X _ L I N E S _ VA S S E L E C TC T L _ T A X . R O W I D , C T L _ T A X . C U S T O M E R _ T R X _ I D , C T L _ T A X . C U S T O M E R _ T R X _ L I N E _ I D , C T L _ T A X . P R E V I O U S _ C U S T O M E R _ T R X _ I D , C T L _ T A X . P R E V I O U S _ C U S T O M E R _ T R X _ L I N E _ I D , C T L _ T A X . L I N K _ T O _ C U S T _ T R X _ L I N E _ I D , . . . C T L _ T A X . O R G _ I D F R O M R A _ C U S T O M E R _ T R X _ L I N E S _ A L LC T L _ I N V _ L I N E , R A _ C U S T O M E R _ T R X _ L I N E S _ A L LC T L _ I N V _ T A X , A R _ V A T _ T A X _ A L LI N V _ V A T , R A _ C U S T O M E R _ T R X _ L I N E S _ A L LC T L _ L I N E , R A _ C U S T O M E R _ T R X _ L I N E SC T L _ T A X , A R _ V A T _ T A X _ A L LV A T W H E R EC T L _ T A X . L I N K _ T O _ C U S T _ T R X _ L I N E _ I D=C T L _ L I N E . C U S T O M E R _ T R X _ L I N E _ I D A N DC T L _ T A X . L I N E _ T Y P E=' T A X ' A N DC T L _ T A X . V A T _ T A X _ I D=V A T . V A T _ T A X _ I D ( + ) A N DC T L _ T A X . P R E V I O U S _ C U S T O M E R _ T R X _ L I N E _ I D=C T L _ I N V _ T A X . C U S T O M E R _ T R X _ L I N E _ I D( + ) A N DC T L _ I N V _ T A X . L I N K _ T O _ C U S T _ T R X _ L I N E _ I D=C T L _ I N V _ L I N E . C U S T O M E R _ T R X _ L I N E _ I D( + ) A N DC T L _ I N V _ T A X . V A T _ T A X _ I D=I N V _ V A T . V A T _ T A X _ I D( + )

Document 420787.1

Attach Security Policy to your Database Objects Attach the security policy to the multiple organizations synonyms to enforce security. The package MO_UTILS contains the utilities for administering policies (add policy, drop policy or check if a policy exists on an object). Use this package to administer the security policies. Review the ad_mo_util_pkg in the /ad/patch/115/sql directory to understand how policy functions are attached to synonyms. The following is sample code that illustrates attaching security policy to the synonym.
d b m s _ r l s . a d d _ p o l i c y( p _ a p p s _ u s e r _ n a m e , v _ s y n o n y m ,-s y n o n y mn a m e p _ s e c _ p o l i c y _ n a m e ,-u s e' O R G _ S E C 'h e r e p _ a p p s _ u s e r _ n a m e , ' M O _ G L O B A L . O R G _ S E C U R I T Y ' ,-S t a n d a r dM OV P Dp o l i c y ' S E L E C T ,I N S E R T ,U P D A T E ,D E L E T E ' , T R U E , T R U E , F A L S E , D B M S _ R L S . S H A R E D _ C O N T E X T _ S E N S I T I V E ) ;

In SQL*Plus, you can directly invoke the dbms_rls function using the appropriate parameters. For more details, refer to the RDBMS documentation, as the dbms_rls parameters are different for the RDBMS versions. Note: The policy name parameter accepts any value. However, for easy maintenance, you must use the ORG_SEC for multiple organizations access control security.

Enhancements to Forms
The multiple organizations setup and transaction forms must display the Operating Unit field. This allows users to select the operating unit and enter the setup or transaction for the operating unit. Oracle recommends deriving the operating units from the transaction attributes. Note: For convenience, the sample code is entered in the trigger in the examples.

Multiple Organizations Initialization Every form updated for multiple organizations access control must include a call to the multiple organizations initialization API (MO_GLOBAL.init) in the pre-form trigger. Pass S or M as the input parameter for non-multiple organizations access control enabled and multiple organizations access control enabled applications respectively. For example, a Oracle Payables form enabled for access control, must include the following code as shown in the pre-form trigger:
B E G I N A P P _ S T A N D A R D . E V E N T ( P R E F O R M ) ; M O _ G L O B A L . i n i t( ' S Q L A P ' ) ;c a nb e' S 'f o rs i n g l e ,' M 'f o rm u l t i p l em o d eo r ' < c u s t o ma p p l i c a t i o ns h o r tc o d ey o ur e g i s t e r e di nf n d _ m o _ p r o d u c t _ i n i tt a b l e > ' E N D ;

In the above example, SQLAP is the application short name for Oracle Payables.

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

17/59

4/25/13

Document 420787.1

If the MO: Security Profile profile option is set for multiple access, then the above code populates the temporary table with multiple operating units. The access mode is also set to MULTIPLE. Attention: The app_standard.event() call in the pre-form trigger executes the AOL initialization (fnd_global.apps_initialize()). You must execute the multiple organizations initialization after this call. If you do not follow this order, then the MO: Operating Unit and MO: Security Profile profile options are not cached for the right context, which results in incorrect initialization for the session.

Add Operating Unit Field The general recommendation is to place the Operating Unit field as the first field in multiple organizations enabled forms. The Operating Unit field, which is a nonbase table item, is derived from the ORG_ID value of the HR tables. You add the Operating Unit and ORG_ID fields in the form block. You do not need the Operating Unit field for blocks that do not display this field to the users. Similarly, you do not need the ORG_ID field for blocks not displaying the Operating Unit field to the user. ORG_ID Field Details Item Type Data Type Maximum Length 15 Database Item Yes

Canvas Width Null <Anything>

Text Item Number

OPERATING_UNIT Field Details Item Type Text Item Maximum Datatype Length Char 240 Database Item No

Canvas <You Canvas Name>

Width 1.5

Create List of Values for Operating Unit Field You must create a query based record group to display the operating units that are included in the security profile for a responsibility. The multiple organizations global temporary table is populated with the operating unit information depending on the MO: Security Profile profile option. To make things easier and minimize future impacts, use the APIs to obtain the operating unit name from the temporary table instead of accessing the temporary table directly. The record group query for Operating Unit field is coded as shown below:
s e l e c t h r . o r g a n i z a t i o n _ i d , o r g _ i d , h r . n a m eo p e r a t i n g _ u n i t F R O M h r _ o p e r a t i n g _ u n i t sh r W H E R E m o _ g l o b a l . c h e c k _ a c c e s s ( h r . o r g a n i z a t i o n _ i d )=' Y '

Record Group Column Specifications Column Name ORG_ID Datatype Length 240 0 Number

OPERATING_UNIT Char

Create a list of values based on this record group. The list of values size must be 3 x 3 inches. You must display the operating unit name in the list of values window. List Of Values column mapping Properties Display Width 1.5 0

Column Name OPERATING_UNIT ORG_ID

Return Item <block name>.operating_unit <block name>.org_id

Column Title Operating Unit Organization ID

Attach the list of values to the Operating Unit field. The property classes for operating unit record group and list of values are available in the multiple organizations object group. You must apply the property classes to your operating unit record group and list of values. There is no relation between the operating unit and legal entity in Release 12, it is not correct to display the legal entity in the operating unit list of values. Default Operating Unit on Forms Initialization On initializing forms, you must call the API MO_UTILS.get_default_ou to copy the global variables value to the form parameters. You must create new form parameters to store the API output and copy the default operating unit to the form block to the when-create-record trigger. The following table illustrates the new

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

18/59

4/25/13

Document 420787.1

parameters to store the API output and copy the default operating unit to the form block to the when-create-record trigger. The following table illustrates the new form parameters. Maximum Datatype Length Number Number 15 240 15

Parameter Name MO_DEFAULT_ORG_ID MO_OU_COUNT Pre-form Trigger


D E C L A R E

MO_DEFAULT_OU_NAME Char

l _ d e f a u l t _ o r g _ i dn u m b e r ; l _ d e f a u l t _ o u _ n a m ev a r c h a r 2 ( 2 4 0 ) ; l _ o u _ c o u n tn u m b e r ; B E G I N . . . m o _ u t i l s . g e t _ d e f a u l t _ o u ( l _ d e f a u l t _ o r g _ i d ,l _ d e f a u l t _ o u _ n a m e ,l _ o u _ c o u n t ) ; : P A R A M E T E R . m o _ d e f a u l t _ o r g _ i d ): =l _ d e f a u l t _ o r g _ i d ; : P A R A M E T E R . m o _ d e f a u l t _ o u _ n a m e: =l _ d e f a u l t _ o u _ n a m e ; : P A R A M E T E R . m o _ o u _ c o u n t: =l _ o u _ c o u n t ; -C a na l s ou s ei n d i r e c tr e f e r e n c ea sg i v e nb e l o w : -c o p y ( l _ d e f a u l t _ o r g _ i d , P A R A M E T E R . m o _ d e f a u l t _ o r g _ i d ) ; -c o p y ( l _ d e f a u l t _ o u _ n a m e , P A R A M E T E R . m o _ d e f a u l t _ o u _ n a m e ) ; -c o p y ( l _ o u _ c o u n t , P A R A M E T E R . m o _ o u _ c o u n t ) ; . . . E N D ;

Block Level When-Create-Record trigger


I F: p a r a m e t e r . m o _ d e f a u l t _ o r g _ i di sn o tn u l la n d: b l o c k . o r g _ i di sn u l lT H E N : b l o c k . o r g _ i d: =: p a r a m e t e r . m o _ d e f a u l t _ o r g _ i d ) ; : b l o c k . o p e r a t i n g _ u n i t: =: p a r a m e t e r . m o _ d e f a u l t _ o u _ n a m e ; -C a nu s ec o p yb u i l ti na sg i v e nb e l o w : -c o p y ( p a r a m e t e r . m o _ d e f a u l t _ o r g _ i d , b l o c k . o r g _ i d ) ; -c o p y ( p a r a m e t e r . m o _ d e f a u l t _ o u _ n a m e , b l o c k . o p e r a t i n g _ u n i t ) ; E N DI F ;

Select/Derive Operating Unit Features Select Operating Unit: In some forms, the user must select an operating unit before entering additional data. In such cases, the operating unit dependent fields are inactive when the user opens forms and are active after the user enters or selects an operating unit. Activating the dependent fields is handled by the WhenValidate-Item trigger of the Operating Unit field which initializes the operating unit specific attributes, and caches and calls the fnd_flex.event to initialize accounting flexfields, etc. Derive Operating Unit: In some forms, the user may not enter or select the operating unit but enter some values for the transaction, which determines the operating unit. Therefore, in these forms, the Operating Unit field and the Operating Unit specific fields must remain active when the user opens the forms. The initialization of operating unit specific attributes, caching and calling the fnd_flex.event to initialize accounting flexfields etc. occur in the when-validate-item trigger of Operating Unit field and when-validate-item trigger of Operating Unit specific fields. The Operating Unit specific fields must display data for the operating units that the responsibility is assigned to. However, when the user selects an operating unit, the Operating Unit specific fields must display the data for the selected operating unit only. Setting the Policy Context The multiple organizations security policy function uses a shared-context-sensitive predicate to handle simple predicate when the user can access one operating unit only and a complex predicate (exists sub-query) when the user can access multiple operating units. The predicate depends on the access mode of the application context attribute value. The "current organization" concept is introduced to salvage the existing code that works in single operating unit context. To improve performance in high volume transactional forms, you must avoid policy context. The default policy context is set on initializing the form to either Multiple, if user can access multiple operating units or Single, if the user can access only one operating unit. Attention: Do not set the "current organization" in different triggers for the new forms. Use the _ALL tables and include the form block ORG_ID to restrict data for the operating unit that the user selects and avoid Virtual Private Database context switching.

Forms that Support Select Operating Unit Feature Call the multiple organizations API to set the context to multiple or single in the following triggers: When-Create-Record Trigger of Operating Unit Field Block
I F( : p a r a m e t e r . m o _ d e f a u l t _ o r g _ i dI SN O TN U L L)T H E N -D e f a u l t i n go r g _ i df r o mp r o f i l eo p t i o n : b l o c k . o r g _ i d: =: p a r a m e t e r . m o _ d e f a u l t _ o r g _ i d ; : b l o c k . o p e r a t i n g _ u n i t: =: p a r a m e t e r . m o _ d e f a u l t _ o u _ n a m e ; -S e tp o l i c yc o n t e x t m o _ g l o b a l . s e t _ p o l i c y _ c o n t e x t ( ' S , : b l o c k . o r g _ i d ) ;

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

19/59

4/25/13
m o _ g l o b a l . s e t _ p o l i c y _ c o n t e x t ( ' S , : b l o c k . o r g _ i d ) ; E L S E m o _ g l o b a l . s e t _ p o l i c y _ c o n t e x t ( ' M ' ,n u l l ) ; E N DI F ;

Document 420787.1

I F: < y o u rb l o c kn a m e . o r g _ i d >i sn o tn u l l \ I F: < b l o c kn a m e . o r g _ i d >< >n v l ( : < p a r a m e t e r . o l d _ o r g _ i d > , 9 9 )T H E N -G e tt h ec a c h ef o rc u r r e n to r g E N DI F ; E L S E -R e f r e s ht h ec a c h e . . . E N DI F ;

Note: The defaulting API returns data, though the MO: Default Operating Unit profile option is not set when the responsibility can access one operating unit only. Therefore, the ELSE condition for setting the policy context does not need to check the parameter.ou_count value.

When-Validate-Item Trigger of Operating Unit field


I F( : < y o u rb l o c kn a m e . o r g _ i d >I SN O TN U L L)T H E N I F: < b l o c kn a m e . o r g _ i d >< >n v l ( : < p a r a m e t e r . o l d _ o r g _ i d > , 9 9 )T H E N m o _ g l o b a l . s e t _ p o l i c y _ c o n t e x t ( ' S ' ,: b l o c k . o r g _ i d ) ; -G e tt h ec a c h ef o rt h ec u r r e n to r g E N DI F ; E L S E-: b l o c k . o r g _ i di sn u l l m o _ g l o b a l . s e t _ p o l i c y _ c o n t e x t ( ' M ' ,n u l l ) ; -R e f r e s ht h ec a c h e E N DI F ;

Note: You must set the policy context in the When-Validate-Item trigger of the Operating Unit field if the Find window displays the Operating Unit field. If the value of mo_ou_count is more than one for forms that use row list of values in the Find windows, then you must set the policy context to multiple to view the operating units information.

When-New-Record-Instance Trigger of Operating Unit Field Block


I F( : < y o u rb l o c kn a m e . o r g _ i d >I SN O TN U L L)T H E N I F: < b l o c kn a m e . o r g _ i d >< >n v l ( : < p a r a m e t e r . o l d _ o r g _ i d > , 9 9 )T H E N m o _ g l o b a l . s e t _ p o l i c y _ c o n t e x t ( ' S ' ,: b l o c k . o r g _ i d ) ; -G e tt h ec a c h ef o rt h ec u r r e n to r g E N DI F ; E L S E-: b l o c k . o r g _ i di sn u l l ,s os e tt h ec o n t e x tt om u l t i p l e m o _ g l o b a l . s e t _ p o l i c y _ c o n t e x t ( ' M ' ,n u l l ) ; -R e f r e s ht h ec a c h e E N DI F ;

Pre-Insert Trigger of Operating Unit Field Block Use this trigger if the form allows the user to commit multiple records.
I F( : < y o u rb l o c kn a m e . o r g _ i d >I SN O TN U L L)T H E N I F: < b l o c kn a m e . o r g _ i d >< >n v l ( : < p a r a m e t e r . o l d _ o r g _ i d > , 9 9 )T H E N m o _ g l o b a l . s e t _ p o l i c y _ c o n t e x t ( ' S ' ,: b l o c k . o r g _ i d ) ; -G e tt h ec a c h ef o rt h ec u r r e n to r g E N DI F ; E L S E-: b l o c k . o r g _ i di sn u l l ,s os e tt h ec o n t e x tt om u l t i p l e m o _ g l o b a l . s e t _ p o l i c y _ c o n t e x t ( ' M ' ,n u l l ) ; -R e f r e s ht h ec a c h e E N DI F ;

Pre-Query Trigger of Operating Unit Field Block


B E G I N I F: p a r a m e t e r . m o _ o u _ c o u n t=1T H E N m o _ g l o b a l . s e t _ p o l i c y _ c o n t e x t ( S , : p a r a m e t e r . m o _ d e f a u l t _ o r g _ i d ) ; E L S E m o _ g l o b a l . s e t _ p o l i c y _ c o n t e x t ( ' M ' ,n u l l ) ; E N DI F ; -O t h e rC o d e E N D ;

Pre-Record Trigger of Operating Unit Field Block use this trigger if the form forces the user to commit each record.
I F( : p a r a m e t e r . c u r r e n t _ r e c o r di sn o tn u l la n d : p a r a m e t e r . c u r r e n t _ r e c o r d! =: s y s t e m . t r i g g e r _ r e c o r d )T H E N

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

20/59

4/25/13

: p a r a m e t e r . c u r r e n t _ r e c o r d! =: s y s t e m . t r i g g e r _ r e c o r d )T H E N I F( : s y s t e m . f o r m _ s t a t u si n( ' C H A N G E D ' , ' I N S E R T ' ) )T H E N m o _ g l o b a l . s e t _ p o l i c y _ c o n t e x t ( ' S ' ,: p a r a m e t e r . o l d _ o r g _ i d ) ; -G e tt h ec a c h ef o rt h ec u r r e n to r g -r a i s ee r r o rm e s s a g et ot h eu s e rt oc o m m i t ; -r a i s ef o r m _ t r i g g e r _ f a i l u r e ; E L S E -N op e n d i n gc o m m i t s . -R e s e tt h ec u r r e n tr e c o r dv a r i a b l e . : p a r a m e t e r . c u r r e n t _ r e c o r d: =' ' ; E N DI F ; E L S E -U s e rh a sn o tn a v i g a t e dt oa n o t h e rr e c o r d . -D on o tr e s e tt h ec u r r e n tr e c o r dv a r i a b l e . n u l l ; E N DI F ;

Document 420787.1

Pre-Update Trigger Use this trigger if the form allows the user to commit multiple records commits that are in different operating units.
I F( : < y o u rb l o c kn a m e . o r g _ i d >I SN O TN U L L)T H E N I F: < b l o c kn a m e . o r g _ i d >< >n v l ( : < p a r a m e t e r . o l d _ o r g _ i d > , 9 9 )T H E N m o _ g l o b a l . s e t _ p o l i c y _ c o n t e x t ( ' S ' ,: b l o c k . o r g _ i d ) ; -G e tt h ec a c h ef o rt h ec u r r e n to r g E N DI F ; E N DI F ;

Note: Some forms such as the Receivables Receipt Workbench may need the On-Lock trigger instead of the Pre-Update trigger.

Forms that Support Derive Operating Unit Feature The select operating unit feature triggers and the When-Validate-Item trigger of Operating Unit specific fields allow you to derive the operating unit from another attribute. Initialize Operating Unit Specific Attributes In earlier releases: The responsibility assigned to a user determined the operating unit because the responsibility could access only one operating unit. The operating unit specific attributes such as display of operating unit dependent fields and the default operating unit appeared when initializing forms. However, with access control, this is not the case as a responsibility can access multiple operating units. and the operating unit specific attributes are initialized when the MO: Default Operating Unit profile option is set. You must initialize the operating unit in the When-Validate-Item trigger of the Operating Unit field and modify the operating unit initialization in the When-CreateRecord trigger of the Operating Unit field block to include the default operating unit .The When-Create-Record trigger must be executed only if the user defines the default operating unit. Forms cache the operating unit specific information. For more information, refer to Operating Unit Cache Information. The following examples illustrate the types of initialization. Note: You must initialize the When-Validate-Item trigger of the Operating Unit field and When-Validate-Item triggers of the Operating Unit specific fields for forms that support the derive operating unit feature. For more information, refer to Derive Operating Unit feature.

You must modify the SQL to initialize Operating Unit specific attributes as follows: Do not use the multiple organizations temporary table in the SQL code to check and obtain information about the operating unit assigned to a user directly, use the APIs, instead. Modify joins of two or more multiple organizations views by referring to one synonym and referring the remaining views to the _ALL tables (similar to reference view standards). Add the ORG_ID filter to the WHERE clause of the SQL to avoid cartesian joins for tables that include the ORG_ID as part of the composite key or driving key. Attention: If you use the post-change trigger to populate the operating unit specific fields, you must move the post-query trigger.

Example 1: You can retrieve the information from the database after you select the operating unit for a multiple organizations instance for forms that do not cache the operating unit specific information. This must be coded in the following triggers:

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

21/59

4/25/13

Document 420787.1

When-Validate-Item of OU Field/ Post-Query/When-Create-Record/When-New-Record-Instance Trigger of OU Field Block


. . . I F: < b l o c k _ n a m e . o r g _ i d >i sn o tn u l lT H E N M O _ g l o b a l . s e t _ p o l i c y _ c o n t e x t ( S , : b l o c k . o r g _ i d ) ; -H e r ey o uc a nv e r i f yi ft h eo l do r gi ss a m ea st h e -n e wo r g .I fd i f f e r e n t ,t h e ne x e c u t et h ea b o v e ,e l s es k i pt h es e l e c ts t e p S E L E C Tb . l e d g e r _ i d ,b . c h a r t _ a c c o u n t s _ i d ,c . c u r r e n c y _ c o d e F R O M< s y s t e mo p t i o n s >a , g l _ l e d g e r s _ p u b l i c _ vb , f n d _ c u r r e n c i e sc W H E R Ea . s e t _ o f _ b o o k s _ i d=b . l e d g e r _ i d A N Db . c u r r e n c y _ c o d e=c . c u r r e n c y _ c o d e A N Da . o r g _ i d=< y o u rb l o c kn a m e > . o r g _ i d ; E N DI F ; . . .

Attention: You do not need to join to form block ORG_ID in the where clause as the policy context is single. Forms that allow the user to commit multiple records must include the initialization in the pre-insert and pre-update triggers and forms that force the user to commit the record when the user navigates out of the record must include the initialization in the prerecord trigger.

Example 2: This example demonstrates how field properties are controlled when the user selects an operating unit. The fields that depend on the operating units are disabled when forms are initialized and enabled when the user selects the operating unit according to the business logic. You must not hide the dependent fields when not applicable, as it may confuse the user, who might access multiple operating units, each set up in a different way. For example, the Billing Number field in Receivables depends on the operating unit. The field must remain disabled when the user initializes forms. However, if the user defines Show Billing Number in Receivables system options and includes the billing number as a part of cached operating unit specific information, then depending on the cached value, you must enable the field AR_BILLING_NUMBER_MIR in the When-Validate-Item trigger of the Operating Unit field and also in the When-Create-Record trigger of the field block. When-Validate-Item/When-Create-Record Trigger
. . . I F: a r _ w o r l d . a r _ s h o w _ b i l l i n g _ n u m b e r=' Y 'T H E N a p p _ i t e m _ p r o p e r t y . s e t _ p r o p e r t y ( ' T G W _ H E A D E R . A R _ B I L L I N G _ N U M B E R _ M I R ' ,E N A B L E D ,P R O P E R T Y _ O N ) ; E N DI F ; . . .

Example 3: This example illustrates how the default operating unit is retrieved from the database when selecting the operating unit. Note: The APIs in the server do not validate The ORG_ID in the form block, as the security policy context is single.

When-Validate-Item trigger/Block Level When-Create-Record Trigger for Multiple Organizations Instance


. . . m o _ g l o b a l . s e t _ p o l i c y _ c o n t e x t ( ' S ' , : b l o c k . o r g _ i d ) ; / *G e tB a t c hS o u r c eH e a d e rD e f a u l t sf r o mt h es e r v e r .P a s st h eo p e r a t i n gu n i tp a r a m e t e rt oo b t a i nt h eb a t c h s o u r c ed e f a u l t sf o rt h ec u r r e n to p e r a t i n gu n i t .* / a r p _ t r x _ d e f a u l t s . g e t _ h e a d e r _ d e f a u l t s ( p a r a m 1 ,p a r a m 2 ,: b l o c k . o r g _ i d ) ; . . .

Operating Unit Cache Information Product teams may wish to cache the commonly used operating unit information on starting forms. This avoids data validations that do not change often. In the setup forms, the information you cache might be less. For example, you may cache the ledger, currency, chart of accounts information and some system options columns or setup tables. For the transaction forms, you may cache the ledger, currency, chart of accounts information, and the system options columns and setup tables again. The difference between setup and transactions is that setup forms need few system options columns and transaction forms need many columns. Before the access control feature, a user could only access one operating unit and hence, the operating unit specific information is cached on starting forms. Now, a user can access one, or multiple operating units. To accommodate this flexible security, the operating unit specific information is cached for the operating units that the application responsibility is assigned to when starting forms. Thus, there are multiple rows of cached data and to keep the memory footprint low, the number of cached columns must be limited. Therefore, product teams must identify the operating unit specific information that must be cached and cache the columns that are frequently accessed. Product teams that wish to cache operating unit attributes on the forms tier must implement two PL/SQL packages. The first package must be created in the database and the second package in a forms library. The server-side package defines the commonly used product-specific datatypes and provides utilities that

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

22/59

4/25/13

database and the second package in a forms library. The server-side package defines the commonly used product-specific datatypes and provides utilities that retrieve the operating unit attributes from the database. The forms library package consists of a data structure (cache) that holds the attributes and functions that the forms use to access the cached data. The forms library calls the server-side utility package to retrieve the operating unit attributes from the database and stores them in an internal data structure. Note: Bulk collect is good for performance. However, it cannot be used with the PL/SQL version in the client, so a server side package is implemented to take care of bulk collect. The cache (PL/SQL table of records) is created in the client to reduce network trips between the server and the client.

Document 420787.1

The following steps illustrate the method to implement caching in forms: Step 1: Implement the server-side utility package You must implement a server-side PL/SQL package to define product-specific data types and a procedure that retrieves the operating unit attributes from the database. Copy the server side API from the template, add product specific information and replace xx with the product short name in the templates and filenames. You must modify the SQL to cache operating unit specific attributes as follows: Do not use the multiple organizations temporary table in the SQL code to check and obtain information about the operating unit assigned to a user directly, use the APIs, instead. A SQL statement must contain only one multiple organizations secured synonym. Modify joins of two or more views by referring to one secured synonym and referring the remaining views to the _ALL tables (similar to reference view standards). Add the ORG_ID filter to the WHERE clause of the SQL to avoid cartesian joins for tables that include the ORG_ID as part of the composite key or driving key. Package File Naming Standards: Package Specification: <XX>MOCSHS.pls Package Body: <XX>MOCSHB.pls Where "XX" is the product short abbreviation.
C R E A T EO RR E P L A C EP A C K A G Ex x _ m o _ c a c h e _ u t i l sA S -D e f i n ear e c o r dt y p et h a te n c a p s u l a t e so n er o wo fo p e r a t i n g -u n i ta t t r i b u t e s T Y P EG l o b a l s R e c o r dI SR E C O R D( -G e n e r i cc o l u m n sn e e d e db ya l lp r o d u c t s l e d g e r _ i d g l _ l e d g e r s . l e d g e r _ i d % T Y P E , l e d g e r _ n a m e g l _ l e d g e r s . n a m e % T Y P E , c h a r t _ o f _ a c c o u n t s _ i d g l _ l e d g e r s . c h a r t _ o f _ a c c o u n t s _ i d % T Y P E , c u r r e n c y f n d _ c u r r e n c i e s . c u r r e n c y _ c o d e % T Y P E -< <B e g i np r o d u c t s p e c i f i cf i e l d s> > -A d d i t i o n a lf i e l d s . . . -< c o l u m n 1 > < p r o d u c ts y s t e mo p t i o n s . c o l u m nn a m e > % T Y P E -< <E n dp r o d u c t s p e c i f i cf i e l d s> > ) ; -D e f i n ed a t at y p e s( n e s t e dt a b l e s )f o rs t o r i n gc o l u m n so f -t h ew i d e l yu s e dO p e r a t i n gU n i ta t t r i b u t e s : -D e f i n ean e s t e dt a b l et y p ef o rs t o r i n gt h eo r g _ i d s .T h i si s -m a n d a t o r y T Y P EO r g I D T a b l e I ST A B L EO F h r _ o r g a n i z a t i o n _ i n f o r m a t i o n . o r g a n i z a t i o n _ i d% T Y P E ; -O t h e rn e s t e dt a b l ed e f i n i t i o n s .T h e ys h o u l dc o r r e s p o n dt o -t h ef i e l d so ft h er e c o r dd e f i n e da b o v e . T Y P EL e d g e r I D T a b l e I ST A B L EO Fg l _ l e d g e r s . l e d g e r _ i d % T Y P E ; T Y P EL e d g e r N a m e T a b l e I ST A B L EO Fg l _ l e d g e r s . n a m e % T Y P E ; T Y P EC h a r t O f A c c o u n t s I D T a b l eI ST A B L EO Fg l _ l e d g e r s . c h a r t _ o f _ a c c o u n t s _ i d % T Y P E ; T Y P EC u r r e n c y C o d e T a b l e I ST A B L EO Ff n d _ c u r r e n c i e s . c u r r e n c y _ c o d e % T Y P E ; -< <B e g i np r o d u c t s p e c i f i cn e s t e dt a b l e sd e f i n i t i o n s> > -A d d i t i o n a lf i e l d s . . . -T Y P E< >I ST A B L EO F< > % T Y P E ; -< <E n dp r o d u c t s p e c i f i cn e s t e dt a b l e sd e f i n i t i o n s> > -D e f i n ear e c o r dt y p et h a te n c a p s u l a t e sm u l t i p l er o w so f -O p e r a t i n gU n i ta t t r i b u t e s : -

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

23/59

4/25/13

Document 420787.1
T Y P EG l o b a l s T a b l eI SR E C O R D ( o r g _ i d _ t O r g I D T a b l e , l e d g e r _ i d _ t L e d g e r I D T a b l e , l e d g e r _ n a m e _ t L e d g e r N a m e T a b l e , c h a r t _ o f _ a c c o u n t s _ i d _ t C h a r t O f A c c o u n t s I D T a b l e , c u r r e n c y _ c o d e _ t C u r r e n c y C o d e T a b l e -< <B e g i np r o d u c t s p e c i f i cf i e l d s> > -A d d i t i o n a lf i e l d s . . . -< > < > -< <E n dp r o d u c t s p e c i f i cf i e l d s> > ) ;

-T h i sp r o c e d u r er e t r i e v e sO p e r a t i n gU n i ta t t r i b u t e sf r o mt h e -d a t a b a s ea n ds t o r e st h e mi n t ot h es p e c i f i e dd a t as t r u c t u r e . P R O C E D U R Er e t r i e v e _ g l o b a l s ( p _ g l o b a l sO U TN O C O P YG l o b a l s T a b l e ) ; E N Dx x _ m o _ c a c h e _ u t i l s ; C R E A T EO RR E P L A C EP A C K A G EB O D Yx x _ m o _ c a c h e _ u t i l sA S -T h i sp r o c e d u r er e t r i e v e sO p e r a t i n gU n i ta t t r i b u t e sf r o mt h e -d a t a b a s ea n ds t o r e st h e mi n t ot h es p e c i f i e dd a t as t r u c t u r e . P R O C E D U R Er e t r i e v e _ g l o b a l s ( p _ g l o b a l sO U TN O C O P YG l o b a l s T a b l e) I S B E G I N -T h i ss t a t e m e n tf e t c h e sO p e r a t i n gU n i ta t t r i b u t e sf r o mt h e -d a t a b a s ea n ds t o r e st h e mi n t on e s t e dt a b l e su s i n gB U L K -C O L L E C T -U s es e p a r a t eS Q Lf o rM u l t i O r ga n dN o nM u l t i O r g S E L E C T< d r i v i n gt a b l e > . o r g _ i d , g l . c h a r t _ o f _ a c c o u n t s _ i d , g l . l e d g e r _ i d , g l . n a m e , f n d . c u r r e n c y _ c o d e -< <B e g i np r o d u c t s p e c i f i cc o l u m n s> > -A d d i t i o n a lc o l u m n s -< a . c o l u m n 1 > -< <E n dp r o d u c t s p e c i f i cc o l u m n s> > B U L KC O L L E C T I N T O p _ g l o b a l s . o r g _ i d _ t , p _ g l o b a l s . c h a r t _ o f _ a c c o u n t s _ i d _ t , p _ g l o b a l s . l e d g e r _ i d _ t , p _ g l o b a l s . l e d g e r _ n a m e _ t , p _ g l o b a l s . c u r r e n c y _ c o d e _ t -< <B e g i np r o d u c t s p e c i f i cn e s t e dt a b l e s> > -A d d i t i o n a ln e s t e dt a b l e s -p _ g l o b a l s . c o l u m n 1 _ t , -< <E n dp r o d u c t s p e c i f i cn e s t e dt a b l e s> > F R O Mg l _ l e d g e r s _ p u b l i c _ vg l , f n d _ c u r r e n c i e sf n d -< <B e g i np r o d u c t s p e c i f i ct a b l e s> > -A d d i t i o n a lt a b l e s( i fn e c e s s a r y ) -< >a -< <E n dp r o d u c t s p e c i f i ct a b l e s> > W H E R E -g l . l e d g e r _ i d=a . s e t _ o f _ b o o k s _ i d -A N D g l . c u r r e n c y _ C o d e=f n d . c u r r e n c y _ c o d e ; -A d da d d i t i o n a lW h e r eC l a u s e -A N D . . . E X C E P T I O N W H E Nn o _ d a t a _ f o u n dT H E N R A I S EE X C E P T I O N ; -Y o us h o u l dr a i s ee x c e p t i o nh e r ei fc a c h i n gi sc r i t i c a lt oy o u r -a p p l i c a t i o n .F o re x a m p l e ,t h es y s t e mo p t i o n ss e t u pm a yb e

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

24/59

4/25/13

Document 420787.1

-a p p l i c a t i o n .F o re x a m p l e ,t h es y s t e mo p t i o n ss e t u pm a yb e -i n c o m p l e t eo rn o td o n e ,i nw h i c hc a s e ,t h et r a n s a c t i o nf o r m -s h o u l db ec l o s e dp r o m p t i n gt ot h eu s e rt oc o m p l e t et h e -r e q u i r e ds e t u pf i r s t . E N Dr e t r i e v e _ g l o b a l s ; E N Dx x _ m o _ c a c h e _ u t i l s ;

Step 2: Implement the forms cache library package You must implement a product specific version of the forms cache library. Copy the package below into your library and add other product specific information. Note: If you do not have an existing library, then create a new library and attach the library directly to the form.

Library Naming Standards: <XX>MOLOCH.pll where "XX" is the product short abbreviation.
P A C K A G Ex x _ m o _ l o c a l _ c a c h eI S -T h i sp r o c e d u r er e t r i e v e sO p e r a t i n gU n i ta t t r i b u t e sa n d -s t o r e st h e mi nt h ec a c h e P R O C E D U R Ep o p u l a t e ; -T h i sf u n c t i o nr e t u r n so n er o wo fc a c h e dd a t a F U N C T I O Ng e t _ o r g _ a t t r i b u t e s ( p _ o r g _ i dN U M B E R ) R E T U R Nx x _ m o _ c a c h e _ u t i l s . G l o b a l s R e c o r d ; E N Dx x _ m o _ l o c a l _ c a c h e ; P A C K A G EB O D Yx x _ m o _ l o c a l _ c a c h eI S -T h i si n d e x b yt a b l ei su s e dt os t o r er o w so fO p e r a t i n gU n i t -a t t r i b u t e s T Y P EG l o b a l s C a c h eI ST A B L EO Fx x _ m o _ c a c h e _ u t i l s . G l o b a l s R e c o r d I N D E XB YB I N A R Y _ I N T E G E R ; -T h i sp r i v a t ev a r i a b l ei su s e da st h ec a c h e g _ c a c h eG l o b a l s C a c h e ; -T h i sp r o c e d u r er e t r i e v e sO p e r a t i n gU n i ta t t r i b u t e sa n ds t o r e s -t h e mi nt h ec a c h e P R O C E D U R Ep o p u l a t eI S i P L S _ I N T E G E R ; l _ g tx x _ m o _ c a c h e _ u t i l s . G l o b a l s T a b l e ; B E G I N -F i r s t ,r e m o v ee x i s t i n gr e c o r d s( i fa n y ) : g _ c a c h e . D E L E T E ; -N e x t ,g e tt h ed a t af r o mt h es e r v e r : x x _ m o _ c a c h e _ u t i l s . r e t r i e v e _ g l o b a l s ( l _ g t ) ; -F i n a l l y ,s t o r et h ed a t ai nt h ec a c h e : I Fl _ g t . o r g _ i d _ t . C O U N T>0T H E N F O RiI N1 . . l _ g t . o r g _ i d _ t . L A S TL O O P g _ c a c h e ( l _ g t . o r g _ i d _ t ( i ) ) . c h a r t _ o f _ a c c o u n t s _ i d g _ c a c h e ( l _ g t . o r g _ i d _ t ( i ) ) . l e d g e r _ i d g _ c a c h e ( l _ g t . o r g _ i d _ t ( i ) ) . l e d g e r _ n a m e g _ c a c h e ( l _ g t . o r g _ i d _ t ( i ) ) . c u r r e n c y -< > -A d d i t i o n a la s s i g n m e n t s. . . -g _ c a c h e ( l _ g t . o r g _ i d _ t ( i ) ) . ) ) . < c o l u m n 1 > -< > E N DL O O P ; E N DI F ; E N Dp o p u l a t e ;

: =l _ g t . c h a r t _ o f _ a c c o u n t s _ i d _ t ( i ) ; : =l _ g t . l e d g e r _ i d _ t ( i ) ; : =l _ g t . l e d g e r _ n a m e _ t ( i ) ; : =l _ g t . c u r r e n c y _ c o d e _ t ( i ) ;

: =l _ g t . < c o l u m n 1 > _ t ( i ) ;

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

25/59

4/25/13
E N Dp o p u l a t e ;

Document 420787.1

-T h i sf u n c t i o nr e t u r n so n er o wo fc a c h e dd a t a .T h i sf u n c t i o n -m a yo rm a yn o tb en e e d e d .I td e p e n d so nh o wy o ua c c e s st h e -i n f o r m a t i o ni nt h es e r v e rc a c h e . F U N C T I O Ng e t _ o r g _ a t t r i b u t e s ( p _ o r g _ i dN U M B E R ) R E T U R Nx x _ m o _ c a c h e _ u t i l s . G l o b a l s R e c o r d I S B E G I N R E T U R Ng _ c a c h e ( p _ o r g _ i d ) ; E X C E P T I O N W H E Nn o _ d a t a _ f o u n dT H E N R A I S EE X C E P T I O Nw i t ht h eo r g _ i dv a l u e ; -Y o us h o u l dr a i s ee x c e p t i o nh e r ei fc a c h i n gi sc r i t i c a l -t oy o u ra p p l i c a t i o n .Y o uw i l lg e tt h i se x c e p t i o nw h e ny o ut r y -t oc o p ya no r gn o ta v a i l a b l ei nP L / S Q Lt a b l e . -F o re x a m p l e ,i fy o uh a v ea c c e s st o2o r g ss a yo r g 1 ,o r g 2a n d -t h es e t u pi sc o m p l e t ef o ro r g 1 ,b u tn o tf o ro r g 2 ,t h e ny o u -w i l lg e te x c e p t i o nf o ro r g 2s i n c et h ep o p u l a t eA P Iw o u l dn o t -h a v ep o p u l a t e dt h eP L / S Q Lt a b l ew i t ho r g 2i n f o r m a t i o n . -P r o m p t i n gt ot h eu s e rw i t ht h em e s s a g eo fw h i c ho r g ' ss e t u p -i si n c o m p l e t em a yb eu s e f u l . W H E Nv a l u e _ e r r o rT H E N R A I S EE X C E P T I O N ; E N Dg e t _ o r g _ a t t r i b u t e s ; E N Dx x _ m o _ l o c a l _ c a c h e ;

Step 2a: Implement the server side cache package (Optional) This step is essential for product teams that use server side caching, to validate the data. Product teams must not pass the cache from the client as additional parameters to the server APIs since the operating unit specific information is cached in the server. The operating unit specific information is currently cached in the server in multiple packages depending on the functionality. The initialization code is entered in the anonymous block of the PL/SQL package and is executed when referring the package for the first time and the package remains same throughout the session. With access control, the server side caching can be consolidated into a single package, which is basically the server package mentioned in Step 1 above. The following step explains the steps to implement the cache in the server. When invoking the form, it runs in a separate database session. Therefore, the server and client are in sync during initialization. You must implement a product specific version of the server cache package. This is similar to step 2 except that the cache resides in the server. Copy the following package and add other product specific information. Package File Naming Standards: Package Specification: XXMOGLCS.pls Package Body: XXMOGLCB.pls Where "XX" is the product short abbreviation
C R E A T EO RR E P L A C EP A C K A G Ex x _ m o _ g l o b a l _ c a c h eA S -T h i sp r o c e d u r er e t r i e v e sO p e r a t i n gU n i ta t t r i b u t e sa n d -s t o r e st h e mi nt h ec a c h e P R O C E D U R Ep o p u l a t e ; -T h i sf u n c t i o nr e t u r n so n er o wo fc a c h e dd a t a F U N C T I O Ng e t _ o r g _ a t t r i b u t e s ( p _ o r g _ i dN U M B E R ) R E T U R Nx x _ m o _ c a c h e _ u t i l s . G l o b a l s R e c o r d ; E N Dx x _ m o _ g l o b a l _ c a c h e ; C R E A T EO RR E L A C EP A C K A G EB O D Yx x _ m o _ g l o b a l _ c a c h eA S -T h i si n d e x b yt a b l ei su s e dt os t o r er o w so fO p e r a t i n gU n i t -a t t r i b u t e s T Y P EG l o b a l s C a c h eI ST A B L EO Fx x _ m o _ c a c h e _ u t i l s . G l o b a l s R e c o r dI N D E XB YB I N A R Y _ I N T E G E R ; -T h i sp r i v a t ev a r i a b l ei su s e da st h ec a c h e g _ c a c h eG l o b a l s C a c h e ; -

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

26/59

4/25/13

Document 420787.1

-T h i sp r o c e d u r er e t r i e v e sO p e r a t i n gU n i ta t t r i b u t e sa n ds t o r e s -t h e mi nt h ec a c h e P R O C E D U R Ep o p u l a t eI S i P L S _ I N T E G E R ; l _ g tx x _ m o _ c a c h e _ u t i l s . G l o b a l s T a b l e ; B E G I N -F i r s t ,r e m o v ee x i s t i n gr e c o r d s( i fa n y ) : g _ c a c h e . D E L E T E ; -N e x t ,g e tt h ed a t af r o mt h es e r v e r : x x _ m o _ c a c h e _ u t i l s . r e t r i e v e _ g l o b a l s ( l _ g t ) ; -F i n a l l y ,s t o r et h ed a t ai nt h ec a c h e : I Fl _ g t . o r g _ i d _ t . C O U N T>0T H E N F O RiI N1 . . l _ g t . o r g _ i d _ t . L A S TL O O P g _ c a c h e ( l _ g t . o r g _ i d _ t ( i ) ) . c h a r t _ o f _ a c c o u n t s _ i d : =l _ g t . c h a r t _ o f _ a c c o u n t s _ i d _ t ( i ) ; g _ c a c h e ( l _ g t . o r g _ i d _ t ( i ) ) . l e d g e r _ i d : =l _ g t . l e d g e r _ i d _ t ( i ) ; g _ c a c h e ( l _ g t . o r g _ i d _ t ( i ) ) . l e d g e r _ n a m e : =l _ g t . l e d g e r _ n a m e _ t ( i ) ; g _ c a c h e ( l _ g t . o r g _ i d _ t ( i ) ) . c u r r e n c y : =l _ g t . c u r r e n c y _ c o d e _ t ( i ) ; -< > -A d d i t i o n a la s s i g n m e n t s. . . -g _ c a c h e ( l _ g t . o r g _ i d _ t ( i ) ) . < c o l u m n 1 > : =l _ g t . < c o l u m n 1 > _ t ( i ) ; -< > E N DL O O P ; E N DI F ; E N Dp o p u l a t e ;

-T h i sf u n c t i o nr e t u r n so n er o wo fc a c h e dd a t a .T h i sf u n c t i o n -m a yo rm a yn o tb en e e d e d .I td e p e n d so nh o wy o ua c c e s st h e -i n f o r m a t i o ni nt h es e r v e rc a c h e . F U N C T I O Ng e t _ o r g _ a t t r i b u t e s ( p _ o r g _ i dN U M B E R ) R E T U R Nx x _ m o _ c a c h e _ u t i l s . G l o b a l s R e c o r d I S B E G I N R E T U R Ng _ c a c h e ( p _ o r g _ i d ) ; E X C E P T I O N W H E Nn o _ d a t a _ f o u n dT H E N R A I S EE X C E P T I O Nw i t ht h eo r g _ i dv a l u e ; -Y o us h o u l dr a i s ee x c e p t i o nh e r ei fc a c h i n gi sc r i t i c a l -t oy o u ra p p l i c a t i o n .Y o uw i l lg e tt h i se x c e p t i o nw h e ny o ut r y -t oc o p ya no r gn o ta v a i l a b l ei nP L / S Q Lt a b l e . -F o re x a m p l e ,i fy o uh a v ea c c e s st o2o r g ss a yo r g 1 ,o r g 2a n d -t h es e t u pi sc o m p l e t ef o ro r g 1 ,b u tn o tf o ro r g 2 ,t h e ny o u -w i l lg e te x c e p t i o nf o ro r g 2s i n c et h ep o p u l a t eA P Iw o u l dn o t -h a v ep o p u l a t e dt h eP L / S Q Lt a b l ew i t ho r g 2i n f o r m a t i o n . -P r o m p t i n gt ot h eu s e rw i t ht h em e s s a g eo fw h i c ho r g ' ss e t u p -i si n c o m p l e t em a yb eu s e f u l . W H E Nv a l u e _ e r r o rT H E N R A I S EE X C E P T I O N ; E N Dg e t _ o r g _ a t t r i b u t e s ; E N Dx x _ m o _ g l o b a l _ c a c h e ;

Step 3: Modify the pre-form trigger In your pre-form trigger, you must include code to call the client package (xx_mo_local_cache) to populate the client side PL/SQL table with cache. If your product uses server side cache, then you must include the code to call the server package (xx_mo_global_cache) to populate the server side PL/SQL table with the cache. Pre-Form Trigger
D E C L A R E l _ g rx x _ m o _ c a c h e _ u t i l s . G l o b a l s R e c o r d ; F D R C S I D ( ' $ H e a d e r :A R X T W M A I . f m b1 1 5 . 8 02 0 0 0 / 1 0 / 0 51 0 : 3 4 j s k h a ns h i p $ ' ) ; F N D _ S T A N D A R D . F O R M _ I N F O ( ' $ R e v i s i o n :1 1 5 . 8 0 $ ' ,' A R X T W M A I . f m b ' ,' A R ' , ' $ D a t e :2 0 0 0 / 1 0 / 0 51 0 : 3 4 $ ' ,' $ A u t h o r :d j a n c i s$ ' ) ; a p p _ s t a n d a r d . e v e n t ( ' P R E F O R M ' ) ;

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

27/59

4/25/13

a p p _ s t a n d a r d . e v e n t ( ' P R E F O R M ' ) ; -I n i t i a l i z ec l i e n tc a c h e x x _ m o _ l o c a l _ c a c h e . p o p u l a t e ;

Document 420787.1

-I fy o um a k eu s eo fs e r v e rs i d ec a c h ei nt h ef o r m st h e n -i n i t i a l i z et h es e r v e rc a c h eh e r e x x _ m o _ g l o b a l _ c a c h e . p o p u l a t e ; -A d dO t h e rc o d eh e r e. . . -C o p y i n gc u r r e n to r gd a t af o rM u l t i O r gc a s ei sh a n d l e di nW h e n -V a l i d a t e I t e mt r i g g e r . . . . E N D ;

Step 4: Modify the WHEN-CREATE_RECORD trigger of the form block You must modify the when-create-record trigger of your operating unit block to copy the current operating unit specific information from the cache to the parameter or non-base table block. When the default operating unit is available, the caching depends on the default organization. If you set the correct dynamic policy context, then you can obtain the current_org_id by calling the Multiple Organizations API mo_global.get_current_org_id for product teams that must initialize the server side caching for validations on the server. When_Create-Record Trigger
D E C L A R E l _ g r x x _ m o _ c a c h e _ u t i l s . G l o b a l s R e c o r d ; B E G I N -C h e c ki ft h ed e f a u l tO Ui sa v a i l a b l e . -I fs o ,c o p yd e f a u l tO Ut of o r mb l o c k I F: p a r a m e t e r . m o _ d e f a u l t _ o r g _ i di sn o tn u l la n d : b l o c k . o r g _ i di sn u l lt h e n : b l o c k . o r g _ i d=: p a r a m e t e r . m o _ d e f a u l t _ o r g _ i d ; : b l o c k . o p e r a t i n g _ u n i t: =: p a r a m e t e r . m o _ d e f a u l t _ o u _ n a m e ; E N DI F ; -C h e c ki ft h eb l o c ko r gi ss e t .T h e nc h e c ki ft h eo p e r a t i n g -u n i ta v a i l a b l ea sd e f a u l ti st h es a m ea st h eo n ea v a i l a b l ei n -p a r a m e t e ro ran o n b a s et a b l eb l o c k .I fs a m e ,t h e nd on o tc o p y -a g a i nf r o mc a c h e .T h i se n s u r e st h a ty o ud on o tr e f r e s ht h e -p a r a m e t e ro ran o nb a s et a b l eb l o c ki fy o uc o n t i n u et oe n t e r -t r a n s a c t i o n sf o rt h eo r gw h i c hi ss a m ea st h ed e f a u l to r g . I F:i sn o tn u l l I F:< >n v l ( : , 9 9 ) T H E N -G e tt h ec u r r e n tO r ga t t r i b u t e sf r o mc l i e n ts i d ec a c h e l _ g r: =x x _ m o _ l o c a l _ c a c h e . g e t _ o r g _ a t t r i b u t e s ( : < > . o r g _ i d ) ; -C o p yf r o mc a c h et op a r a m e t e rb l o c ko rn o nb a s et a b l eb l o c k -Y o uc a nr e p l a c ep a r a m e t e rb l o c ks h o w nh e r ew i t han o n -b a s et a b l eb l o c k : p a r a m e t e r . c h a r t _ o f _ a c c o u n t s _ i d : =l _ g r . c h a r t _ o f _ a c c o u n t s _ i d ; : p a r a m e t e r . l e d g e r _ i d : =l _ g r . l e d g e r _ i d ; : p a r a m e t e r . l e d g e r _ n a m e : =l _ g r . l e d g e r _ n a m e ; : p a r a m e t e r . c u r r e n c y _ c o d e : =l _ g r . c u r r e n c y _ c o d e ; / *< >* / -A d d i t i o n a la s s i g n m e n t s . . . : p a r a m e t e r . < c o l u m n 1 > : =l _ g r . c o l u m n 1 ; / *< >* / -C o p yt h eb l o c ko r g _ i dt op a r a m e t e r . o l d _ o r g _ i d : p a r a m e t e r . o l d _ o r g _ i d : =< : b l o c kn a m e . o r g _ i d > ; E N DI F ; E L S E -C o p yn u l lt op a r a m e t e rc o l u m n s E N DI F ; -P a s st h eO R G _ I Dt os e r v e rc o d et ou s et h es e r v e rc a c h ef o rt h e -c u r r e n to r gf o rt h er e c o r dv a l i d a t i o n s -G e tB a t c hS o u r c eH e a d e rD e f a u l t s a r p _ t r x _ d e f a u l t s . g e t _ h e a d e r _ d e f a u l t s ( p a r a m 1 ,p a r a m 2 ,. . . , : b l o c k . o r g _ i d ) ; -O t h e rC o d e. . . E N D ;

Step 5: Modify the WHEN-VALIDATE-ITEM trigger of the Operating Unit field (as well as Operating Unit specific fields used in the derive operating feature) After the user selects an operating unit, the current operating unit record must be copied from the cache to the parameter or non-base table block. If you set the correct policy context, then you can obtain the current_org_id by calling the Multiple Organizations API mo_global.get_current_org_id for product

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

28/59

4/25/13

If you set the correct policy context, then you can obtain the current_org_id by calling the Multiple Organizations API mo_global.get_current_org_id for product teams that must initialize server side caching for validations on the server. Note: You must include the code to copy the cache to the parameter or non-base table block in the When-Validate-Item trigger of the Operating Unit field and the When-Validate-Item triggers of the Operating Unit specific fields to derive the operating unit for forms that support the derive operating unit feature. For more information, see Derive Operating Unit feature.

Document 420787.1

When-Validate-Item Trigger
D E C L A R E l _ g rx x _ m o _ c a c h e _ u t i l s . G l o b a l s R e c o r d ; B E G I N -C h e c ki ft h en e wO p e r a t i n gU n i ts e l e c t e db yt h eu s e ri st h es a m e -a st h eo l dO p e r a t i n gU n i tt h a ti sa v a i l a b l ei nt h ep a r a m e t e ro r -an o n b a s et a b l eb l o c k .I fs a m et h e nd on o tc o p ya g a i nf r o m -c a c h e I F: < b l o c kn a m e . o r g _ i d >i sn o tn u l lT H E N I F: < b l o c kn a m e . o r g _ i d >< >n v l ( : < p a r a m e t e r . o l d _ o r g _ i d > , 9 9 )T H E N -G e tt h ec u r r e n tO r ga t t r i b u t e sf r o mc l i e n ts i d ec a c h e l _ g r: =x x _ m o _ l o c a l _ c a c h e . g e t _ o r g _ a t t r i b u t e s ( : < > . o r g _ i d ) ; -C o p yf r o mc a c h et op a r a m e t e rb l o c ko ran o nb a s et a b l eb l o c k -Y o uc a nr e p l a c ep a r a m e t e rb l o c ks h o w nh e r e -w i t ha n yn o nb a s et a b l eb l o c k : p a r a m e t e r . c h a r t _ o f _ a c c o u n t s _ i d: =l _ g r . c h a r t _ o f _ a c c o u n t s _ i d ; : p a r a m e t e r . l e d g e r _ i d : =l _ g r . l e d g e r _ i d ; : p a r a m e t e r . l e d g e r _ n a m e : =l _ g r . l e d g e r _ n a m e ; : p a r a m e t e r . c u r r e n c y _ c o d e : =l _ g r . c u r r e n c y _ c o d e ; / *< >* / -A d d i t i o n a la s s i g n m e n t s . . . : p a r a m e t e r . < c o l u m n 1 > : =l _ g r . c o l u m n 1 ; / *< >* / -C o p yt h eb l o c ko r g _ i dt op a r a m e t e r . o l d _ o r g _ i d : p a r a m e t e r . o l d _ o r g _ i d : =< : b l o c kn a m e . o r g _ i d > ; E N DI F ; E L S E -C o p yn u l lt op a r a m e t e rc o l u m n s E N DI F ; -P a s st h eO R G _ I Dt os e r v e rc o d et ou s et h es e r v e rc a c h ef o rt h e -c u r r e n to r gf o rt h er e c o r dv a l i d a t i o n s -G e tB a t c hS o u r c eH e a d e rD e f a u l t s a r p _ t r x _ d e f a u l t s . g e t _ h e a d e r _ d e f a u l t s ( p a r a m 1 ,p a r a m 2 ,. . . , : b l o c k . o r g _ i d ) ; -O t h e rc o d eE N D ;

Step 6: Modify the block level When-New-Record-Instance trigger of the Operating Unit field block When the user tries to modify any attribute of a transaction after saving it, the operating record must be copied from the cache to the parameter or non-base table block, and use the operating unit to validate and control the display properties of the items in the record. The parameter or non-base table block is populated with the current organization cache when the user navigates for one record to another after querying the records. If you set the correct dynamic policy context, then you can obtain the current_org_id by calling the Multiple Organizations API mo_global.get_current_org_id for product teams that must initialize server side caching for validations on the server. Use the when-new-record-instance trigger to detect the updates and refresh the cache. When-New-Record-Instance Trigger
D E C L A R E l _ g rx x _ m o _ c a c h e _ u t i l s . G l o b a l s R e c o r d ; B E G I N -C h e c ki ft h en e wO p e r a t i n gU n i ts e l e c t e db yt h eu s e ri st h e -s a m ea st h eo l dO p e r a t i n gU n i tt h a ti sa v a i l a b l ei nt h e -p a r a m e t e ro rn o n b a s et a b l eb l o c k .I fs a m et h e nd on o tc o p y -a g a i nf r o mc a c h e I F: < b l o c kn a m e . o r g _ i d >i sn o tn u l lT H E N I F: < b l o c kn a m e . o r g _ i d >< >n v l ( : < p a r a m e t e r . o l d _ o r g _ i d > ,9 9 )T H E N -G e tt h ec u r r e n tO r ga t t r i b u t e sf r o mc l i e n ts i d ec a c h e l _ g r: =x x _ m o _ l o c a l _ c a c h e . g e t _ o r g _ a t t r i b u t e s ( : < > . o r g _ i d ) ; -C o p yf r o mc a c h et op a r a m e t e rb l o c ko rn o nb a s et a b l eb l o c k -Y o uc a nr e p l a c ep a r a m e t e rb l o c ks h o w nh e r e -w i t ha n yn o n b a s et a b l eb l o c k : p a r a m e t e r . c h a r t _ o f _ a c c o u n t s _ i d: =l _ g r . c h a r t _ o f _ a c c o u n t s _ i d ;

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

29/59

4/25/13

Document 420787.1
: p a r a m e t e r . c h a r t _ o f _ a c c o u n t s _ i d: =l _ g r . c h a r t _ o f _ a c c o u n t s _ i d ; : p a r a m e t e r . l e d g e r _ i d : =l _ g r . l e d g e r _ i d ; : p a r a m e t e r . l e d g e r _ n a m e : =l _ g r . l e d g e r _ n a m e ; : p a r a m e t e r . c u r r e n c y _ c o d e : =l _ g r . c u r r e n c y _ c o d e ; / *< >* / -A d d i t i o n a la s s i g n m e n t s . . . : p a r a m e t e r . < c o l u m n 1 > : =l _ g r . c o l u m n 1 ; / *< >* / -C o p yt h eb l o c ko r g _ i dt op a r a m e t e r . o l d _ o r g _ i d : p a r a m e t e r . o l d _ o r g _ i d : =< : b l o c kn a m e . o r g _ i d > ;

E N DI F ; E N DI F ; -P a s st h eO R G _ I Dt os e r v e rc o d et ou s et h es e r v e rc a c h ef o rt h e -c u r r e n to r gf o rt h er e c o r dv a l i d a t i o n s -G e tB a t c hS o u r c eH e a d e rD e f a u l t s a r p _ t r x _ d e f a u l t s . g e t _ h e a d e r _ d e f a u l t s ( p a r a m 1 ,p a r a m 2 ,. . . , : b l o c k . o r g _ i d ) ; -O t h e rc o d eE N D ;

Step 7: Modify the block level Post-Query trigger of the Operating Unit field block Attention: Post-Query trigger fires for every record on a blind query and therefore you must rewrite your SQL to use _ALL tables and use the ORG_ID join condition (based on the form block ORG_ID). You do not need to synchronize the cache in the post-query trigger. The WNRI synchronizes the cache.

In forms if the operating unit specific display fields are populated after the post query trigger, you must synchronize the cache based on the records operating unit. If you set the correct policy context, then you can obtain the current_org_id by calling the Multiple Organizations API mo_global.get_current_org_id for product teams that must initialize server side caching for validations on the server. Post-Query Trigger
D E C L A R E l _ g rx x _ m o _ c a c h e _ u t i l s . G l o b a l s R e c o r d ; B E G I N -C h e c ki ft h en e wO p e r a t i n gU n i ts e l e c t e db yt h eu s e ri st h e -s a m ea st h eo l dO p e r a t i n gU n i tt h a ti sa v a i l a b l ei nt h e -p a r a m e t e ro rn o n b a s et a b l eb l o c k .I fs a m et h e nd on o tc o p y -a g a i nf r o mc a c h e I F: < b l o c kn a m e . o r g _ i d >i sn o tn u l lT H E N I F: < b l o c kn a m e . o r g _ i d >< >n v l ( : < p a r a m e t e r . o l d _ o r g _ i d > ,9 9 )T H E N -G e tt h ec u r r e n tO r ga t t r i b u t e sf r o mc l i e n ts i d ec a c h e l _ g r: =x x _ m o _ l o c a l _ c a c h e . g e t _ o r g _ a t t r i b u t e s ( : < > . o r g _ i d ) ; -C o p yf r o mc a c h et op a r a m e t e rb l o c ko rn o nb a s et a b l eb l o c k -Y o uc a nr e p l a c ep a r a m e t e rb l o c ks h o w nh e r e -w i t ha n yn o n b a s et a b l eb l o c k : p a r a m e t e r . c h a r t _ o f _ a c c o u n t s _ i d: =l _ g r . c h a r t _ o f _ a c c o u n t s _ i d ; : p a r a m e t e r . l e d g e r _ i d : =l _ g r . l e d g e r _ i d ; : p a r a m e t e r . l e d g e r _ n a m e : =l _ g r . l e d g e r _ n a m e ; : p a r a m e t e r . c u r r e n c y _ c o d e : =l _ g r . c u r r e n c y _ c o d e ; / *< >* / -A d d i t i o n a la s s i g n m e n t s . . . : p a r a m e t e r . < c o l u m n 1 > : =l _ g r . c o l u m n 1 ; / *< >* / -C o p yt h eb l o c ko r g _ i dt op a r a m e t e r . o l d _ o r g _ i d : p a r a m e t e r . o l d _ o r g _ i d : =< : b l o c kn a m e . o r g _ i d > ; E N DI F ; E N DI F ; -P a s st h eO R G _ I Dt os e r v e rc o d et ou s et h es e r v e rc a c h ef o rt h e -c u r r e n to r gf o rt h er e c o r dv a l i d a t i o n s -G e tB a t c hS o u r c eH e a d e rD e f a u l t s a r p _ t r x _ d e f a u l t s . g e t _ h e a d e r _ d e f a u l t s ( p a r a m 1 ,p a r a m 2 ,. . . , : b l o c k . o r g _ i d ) ; -O t h e rc o d eE N D ;

Step 8: Modify the block level Pre-Insert trigger of the Operating Unit field block You need this trigger if your form allows you to commit multiple records, by synchronizing the cache. Pre-Insert Trigger
D E C L A R E l _ g rx x _ m o _ c a c h e _ u t i l s . G l o b a l s R e c o r d ; B E G I N

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

30/59

4/25/13

B E G I N

Document 420787.1

-C h e c ki ft h en e wO p e r a t i n gU n i ts e l e c t e db yt h eu s e ri st h e -s a m ea st h eo l dO p e r a t i n gU n i tt h a ti sa v a i l a b l ei nt h e -p a r a m e t e ro rn o n b a s et a b l eb l o c k .I fs a m et h e nd on o tc o p y -a g a i nf r o mc a c h e I F: < b l o c kn a m e . o r g _ i d >i sn o tn u l lT H E N I F: < b l o c kn a m e . o r g _ i d >< >n v l ( : < p a r a m e t e r . o l d _ o r g _ i d > ,9 9 )T H E N -G e tt h ec u r r e n tO r ga t t r i b u t e sf r o mc l i e n ts i d ec a c h e l _ g r: =x x _ m o _ l o c a l _ c a c h e . g e t _ o r g _ a t t r i b u t e s ( : < > . o r g _ i d ) ; -C o p yf r o mc a c h et op a r a m e t e rb l o c ko rn o nb a s et a b l eb l o c k -Y o uc a nr e p l a c ep a r a m e t e rb l o c ks h o w nh e r e -w i t ha n yn o n b a s et a b l eb l o c k : p a r a m e t e r . c h a r t _ o f _ a c c o u n t s _ i d: =l _ g r . c h a r t _ o f _ a c c o u n t s _ i d ; : p a r a m e t e r . l e d g e r _ i d : =l _ g r . l e d g e r _ i d ; : p a r a m e t e r . l e d g e r _ n a m e : =l _ g r . l e d g e r _ n a m e ; : p a r a m e t e r . c u r r e n c y _ c o d e : =l _ g r . c u r r e n c y _ c o d e ; / *< >* / -A d d i t i o n a la s s i g n m e n t s . . . : p a r a m e t e r . < c o l u m n 1 > : =l _ g r . c o l u m n 1 ; / *< >* / -C o p yt h eb l o c ko r g _ i dt op a r a m e t e r . o l d _ o r g _ i d : p a r a m e t e r . o l d _ o r g _ i d : =< : b l o c kn a m e . o r g _ i d > ; E N DI F ; E N DI F ; -P a s st h eO R G _ I Dt os e r v e rc o d et ou s et h es e r v e rc a c h ef o rt h e -c u r r e n to r gf o rt h er e c o r dv a l i d a t i o n s -G e tB a t c hS o u r c eH e a d e rD e f a u l t s a r p _ t r x _ d e f a u l t s . g e t _ h e a d e r _ d e f a u l t s ( p a r a m 1 ,p a r a m 2 ,. . . , : b l o c k . o r g _ i d ) ; -O t h e rc o d eE N D ;

Step 9: Modify the block level Pre-Update trigger of the Operating Unit field block You need this trigger if your form allows you to commit multiple records, by synchronizing the cache. Pre-Update Trigger
D E C L A R E l _ g rx x _ m o _ c a c h e _ u t i l s . G l o b a l s R e c o r d ; B E G I N -C h e c ki ft h en e wO p e r a t i n gU n i ts e l e c t e db yt h eu s e ri st h e -s a m ea st h eo l dO p e r a t i n gU n i tt h a ti sa v a i l a b l ei nt h e -p a r a m e t e ro rn o n b a s et a b l eb l o c k .I fs a m et h e nd on o tc o p y -a g a i nf r o mc a c h e I F: < b l o c kn a m e . o r g _ i d >i sn o tn u l lT H E N I F: < b l o c kn a m e . o r g _ i d >< >n v l ( : < p a r a m e t e r . o l d _ o r g _ i d > ,9 9 )T H E N -G e tt h ec u r r e n tO r ga t t r i b u t e sf r o mc l i e n ts i d ec a c h e l _ g r: =x x _ m o _ l o c a l _ c a c h e . g e t _ o r g _ a t t r i b u t e s ( : < > . o r g _ i d ) ; -C o p yf r o mc a c h et op a r a m e t e rb l o c ko rn o nb a s et a b l eb l o c k -Y o uc a nr e p l a c ep a r a m e t e rb l o c ks h o w nh e r e -w i t ha n yn o n b a s et a b l eb l o c k : p a r a m e t e r . c h a r t _ o f _ a c c o u n t s _ i d: =l _ g r . c h a r t _ o f _ a c c o u n t s _ i d ; : p a r a m e t e r . l e d g e r _ i d : =l _ g r . l e d g e r _ i d ; : p a r a m e t e r . l e d g e r _ n a m e : =l _ g r . l e d g e r _ n a m e ; : p a r a m e t e r . c u r r e n c y _ c o d e : =l _ g r . c u r r e n c y _ c o d e ; / *< >* / -A d d i t i o n a la s s i g n m e n t s . . . : p a r a m e t e r . < c o l u m n 1 > : =l _ g r . c o l u m n 1 ; / *< >* / -C o p yt h eb l o c ko r g _ i dt op a r a m e t e r . o l d _ o r g _ i d : p a r a m e t e r . o l d _ o r g _ i d : =< : b l o c kn a m e . o r g _ i d > ; E N DI F ; E N DI F ; -P a s st h eO R G _ I Dt os e r v e rc o d et ou s et h es e r v e rc a c h ef o rt h e -c u r r e n to r gf o rt h er e c o r dv a l i d a t i o n s -G e tB a t c hS o u r c eH e a d e rD e f a u l t s a r p _ t r x _ d e f a u l t s . g e t _ h e a d e r _ d e f a u l t s ( p a r a m 1 ,p a r a m 2 ,. . . , : b l o c k . o r g _ i d ) ; -O t h e rc o d eE N D ;

Note: For forms such as the Receivables Receipt Workbench, you need the ON_LOCK trigger instead of the Pre-Update trigger.

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

31/59

4/25/13

Document 420787.1

Step 10: Modify the block level Pre-Record trigger of the Operating Unit field block You need this trigger if your form forces users to commit the record before navigating to the next record. Pre-Record Trigger
D E C L A R E l _ g rx x _ m o _ c a c h e _ u t i l s . G l o b a l s R e c o r d ; B E G I N -C h e c ki ft h en e wO p e r a t i n gU n i ts e l e c t e db yt h eu s e ri st h e -s a m ea st h eo l dO p e r a t i n gU n i tt h a ti sa v a i l a b l ei nt h e -p a r a m e t e ro rn o n b a s et a b l eb l o c k .I fs a m et h e nd on o tc o p y -a g a i nf r o mc a c h e I F: < b l o c kn a m e . o r g _ i d >i sn o tn u l lT H E N I F: < b l o c kn a m e . o r g _ i d >< >n v l ( : < p a r a m e t e r . o l d _ o r g _ i d > ,9 9 )T H E N -G e tt h ec u r r e n tO r ga t t r i b u t e sf r o mc l i e n ts i d ec a c h e l _ g r: =x x _ m o _ l o c a l _ c a c h e . g e t _ o r g _ a t t r i b u t e s ( : < > . o r g _ i d ) ; -C o p yf r o mc a c h et op a r a m e t e rb l o c ko rn o nb a s et a b l eb l o c k -Y o uc a nr e p l a c ep a r a m e t e rb l o c ks h o w nh e r e -w i t ha n yn o n b a s et a b l eb l o c k : p a r a m e t e r . c h a r t _ o f _ a c c o u n t s _ i d: =l _ g r . c h a r t _ o f _ a c c o u n t s _ i d ; : p a r a m e t e r . l e d g e r _ i d : =l _ g r . l e d g e r _ i d ; : p a r a m e t e r . l e d g e r _ n a m e : =l _ g r . l e d g e r _ n a m e ; : p a r a m e t e r . c u r r e n c y _ c o d e : =l _ g r . c u r r e n c y _ c o d e ; / *< >* / -A d d i t i o n a la s s i g n m e n t s . . . : p a r a m e t e r . < c o l u m n 1 > : =l _ g r . c o l u m n 1 ; / *< >* / -C o p yt h eb l o c ko r g _ i dt op a r a m e t e r . o l d _ o r g _ i d : p a r a m e t e r . o l d _ o r g _ i d : =< : b l o c kn a m e . o r g _ i d > ; E N DI F ; E N DI F ; -P a s st h eO R G _ I Dt os e r v e rc o d et ou s et h es e r v e rc a c h ef o rt h e -c u r r e n to r gf o rt h er e c o r dv a l i d a t i o n s -G e tB a t c hS o u r c eH e a d e rD e f a u l t s a r p _ t r x _ d e f a u l t s . g e t _ h e a d e r _ d e f a u l t s ( p a r a m 1 ,p a r a m 2 ,. . . , : b l o c k . o r g _ i d ) ; -O t h e rc o d eE N D ;

Modify Record Groups for Operating Unit Specific Fields You must modify the Operating Unit specific field records as follows if the Operating Unit field select or derive operating unit features: Do not use the multiple organizations temporary table directly in the SQL query. Instead, use the PL/SQL functions to check the operating unit access and obtain the operating unit information, . Modify the limit reference to one multiple organizations secured synonym and the rest of the references to _ALL tables (similar to Reference view standards) for record group SQL joining two or more views. Add the ORG_ID filter to the WHERE clause of the record group SQL to avoid cartesian joins for tables that include ORG_ID as the composite or driving key. Do not include the form block ORG_ID in the record group SQL as the policy context handles single and multiple operating units data. See Setting the Policy Context. Set the policy context in the When-Validate-Item trigger of the Operating Unit field and the Operating Unit specific fields to derive the operating units for forms that support the "Derive Operating Unit" feature. Example 1: Record groups using the derive operating feature The list of values is enabled for record groups that use the Derive Operating Unit feature. If the operating unit field is empty, the current organization is not set and the access mode is multiple. Therefore, the record group SQL returns data for multiple operating units. If the access mode is single when you select the operating unit and define the current organization, then the list of values returns the data for the selected operating unit.
s e l e c tb s . n a m es o u r c e ,b s . b a t c h _ s o u r c e _ i db a t c h _ s o u r c e _ i d , b s . d e s c r i p t i o nd e s c r i p t i o n , b s . a u t o _ t r x _ n u m b e r i n g _ f l a ga u t o _ t r x _ n u m b e r i n g _ f l a g , b s . b a t c h _ s o u r c e _ t y p eb a t c h _ s o u r c e _ t y p e , b s . d e f a u l t _ i n v _ t r x _ t y p ed e f a u l t _ i n v _ t r x _ t y p e , c t t . n a m ed e f a u l t _ t y p e _ n a m e ,b s . o r g _ i d , m o _ g l o b a l . g e t _ o u _ n a m e ( b s . o r g _ i d ) f r o mr a _ c u s t _ t r x _ t y p e s _ a l lc t t , r a _ b a t c h _ s o u r c e sb s w h e r eb s . d e f a u l t _ i n v _ t r x _ t y p e=c t t . c u s t _ t r x _ t y p e _ i d ( + ) a n db s . o r g _ i d=c t t . o r g _ i d ( + ) a n dn v l ( : t g w _ h e a d e r . c t t _ c l a s s , ' 9 9 ' )=d e c o d e ( : t g w _ h e a d e r . c t t _ c l a s s ,n u l l ,' 9 9 ' ,c t t . t y p e ( + )) a n dn v l ( : t g w _ h e a d e r . t r x _ d a t e , t r u n c ( s y s d a t e ) )b e t w e e nn v l ( b s . s t a r t _ d a t e , n v l ( : t g w _ h e a d e r . t r x _ d a t e , t r u n c ( s y s d a t e ) ) ) a n dn v l ( b s . e n d _ d a t e ,n v l ( : t g w _ h e a d e r . t r x _ d a t e ,t r u n c ( s y s d a t e ) ) ) a n dn v l ( : t g w _ h e a d e r . t r x _ d a t e , t r u n c ( s y s d a t e ) )b e t w e e nn v l ( c t t . s t a r t _ d a t e ( + ) , n v l ( : t g w _ h e a d e r . t r x _ d a t e , t r u n c ( s y s d a t e ) ) )

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

32/59

4/25/13

Document 420787.1
a n dn v l ( : t g w _ h e a d e r . t r x _ d a t e , t r u n c ( s y s d a t e ) )b e t w e e nn v l ( c t t . s t a r t _ d a t e ( + ) , n v l ( : t g w _ h e a d e r . t r x _ d a t e , t r u n c ( s y s d a t e ) ) ) a n dn v l ( c t t . e n d _ d a t e ( + ) ,n v l ( : t g w _ h e a d e r . t r x _ d a t e ,t r u n c ( s y s d a t e ) ) ) a n dn v l ( b s . s t a t u s ,' A ' )=' A ' a n d(b s . b a t c h _ s o u r c e _ t y p e= ' I N V 'o r: t g w _ h e a d e r . c t t _ c l a s s=' C M ') a n db s . b a t c h _ s o u r c e _ i dn o ti n( 1 1 ,1 2 ) a n d(: t g w _ h e a d e r . t r x _ n u m b e ri sn u l l o rb s . a u t o _ t r x _ n u m b e r i n g _ f l a g=n v l ( : t g w _ h e a d e r . b s _ a u t o _ t r x _ n u m b e r i n g _ f l a g , ' N ' ) ) o r d e rb yb s . n a m e ,b s . d e s c r i p t i o n ,b s . b a t c h _ s o u r c e _ i d

In the above example, the ORG_ID filter is added to avoid cartesian join. Example 2: Record groups using the derive operating feature In this example, it is not necessary to add the ORG_ID filter in the where clause to join RA_SITE_USES and AR_CONS_INV views as the site_use_id is unique and sufficient to determine the organization.
s e l e c tc i . c o n s _ b i l l i n g _ n u m b e r , c i . c u s t o m e r _ i d , c i . s i t e _ u s e _ i d , c u . c u s t o m e r _ n a m e , c u . c u s t o m e r _ n u m b e r , s u . l o c a t i o n , s u . o r g _ i d , m o _ g l o b a l . g e t _ o u _ n a m e ( s u . o r g _ i d ) f r o ma r _ c o n s _ i n v _ a l lc i , r a _ c u s t o m e r sc u , r a _ s i t e _ u s e ss u w h e r ec i . c u r r e n c y _ c o d e=: r g w _ f o l d e r . c u r r e n c y _ c o d e a n dc i . s i t e _ u s e _ i d=s u . s i t e _ u s e _ i d a n dc i . c u s t o m e r _ i d=c u . c u s t o m e r _ i d o r d e rb yc o n s _ b i l l i n g _ n u m b e r

Example 3: Record groups using select operating feature The list of values is disabled for record groups using the "Select Operating Unit" feature until the user selects an operating unit. The current organization and the access mode are defined after the user selects the operating unit. Therefore, the record group SQL always returns data for one operating unit.
s e l e c tm a x ( t c . n a m e )n a m e , l c . d i s p l a y e d _ f i e l dt y p e , t c . d e s c r i p t i o n f r o ma p _ l o o k u p _ c o d e sl c , a p _ t a x _ c o d e st c w h e r el c . l o o k u p _ t y p e=' T A XT Y P E ' a n dt c . t a x _ t y p e! =' O F F S E T ' a n dt c . t a x _ t y p e! =' A W T ' a n dl c . l o o k u p _ c o d e=t c . t a x _ t y p e a n dn v l ( t c . e n a b l e d _ f l a g , ' Y ' ) = ' Y ' g r o u pb yt c . n a m e ,l c . d i s p l a y e d _ f i e l d ,t c . d e s c r i p t i o n

Note: It is the product team's discretion to implement the select operating unit or derive the operating unit feature for the record groups based on the business logic. There is no difference to the record group SQL for the select operating unit and derive operating unit because of the policy context. The operating unit dependent fields are grayed out for forms supporting the select operating unit, until the user selects an operating unit. The records groups of these fields depend on the_ALL tables and not the secured synonym.

You can rewrite the previous statement to use the ALL tables instead of secured synonyms by passing the form block ORG_ID as shown in the following code:
s e l e c tm a x ( t c . n a m e )n a m e , l c . d i s p l a y e d _ f i e l dt y p e , t c . d e s c r i p t i o n f r o ma p _ l o o k u p _ c o d e sl c , a p _ t a x _ c o d e s _ A L Lt c w h e r el c . l o o k u p _ t y p e=' T A XT Y P E ' a n dt c . t a x _ t y p e! =' O F F S E T ' a n dt c . t a x _ t y p e! =' A W T ' a n dl c . l o o k u p _ c o d e=t c . t a x _ t y p e a n dn v l ( t c . e n a b l e d _ f l a g , ' Y ' ) = ' Y ' a n dt c . o r g _ i d=: < b l o c k _ n a m e . o r g _ i d > g r o u pb yt c . n a m e ,l c . d i s p l a y e d _ f i e l d ,t c . d e s c r i p t i o n

Add ORG_ID Predicate in Client/Server Code On the client side and server side application code, SQL statements issue Data Manipulation Language (DML) for multiple organizations views. The APIs that validate the data in an operating unit benefit from using the current organization ID set by the triggers before firing the validation logic, rather than passing the ORG_ID parameter. If you use the same API in the reference view and server side validation for forms, then you must modify the API to include ORG_ID input parameter as described in Reference Views. Do not use the multiple organizations temporary table directly in the SQL query. Instead, use the PL/SQL functions to check the operating unit access and obtain the operating unit information.

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

33/59

4/25/13

obtain the operating unit information. Rewrite SQL joins with two or more views to use one secured synonym based on the driving table for the query and the rest of the views replaced by _ALL tables. High selective and low data volume objects are good candidates for the driving object. Add the ORG_ID filter to the WHERE clause of the record group SQL to avoid cartesian joins for tables that include ORG_ID as the composite or driving key.

Document 420787.1

Example 1:
B E G I N S E L E C T N V L ( c o p y _ d o c _ n u m b e r _ f l a g ,' N ' ) I N T O l _ c o p y _ d o c _ n u m b e r _ f l a g F R O M r a _ b a t c h _ s o u r c e s W H E R E b a t c h s o u r c e _ i d=l _ c t _ r e c . b a t c h _ s o u r c e _ i d E X C E P T I O N W H E NN O _ D A T A _ F O U N DT H E N l _ c o p y _ d o c _ n u m b e r _ f l a g: =' N ' ; E N D ;

Example 2:
l _ t r x _ s t r: =' s e l e c tr a _ t r x _ n u m b e r _ '| | R E P L A C E ( p _ t r x _ r e c . b a t c h _ s o u r c e _ i d ,' ' ,' N ' )| | l _ o r g _ s t r | | ' _ s . n e x t v a lt r x _ n u m b e r'| | ' f r o mr a _ b a t c h _ s o u r c e s'| | ' w h e r eb a t c h _ s o u r c e _ i d='| | p _ t r x _ r e c . b a t c h _ s o u r c e _ i d| | 'a n da u t o _ t r x _ n u m b e r i n g _ f l a g=' ' Y ' ' ' E X E C U T EI M M E D I A T El _ t r x _ s t r I N T Ol _ t r x _ n u m b e r ;

Modify table handlers The default value that refers to the CLIENT_INFO organization context for ORG_ID column is used in the base _ALL tables in releases prior to Release 12. However, with the multiple organizations access control feature, this database default is no longer valid as the user can access multiple operating unit sand the CLIENT_INFO will not be set. Therefore, the ORG_ID column value must be explicitly specified in the table handlers. Note: The table does not allow you to drop the database default value. Therefore, you must replace the default function with 'null'.

For insert statements, you must pass the ORG_ID column value to the table handlers. For update statements, if you use a primary key column in your selection criteria, then you do not need the ORG_ID value in the table handler. The following are examples of insert, update and delete statements: Example 1: An insert statement
i n s e r ti n t o< t a b l e * > ( < c o l u m n 1 > < c o l u m n 2 > . . . < o r g _ i d > ) v a l u e s(< v a l u e 1 > , < v a l u e 2 > , . . . p _ o r g _ i d ) *i n d i c a t e st h a tas y n o n y mi sa t t a c h e dt ot h em u l t i p l eo r g a n i z a t i o n ss e c u r i t yp o l i c y .

Example 2: An update statement


u p d a t e< t a b l e > s e t< c o l u m n 1 >=< v a l u e 1 > w h e r ep r i m a r y _ k e y=< v a l u e >

Note: You must add the ORG_ID filter to the WHERE clause to update tables that include the ORG_ID as the composite or driving key for the table.

Example 3: A delete statement In this example, the primary key is used to update and delete statements. Hence, the ORG_ID filter is not added.
D E L E T EF R O Mr a _ c u s t o m e r _ t r x W H E R Ec u s t o m e r _ t r x _ i d=p _ c u s t o m e r _ t r x _ i d ;

Allow Query on Operating Unit field

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

34/59

4/25/13

Document 420787.1

The operating unit field is a non-database item. To query by operating units, the operating unit value must be derived from the ORG_ID database column. You do this in the pre-query and post-query triggers by using the API: MO_UTILS.Get_Org_Name. Block Level Post-Query Trigger
: < y o u rb l o c kn a m e > . o p e r a t i n g _ u n i t: = m o _ u t i l s . g e t _ o r g _ n a m e ( : < y o u rb l o c kn a m e > . o r g _ i d ) ; s e t _ r e c o r d _ p r o p e r t y ( : s y s t e m . t r i g g e r _ r e c o r d , : s y s t e m . t r i g g e r _ b l o c k , S T A T U S , Q U E R Y _ S T A T U S ) ;

MO_UTILS.Get_Org_Name
F U N C T I O NG e t _ O r g _ N a m e (p _ o r g _ i dN U M B E R) R E T U R NV A R C H A R 2 I S l _ r e t u r nh r _ a l l _ o r g a n i z a t i o n _ u n i t s _ t l . n a m e % T Y P E ; B E G I N S E L E C Tn a m e I N T O l _ r e t u r n F R O M h r _ a l l _ o r g a n i z a t i o n _ u n i t s _ t l W H E R E o r g a n i z a t i o n _ i d=p _ o r g _ i d A N D l a n g u a g e=u s e r e n v ( ' L A N G ' ) ; I FS Q L % N O T F O U N D T H E N l _ r e t u r n: =N U L L ; E N DI F ; R E T U R Nl _ r e t u r n ; E N DG e t _ O r g _ N a m e ;

You must modify the PRE-QUERY trigger of the operating unit block forms to enable the Query Enter functionality for the operating unit name. The trigger must dynamically modify the DEFAULT_WHERE property of the block to append a LIKE sub-query that examines the hr_operating_units view for records that matches the string entered in the Operating Unit field. Note: The queries performed on the hr_operating_units view queries include the user's current language context.

Block Level PRE-QUERY Trigger


D E C L A R E b l o c k _ i dB l o c k: =F I N D _ B L O C K ( ' < b l o c kn a m e > ' ) ; s u b _ w h e r eV A R C H A R 2 ( 5 1 2 ) ; d e f _ w h e r eV A R C H A R 2 ( 5 1 2 ) ; -L o c a lf u n c t i o nd e f i n i t i o n : F U N C T I O Na d d _ a n d ( p _ w h e r eI NV A R C H A R 2 )R E T U R NV A R C H A R 2 I S B E G I N I F( N V L ( N V L ( l e n g t h ( p _ w h e r e ) ,0 ) ,0 )! =0 )T H E N R E T U R N (p _ w h e r e| |'A N D' ) ; E L S E R E T U R N (p _ w h e r e) ; E N DI F ; R E T U R NN U L L ; E N D ; B E G I N s u b _ w h e r e: =N U L L ; I F( < b l o c kn a m e > . o p e r a t i n g _ u n i tI SN O TN U L L )T H E N s u b _ w h e r e: =a d d _ a n d ( s u b _ w h e r e )| |' ( N A M EL I K E' ' ' | |: < b l o c kn a m e > . O P E R A T I N G _ U N I T | | ' ' ' ) ' ; E N DI F ; I F( s u b _ w h e r eI SN O TN U L L )T H E N d e f _ w h e r e: =a d d _ a n d ( d e f _ w h e r e )| |' ( ( O R G _ I D )I N' | | ' ( S E L E C T O R G A N I Z A T I O N _ I D ' | | ' F R O M H R _ O P E R A T I N G _ U N I T SW H E R E' | |s u b _ w h e r e| |' ) ) ' ; E N DI F ; -S p e c i f yt h ed e f a u l tW H E R Ec l a u s ef o rt h eb l o c k . -T h i sw i l lN O To v e r r i d eav a l u ee s t a b l i s h e da td e s i g nt i m e -v i at h eP r o p e r t yP a l e t t ef o rt h eb l o c k ' sW H E R Ec l a u s ep r o p e r t y . s e t _ b l o c k _ p r o p e r t y ( b l o c k _ i d ,D E F A U L T _ W H E R E ,d e f _ w h e r e ) ; E N D ;

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

Handle Flexfields

35/59

4/25/13
Handle Flexfields Accounting Key Flexfields

Document 420787.1

The chart of accounts ID associated with the accounting flexfields depends on the ledger associated with the operating unit. To ensure accounting flexfields work properly, you must pass the chart of accounts ID as an input parameter to the API that defines key flexfield. When you change the operating unit by selecting the operating unit from the list of values or by deriving the operating unit from any operating unit specific attributes of the transaction, the chart of accounts value must be refreshed from the cache. The ledger ID or chart of accounts ID is determined when the user selects or derives an operating unit. The user cannot know the ledger and chart of accounts ID when initializing the forms if the user can access multiple operating units. To enable access control for accounting flexfields, complete the following: 1. Add a new item CHART_OF_ACCOUNTS_ID to your form block of your canvas. Use this item and not the parameter chart_of_accounts_id as using this item calls to fnd_key_flex.define. 2. Call the fnd_key_flex.define in the following triggers: a. Block Level: When-Create-Record b. Item Level: When-Validate-Item of Operating Unit field and Operating Unit specific fields for Derive Operating Unit feature. c. Block Level: Post-Query d. Block Level: Pre-Query (to query accounting flexfields) 3. Disable calling the fnd_flex.define at the form level and block level Pre-Query trigger. Otherwise, the following error appears: APP-FND-01016: Routine FDFRKS: Unknown structure ID for flexfield code GL number with application ID 101 during blind query for multiple organizations case. The following code defines the key flexfield structure for inserts, updates and queries. Block Level Post-query trigger/When-Create-Record trigger/When-ValidateItem trigger on the Operating Unit field and other Operating Unit specific fields for deriving Operating Unit Block Level Post-query Trigger/When-Create-Record Trigger/When-Validate-Item Trigger on the Operating Unit Field and Other Operating Unit Specific Fields for Deriving the Operating Unit
I F( : < y o u rb l o c kn a m e . o r g _ i d >I SN O TN U L L )A N D( : < y o u rb l o c kn a m e . o p e r a t i n g _ u n i t >I SN O TN U L L )T H E N I F: < b l o c kn a m e . o r g _ i d >< >n v l ( : < p a r a m e t e r . o l d _ o r g _ i d > ,9 9 )T H E N l _ g r: =< > _ M O _ l o c a l _ c a c h e . g e t _ o r g _ a t t r i b u t e s ( : < > . o r g _ i d ) ; : < b l o c kn a m e > . c h a r t _ o f _ a c c o u n t _ i d: =l _ g r . c h a r t _ o f _ a c c o u n t _ i d ; / *I n i t i a l i z eO t h e rP a r a m e t e r s* / . . . F N D _ K E Y _ F L E X . D E F I N E ( B L O C K = > ' < y o u rb l o c kn a m e > ' , F I E L D= > ' < y o u rf i e l dn a m e > ' , T I T L E= > : < b l o c kn a m e > F i e l d _ n a m e , N U M= >< b l o c kn a m e > . c h a r t _ o f _ a c c o u n t _ i d ,. . . ) ; . . . E N DI F ; E N DI F ;

Note: The parameter NUM to the flexfield API is changed to enable access control. If you implement the "Derive Operating Unit" feature, then you must call the fnd_key_flex.define (from the WVI triggers of Operating Unit specific fields) before populating the default key flexfield value from the operating unit specific fields of the transaction. You must implement the code in the triggers of master and detail blocks for accounting flexfields in master and detail blocks.

Querying on Accounting Flexfields You must disable the key flexfield (fnd_flex.event call) in the form and block level pre-query triggers and re-enable in the block level post-query trigger to not query the accounting flexfields in your form. Set the "QUERY ALLOWED" item property to No to not allow enter-query on accounting flexfields. To query accounting flexfields, add additional logic in the block level pre-query trigger to handle enter query. Use the accounting flexfield in the query if the operating unit is specified. In other words, the accounting flexfield field is dependent on the Operating Unit field. However, the control item properties, cannot be controlled to set dependent items during enter-query and a message is displayed asking users to enter a unique Operating Unit when they execute the enter-query. The following table lists the circumstances for displaying the messages: Accounting Flexfield Field Null Not Null Not Null Not Null Not Null

Operating Unit Field Any Value Null Not Null (cannot identify the operating unit) Not Null (can identify operating unit) Not Null (cannot find any operating unit matching the condition)

Result Execute the standard enter query. Display message Please enter Operating Unit for multiple organizations. Display message The system cannot identify KFF structure. Please enter the full Operating Unit name. Execute the standard enter-query. Execute the standard enter query.

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

36/59

4/25/13
The following code handles enter-query on accounting flexfields:

Document 420787.1

P R O C E D U R EP R E _ Q U E R YI S l _ o r g _ i d N U M B E R ( 1 5 ) ; l _ g r A P _ M O _ c a c h e _ u t i l s . G l o b a l s R e c o r d ; l _ n o _ o u _ f o u n d E X C E P T I O N ; B E G I N I F: i n v o i c e s _ f o l d e r . o p e r a t i n g _ u n i tI SN U L LT H E N I F: i n v o i c e s _ f o l d e r . l i a b i l i t y _ a c c o u n tI SN O TN U L LT H E N f n d _ m e s s a g e . s e t _ n a m e ( ' F N D ' , ' M O _ S R C H _ O U _ R E Q U I R E D ' ) ; f n d _ m e s s a g e . e r r o r ; R A I S EF O R M _ T R I G G E R _ F A I L U R E ; E N DI F ; E L S E I F: i n v o i c e s _ f o l d e r . o p e r a t i n g _ u n i tI SN O TN U L LT H E N I F: i n v o i c e s _ f o l d e r . l i a b i l i t y _ a c c o u n tI SN O TN U L LT H E N B E G I N S E L E C To r g a n i z a t i o n _ i d I N T Ol _ o r g _ i d F R O Mh r _ o p e r a t i n g _ u n i t s W H E R Eo r g a n i z a t i o n _ n a m el i k e: i n v o i c e s _ f o l d e r . o p e r a t i n g _ u n i t A N Dm o _ g l o b a l . c h e c k _ a c c e s s ( o r g a n i z a t i o n _ i d )=' Y ' ; E X C E P T I O N W H E NT O O _ M A N Y _ R O W ST H E N f n d _ m e s s a g e . s e t _ n a m e ( ' F N D ' , ' M O _ S R C H _ M U L T _ O U _ F O U N D ' ) ; f n d _ m e s s a g e . e r r o r ; W H E NN O _ D A T A _ F O U N DT H E N f n d _ m e s s a g e . s e t _ n a m e ( ' F N D ' , ' M O _ S R C H _ N O _ O U _ F O U N D ' ) ; f n d _ m e s s a g e . e r r o r ; E N D ; l _ g r: =a p _ m o _ l o c a l _ c a c h e . g e t _ o r g _ a t t r i b u t e s ( l _ o r g _ i d ) ; : i n v o i c e s _ f o l d e r . c h a r t _ o f _ a c c o u n t s _ i d: =l _ g r . c h a r t _ o f _ a c c o u n t s _ i d ; f n d _ k e y _ f l e x . d e f i n e ( B L O C K = > ' I N V O I C E S _ F O L D E R ' , F I E L D = > ' L I A B I L I T Y _ A C C O U N T ' , D E S C R I P T I O N = > ' L I A B I L I T Y _ D E S C R I P T I O N ' , I D = > ' A C C T S _ P A Y _ C O D E _ C O M B I N A T I O N _ I D ' , A P P L _ S H O R T _ N A M E = > ' S Q L G L ' , C O D E = > ' G L # ' , N U M = > ' : i n v o i c s _ f o l d e r . C H A R T _ O F _ A C C O U N T S _ I D ' , V D A T E = > ' : I N V O I C E S _ F O L D E R . G L _ D A T E ' , V R U L E = > ' G L _ g l o b a l \ \ n D E T A I L _ P O S T I N G _ A L L O W E D \ \ n I \ \ n A P P L = S Q L A P ; N A M E = A P _ A L L _ P O S T I N G _ N A \ \ n Y \ \ 0 \ \ n S U M M A R Y _ F L A G \ \ n I \ \ n A P P L = S Q L A P ; N A M E = A P _ A L L _ P A R E N T _ F L E X _ N A \ \ n N \ \ 0 G L _ A C C O U N T \ \ n G L _ A C C O U N T _ T Y P E \ \ n I \ \ n N A M E = A P _ A L L _ O N L Y _ L I A B \ \ n L ' , R E Q U I R E D = > ' N ' ) ; f n d _ f l e x . e v e n t ( ' P R E Q U E R Y ' ) ; E N DI F ; E N DI F ; E X C E P T I O N W H E Nl _ n o _ o u _ f o u n dT H E N N U L L ; W H E NO T H E R ST H E N R A I S EF O R M _ T R I G G E R _ F A I L U R E ; E N D ;

For master-detail blocks, that include the accounting flexfield in both master and detail blocks, the pre-query trigger must call the key flexfields in the master block and not in the detail block. However, the pre-query trigger in the detail block must have the code to update the block's chart of accounts ID and call the fnd_flex.event as shown in the following code: Block Level Pre-Query trigger
I F( : < y o u rb l o c kn a m e . o r g _ i d >I SN O TN U L L )A N D ( : < y o u rb l o c kn a m e . o p e r a t i n g _ u n i t >I SN O TN U L L )T H E N I F: < b l o c kn a m e . o r g _ i d >< >n v l ( : < p a r a m e t e r . o l d _ o r g _ i d > ,9 9 )T H E N l _ g r: =< > _ M O _ l o c a l _ c a c h e . g e t _ o r g _ a t t r i b u t e s ( : < > . o r g _ i d ) ; : < b l o c kn a m e > . c h a r t _ o f _ a c c o u n t _ i d: =l _ g r . c h a r t _ o f _ a c c o u n t _ i d ; f n d _ f l e x . e v e n t ( ' P r e Q u e r y ' ) ; E N DI F ; E N DI F ;

Descriptive Flexfields Descriptive flexfield segments have global or operating unit specific information. The descriptive flexfield contents must be cleared when changing the Operating Unit field. You must modify the value sets and default value for the descriptive segments based on multiple organization views (single organization or reference views) to perform the following: Do not use the multiple organizations temporary table directly in the SQL query. Instead, use the PL/SQL functions to check the operating unit access and obtain the operating unit information. Handle ORG predicate for views that depend on tables that include the ORG_ID as the composite or driving key. Rewrite SQL joins with two or more views to use one secured synonym based on the driving table for the query and the remaining views replaced by _ALL tables.

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

37/59

4/25/13

tables. Add form block ORG_ID reference in the where clause to synchronize the data with the selected or derived operating unit.

Document 420787.1

Handle Operating Unit value change The user can change the operating unit anytime before committing the record to the database. The Operating Unit field is disabled after committing the record to the database and prevents users from updating the record. Post-Insert Trigger of Operating Unit field Block
a p p _ i t e m _ p r o p e r t y . s e t _ p r o p e r t y ( ' B L O C K _ N A M E . O P E R A T I N G _ U N I T ' ,E N A B L E D , P R O P E R T Y _ O F F ) ;

The Operating Unit field must not be enabled for the queried records. Post-Query Trigger of Operating Unit field Block
a p p _ i t e m _ p r o p e r t y . s e t _ p r o p e r t y ( ' B L O C K _ N A M E . O P E R A T I N G _ U N I T " ,E N A B L E D , P R O P E R T Y _ O F F ) ;

When-New-Record-Instance Trigger of Operating Unit field Block


I F: s y s t e m . r e c o r d _ s t a t u s=' Q U E R Y 'T H E N a p p _ i t e m _ p r o p e r t y . s e t _ p r o p e r t y ( ' B L O C K _ N A M E . O P E R A T I N G _ U N I T ' ,E N A B L E D , P R O P E R T Y _ O F F ) ; E L S E a p p _ i t e m _ p r o p e r t y . s e t _ p r o p e r t y ( ' B L O C K _ N A M E . O P E R A T I N G _ U N I T ' ,E N A B L E D , P R O P E R T Y _ O N ) ; E N DI F ;

If the user changes the operating unit when entering transactions, before committing the record to the database, then the fields are either cleared or a message appears requesting the user to clear the record or form depending on the number of operating unit specific fields in the form. The product team can set the same property in the 'ON-COMMIT' trigger. If the database fails to commit, then the records must be rolled back and the system administrator must fix the issue. Drill down Access When drilling down one form to another, in a product or between products that use different or same security, access is limited to the transaction that the user drills down and the query returns the drilled down transaction ID. The user can query only the transaction in the same or different operating unit. You must set the current organization when drilling down using the following API, so that synonyms return data:
m o _ g l o b a l . s e t _ p o l i c y _ c o n t e x t ( ' S ' ,: p a r a m e t e r . o r g _ i d )

For example, in the Invoice Overview form when drilling to the Suppliers form, the Suppliers form must display only the supplier in the invoice and the site. If the supplier has sites in different operating units, they must not be displayed and the drill down must confine to supplier and supplier site ID. If APIs are used in the drilled down form, you must invoke mo_global.init routine to initialize the global temporary table, as some APIs depend on the data in the temporary table. Synchronization of Master-Detail Blocks You must refer the detail block base table to use the unsecured _ALL table instead of the secured synonym for a master-detail relationship form that contains two blocks in the same window and the operating unit context in the master block. Otherwise, synchronization errors appear when navigating from one record to another in the master block when the records are present in different operating units. Oracle does not recommend that you set the policy context for the current organization in the pre-query trigger of the detail block. Delete Records Behavior When you enter information for different operating units, delete one record and then save, the cursor moves to the next record, which could apply to a different operating unit. However, the record is not deleted unless you code the ON-DELETE trigger to delete the record using the unsecured ALL table. Oracle does not recommend that you set the policy context in pre and post delete triggers to workaround this problem, for performance issues. Remove NVL function for ORG_ID and CLIENT_INFO reference You must NOT refer to CLIENT_INFO logic in the forms code or in the PL/SQL packages. You must also remove the NVL function for ORG_ID, since multiple organizations is mandatory for Release 12.

Enhancements to Reports
Overview You must remove references of CLIENT_INFO and NVL function to the 'ORG_ID' column in the reports. Single Organization Reports The operating unit mode for single organization reports are flagged as 'SINGLE' in the Define Concurrent Programs page. The parameter Operating Unit is available for single request and request sets. You cannot enter any value in this field if the Operating Unit mode is Multiple or none. When submitting the report, the concurrent program captures the current organization specified in Operating Unit parameter.

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

38/59

4/25/13

concurrent program captures the current organization specified in Operating Unit parameter. Cross Organization Reports

Document 420787.1

The Operating Unit mode for cross organization reports are flagged as 'MULTIPLE' in the Define Concurrent Programs page. At runtime, multiple organizations initialization populates the temporary table with one or multiple operating units depending on the access control status of the product that owns the cross organization report.

Enhancements to Concurrent Programs


Overview This section describes the changes for single and multiple organization concurrent programs. Single Organization Concurrent Programs The Operating unit mode for single organization concurrent programs is flagged as 'SINGLE' in the Define Concurrent Programs form. The special parameter Operating Unit is available for a single request as well as request sets. The operating unit is a required field and the default value is derived from the MO_UTILS.get_default_org_id() API. The enhancement ER 2420755 populates the multiple organizations temporary table MO_GLOB_ORG_ACCESS_TMP when the user selects the single organization concurrent program. You must explicitly call multiple organizations initialization as multiple organizations is not initialized when opening forms or web pages. The multiple organizations initialization routine populates the temporary table depending on the application that owns the concurrent program. When a user selects an operating unit, Oracle Applications invokes the Multiple Organizations API MO_GLOBAL.set_policy_context() to set the VPD policy context and ensures that a simple equality predicate is used for the policy function and the organization specific value sets (based on secured synonyms) returns data without any changes to the code. When you submit the concurrent program, Oracle Applications captures the organization that is specified in the Operating Unit parameter and populates the FND_REQUESTS table. When executing the concurrent request, Oracle Applications calls the MO_GLOBAL.set_policy_context() API to initialize the temporary table. Note: Oracle Applications provides the ability to pass the current organizations to populate fnd_requests.submit_request() API for single organization concurrent programs submitted from transaction windows. The details of invoking the fnd_request.submit_request() are documented later. Do not refer to CLIENT_INFO logic and remove the NVL function for ORG_ID in the concurrent programs.

Enhancements to Public APIs


This section describes the changes to Public APIs. Public APIs must consider operating unit as an input parameter to the API. Generally, the Multiple Organizations API and MO_GLOBAL.init('<ACCESS_MODE') ACCESS_MODE is S or M must be executed before executing the public API when executing from SQL*Plus or any other tools and when multiple organizations is not initialized,. Multiple organizations is initialized when APIs are invoked through the user interface. A new API, MO_GLOBAL.validate_orgid_pub_api, is available to meet the following requirements: 1. Standardize validation logic. 2. Backward compatibility for public APIs to use the MO: Operating Unit profile option if customers choose not to enable the access control feature. Product teams call this API in the public APIs (for public APIs only) to handle the validations by the central routine, which reduces the effort to modify APIs for the development team. The APIs validate the value of the org_id against the value in the MO: Operating Unit profile option without executing the multiple organizations initialization (mo_global.init). This API allows customers to continue using the public APIs without calling MO_GLOBAL.INIT in Release 12, if they choose not to enable the access control feature. Public APIs should conform to the following rules: Do not use the multiple organizations temporary table directly in the SQL query. Rewrite the SQL joins with two or more views to use just one secured synonym depending on the driving table for the query and replace the remaining views by _ALL tables. Add the ORG_ID to the WHERE clause of the SQL to avoid cartesian joins for tables that include ORG_ID the composite or driving key. Provide usage of group APIs to the owner of public APIs to product teams IF the uptake team is not secure with multiple organizations or the user cannot access to the ORG_ID context that is passed into the API. Group APIs must not refer to multiple organizations synonyms or functions depending on multiple organizations temporary table. Accept value from the MO: Operating Unit profile option if MO: Security Profile is not set and the MO_GLOBAL.init is not executed for backward compatibility. Add ORG_ID Parameter Public APIs must allow ORG_ID as a parameter for callers to manipulate organization-striped entities. If a user having access to multiple operating units executes a Public API, then the API either takes the default operating unit specified in the MO: Default Operating Unit profile option or explicitly passes the operating unit value. Note: The operating unit is passed only if the operating unit is different from the operating unit specified in the MO: Default Operating Unit profile option.

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

There are multiple ways to pass the ORG_ID as a parameter:

39/59

4/25/13
There are multiple ways to pass the ORG_ID as a parameter:

Document 420787.1

Expose the ORG_ID on the record type for an API that takes in a record type parameter. This propagates the ORG_ID to low level APIs that work on the record. Add a new parameter to the API to take multiple record types that map to multiple parent-child entities, which are created in the same operating unit. The record type needs additional validation to expose the operating unit by consistently passing the ORG_ID to various record types. Example: The Trading Community Architecture package HZ_CUST_ACCOUNT_SITE_V2PUB provides APIs to create and update Customer Account Sites. These APIs work on the record type HZ_CUST_ACCOUNT_SITE_V2PUB.cust_acct_site_rec_type. You must modify the API to add an ORG_ID attribute to the record type as follows:
H Z _ C U S T _ A C C O U N T _ S I T E _ V 2 P U B . c u s t _ a c c t _ s i t e _ r e c _ t y p e ( . . . O R G _ I D N U M B E R ) ;

Get Current ORG_ID Several public APIs are used in user interfaces and SQL*Plus or other third party tools. An example is the Receivables APIs. In the Receipt Workbench, the current organization is set in the form triggers and the ORG_ID is not passed as an input. The ORG_ID is a mandatory input for public APIs and if not passed, it defaults from the MO: Default Operating Unit, if valid, with the MO: Security Profile. Default ORG_ID Similar to the user interfaces that are enabled with the multiple organizations access control feature, the public APIs must default the operating unit specified in the MO: Default Operating Unit profile option. When passing the operating unit value to a public API, the value must override the default value. If the operating unit value is checked for its current organization and the operating unit is defaulted when the operating unit parameter is blank and current organization is not set then common API MO_UTILS.get_default_org_id defaults the operating unit in such situations. If you do not pass the ORG_ID value, do not set either the MO: Security Profile or MO: Default Operating Unit profile options, and set only the MO: Operating Unit profile option, then the value in the MO: Operating Unit becomes the default value for public APIs. The Multiple Organizations API checks the MO: Security Profile or MO: Default Operating Unit and the MO: Operating Unit if access control is on. The utility returns a null value if you do not specify a value in the MO: Default Operating Unit profile option, which is not mandatory. The MO_GLOBAL.get_valid_org, org_id parameter returns a default value. Validate ORG_ID input You must supply an operating unit to a public API by passing the operating unit as a parameter, default the operating unit from the current organization or from the MO: Default Operating Unit profile option. The RDBMS defaulting for ORG_ID column for the multiple organizations tables is removed. To prevent inserting records with no ORG_ID, the operating unit value is mandatory in public APIs otherwise, you end up inserting data but cannot query the data, as the multiple organizations security policy will not allow you to query any global data (NULL ORG_ID value). In the user interface pages, the operating unit list of values displays valid values to the user. The public APIs must validate the operating unit to confirm that the caller can access the operating unit that the user passes as a parameter. You must validate the valid ORG_ID before validating any product specific validations in a public API logic flow. The Multiple Organizations API MO_GLOBAL.get_valid_org determines the valid ORG_ID in the following hierarchy. Public APIs call the common utility MO_Global.get_valid_org() to ensure that the ORG_ID is NOT NULL and that the user can access the organization. 1. Uses the ORG_ID if passed 2. Searches for the current organization value if the ORG_ID is not passed 3. Searches for the default operating unit if ORG_ID is not passed and current organization is not set. The MO: Default Operating Unit value must be a valid value in MO: Security Profile. 4. Calls the check_valid_org() API to validate ORG_ID is valid. This API returns a NULL value for the ORG_ID and displays a message if the ORG_ID is NULL or cannot default from the current organization or the default operating unit profile option and if the ORG_ID does not exist in the Multiple Organizations temporary table, which initializes based on the MO: Security Profile or MO: Operating Unit profile option, the API returns a NULL value for the ORG_ID and displays a message that the value is INVALID. If the MO: Security Profile is not defined and current_org_id context is not set, the value in MO: Operating Unit is used as the default value for backward compatibility. Since ORG_ID is a key attribute, a public API must raise an exception and do no processing if the validation fails. Product teams may also invoke the MO_GLOBAL.validate_orgid_pub_api in addition to the coding validation logic as shown above in a public API. The following is the API specification: 1. ORG_ID IN OUT NUMBER 2. ERROR_MESG_SUPPR IN VARCHAR2(1) DEFAULT N 3. Status OUT VARCHAR2(1) The Org_ID parameter accepts a value passed into public APIs. Leave it null if no value is passed, and we try to derive a default value, if possible. A default org_id value is returned if the system derives a value. If the validation fails, the validate_orgid_pub_api raises an application error. However, the product team may choose to pass Y to ERROR_MESG_SUPPR to prevent the validate_org_id_pub_api from raising an application error and allow custom error handling. By default, this option is N. The status value is S (Success) or F (Fail). Remember that the API has build-in logic to validate the org_id value if the MO_GLOBAL.init procedure is not executed for a database session. Therefore, it must be used only in public APIs. Using this API at other situations may result in compromising data access security.

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

40/59

4/25/13
Note:

Document 420787.1

The current organization or the defaulting utility can return a null value. Therefore, the Multiple Organizations API validates the API values and the value that the caller passes.

Create Operations Create Operations must validate the ORG_ID by calling the common validation utility. Example: TCA API HZ_CUST_ACCOUNT_SITE_V2PUB.Create_Cust_Acct_Site indirectly calls the validation procedure HZ_ACCOUNT_VALIDATE_V2PUB.validate_cust_acct_site()???.This procedure validates the ORG_ID as shown:
l _ o r g _ i d : = M O _ G L O B A L . g e t _ v a l i d _ o r g ( p _ c u s t _ a c c t _ s i t e _ r e c . o r g _ i d ) ; I Fl _ o r g _ i di sN U L LT H E N x _ r e t u r n _ s t a t u s: =F N D _ A P I . G _ R E T _ S T S _ E R R O R ; R A I S EF N D _ A P I . G _ E X C _ E R R O R ; E N DI F ;

Attention: Capture the function output in a new variable since the Multiple Organizations API may return NULL if the ORG_ID value is INVALID.

Update Operations Update Operations must validate the ORG_ID using the same rules as create operations. This means that the update APIs must include the ORG_ID as the parameter where ever needed. The following rules apply for update operations: 1. 2. 3. 4. Use Use Use Call the the the the ORG_ID if explicitly passed. current org value if ORG_ID is not passed. default operating unit if the ORG_ID is not passed and current organizations is not set. check_valid_org() API to validate the ORG_ID.

Call the Multiple Organizations API MO_GLOBAL.get_valid_org() to execute steps 1 to 4. Use this routine to validate the ORG_ID before any further process. Example: The TCA package HZ_CUST_ACCOUNT_SITE_V2PUB contains APIs to update the customer account sites. These APIs work on the record type HZ_CUST_ACCOUNT_SITE_V2PUB.cust_acct_site_rec_type. Modify this API to add an ORG_ID attribute to the record type as shown in following code (similar to the create operations)
H Z _ C U S T _ A C C O U N T _ S I T E _ V 2 P U B . c u s t _ a c c t _ s i t e _ r e c _ t y p e ( . . . O R G _ I D N U M B E R ) ;

Before the TCA API, HZ_CUST_ACCOUNT_SITE_V2PUB.update_cust_acct_site calls the validation procedure, the ORG_ID must be validated by calling the MO_GLOBAL.get_valid_org() API. If the ORG_ID is valid, then the ORG_ID restricts the data as additional filter in the query (based on _ALL tables). The processing stops if the ORG_ID is invalid. These queries are not based on secured synonyms, though the current organization is set to minimize performance overhead. The following example describes setting the current organization as discussed in the section Set Policy Context.
B E G I N l _ o r g _ i d : = M O _ G L O B A L . g e t _ v a l i d _ o r g ( p _ c u s t _ a c c t _ s i t e _ r e c . o r g _ i d ) ; I Fl _ o r g _ i di sN U L LT H E N x _ r e t u r n _ s t a t u s: =F N D _ A P I . G _ R E T _ S T S _ E R R O R ; R A I S EF N D _ A P I . G _ E X C _ E R R O R ; E N DI F ; M O _ G L O B A L . s e t _ p o l i c y _ c o n t e x t ( S , l _ o r g _ i d ) ; S E L E C TR O W I D ,O B J E C T _ V E R S I O N _ N U M B E R I N T Ol _ r o w i d ,l _ o b j e c t _ v e r s i o n _ n u m b e r F R O MH Z _ C U S T _ A C C T _ S I T E S _ A L L W H E R EC U S T _ A C C T _ S I T E _ I D = p _ c u s t _ a c c t _ s i t e _ r e c . c u s t _ a c c t _ s i t e _ i d A N DO R G _ I D=l _ o r g _ i d ; F O RU P D A T EN O W A I T ; I FN O T( (p _ o b j e c t _ v e r s i o n _ n u m b e rI SN U L LA N D l _ o b j e c t _ v e r s i o n _ n u m b e rI SN U L L)O R (p _ o b j e c t _ v e r s i o n _ n u m b e rI SN O TN U L LA N D l _ o b j e c t _ v e r s i o n _ n u m b e rI SN O TN U L LA N D p _ o b j e c t _ v e r s i o n _ n u m b e r= l _ o b j e c t _ v e r s i o n _ n u m b e r)) T H E N F N D _ M E S S A G E . S E T _ N A M E ( ' A R ' ,' H Z _ A P I _ R E C O R D _ C H A N G E D ') ; F N D _ M E S S A G E . S E T _ T O K E N (

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

41/59

4/25/13
F N D _ M E S S A G E . S E T _ T O K E N ( ' T A B L E ' ,' h z _ c u s t _ a c c t _ s i t e s ') ; F N D _ M S G _ P U B . A D D ; R A I S EF N D _ A P I . G _ E X C _ E R R O R ; E N DI F ;

Document 420787.1

p _ o b j e c t _ v e r s i o n _ n u m b e r : =N V L ( l _ o b j e c t _ v e r s i o n _ n u m b e r ,1)+1 ; E X C E P T I O N W H E NN O _ D A T A _ F O U N DT H E N F N D _ M E S S A G E . S E T _ N A M E (' A R ' ,' H Z _ A P I _ N O _ R E C O R D ') ; F N D _ M E S S A G E . S E T _ T O K E N (' R E C O R D ' ,' c u s t o m e ra c c o u n ts i t e ') ; F N D _ M E S S A G E . S E T _ T O K E N (' V A L U E ' , N V L ( T O _ C H A R ( p _ c u s t _ a c c t _ s i t e _ r e c . c u s t _ a c c t _ s i t e _ i d) ,' n u l l ')) ; F N D _ M S G _ P U B . A D D ; R A I S EF N D _ A P I . G _ E X C _ E R R O R ; E N D ;

Set Policy Context Public APIs must accept the ORG_ID value and must be coded using _ALL tables without depending on the current organization mechanism. However, some products, such as Receivables, share the code and are called directly from third party tools. These products must support the current organization in public APIs, which necessitates the product APIs to set the current organization, though the product code depends on the _ALL tables. If the ORG_ID value is mandatory, then the products that need the current organization must set the ORG_ID and not enforce the products to set it. However, this is not the right solution as user interface and public APIs must support the default operating unit. Therefore, the public APIs first validates the ORG_ID and then sets the current organization policy for single mode operations as shown in the following code:
B E G I N l _ o r g _ i d : = M O _ G L O B A L . g e t _ v a l i d _ o r g ( p _ c u s t _ a c c t _ s i t e _ r e c . o r g _ i d ) ; I Fl _ o r g _ i di sN U L LT H E N x _ r e t u r n _ s t a t u s: =F N D _ A P I . G _ R E T _ S T S _ E R R O R ; R A I S EF N D _ A P I . G _ E X C _ E R R O R ; E N DI F ; M O _ G L O B A L . s e t _ p o l i c y _ c o n t e x t ( ' S ' , ' l _ o r g _ i d ) ; . . . E N D ;

Attention: Multiple Organizations API MO_GLOBAL.set_policy_context compares the current organization with the new organization value passed in the API. If the value is the same, the API does not reset the application context for access mode and current organization, otherwise it resets the application context. This is done for performance reasons as resetting the context invalidates the security policy predicate, which must be re-parsed again. This operation must be avoided. Products that code new public APIs or own public APIs not shared in the user interface layer where the current organization is set must rewrite the code to use _ALL tables for efficient operations. When processing records in a batch that contain different operating units records, it is better to sort the data by operating unit and then process the data belonging to the same organization and reset the context.

Add ORG_ID Filters to Foreign Key Validations top org-striped entities When creating or updating an entity, a Public API must validate the foreign keys (to org-striped entities) that point to entities in the same organization as the original entity. The foreign key validates the org-striped views. With multiple organizations access control, when querying the organization, the queries may go against the _ALL entities to reduce the overhead of the security policy though the current organization is set in public APIs and this necessitates adding the ORG_ID filters to avoid cartesian joins for tables that include the ORG_ID as the composite unique index. Example: TCA provides public APIs to create and maintain Customer Site Uses. Users can specify an Order Type on a Customer Site Use and this Order Type must exist in the same operating unit as the Customer Site Use. Therefore, the Order Type query validates and filters the ORG_ID that the Site Use belongs to or is created in. As the ORG_ID is validated using the common validation utility, the query works on the _ALL table (with the additional ORG_ID filter) and not on the synonym. Modify the low-level validation procedure that validates the Order Type to include an additional ORG_ID parameter.
P R O C E D U R Ec h e c k _ o r d _ t y p e( p _ c o l u m n I NV A R C H A R 2 , p _ c o l u m n _ v a l u e I NV A R C H A R 2 , p _ o r g _ i d I NN U M B E R , x _ r e t u r n _ s t a t u s I NO U TV A R C H A R 2 )I S B E G I N S E L E C T Y I N T Ol _ d u m m y F R O MO E _ T R A N S A C T I O N _ T Y P E S _ A L Lo t W H E R Eo t . o r d e r _ t y p e _ i d=p _ c o l u m n _ v a l u e A N Do t . t r a n s a c t i o n _ t y p e _ c o d e=' O R D E R '

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

42/59

4/25/13

A N Do t . t r a n s a c t i o n _ t y p e _ c o d e=' O R D E R ' -o n l ys e l e c to r d e rt y p e s A N Do t . O R G _ I D=p _ o r g _ i d A N Ds y s d a t eB E T W E E N n v l ( o t . s t a r t _ d a t e _ a c t i v e ,s y s d a t e ) A N Dn v l ( o t . e n d _ d a t e _ a c t i v e ,s y s d a t e ) ;

Document 420787.1

E N D ;

You must pass the ORG_ID to the modified validation procedure:


c h e c k _ o r d _ t y p e( p _ c o l u m n = > o r d e r _ t y p e _ i d , p _ c o l u m n _ v a l u e = >p _ c u s t _ s i t e _ u s e _ r e c . o r d e r _ t y p e _ i d , p _ o r g _ i d = >p _ c u s t _ s i t e _ u s e _ r e c . o r g _ i d , x _ r e t u r n _ s t a t u s = >x _ r e t u r n _ s t a t u s) ;

Add ORG_ID Filters to Enforce Uniqueness Certain attributes (or combination of attributes) on a record must be unique in an operating unit. The entity level validations that enforce this constraint work against the org-striped views. With multiple organizations access control, the validation queries go against the _ALL tables (with the additional ORG_ID filter) instead of the synonym, though the current organization is set in Public APIs. The ORG_ID is validated upstream and the ORG_ID filters are added to avoid cartesian joins for tables that include ORG_ID as the composite or driving key. Example: TCA APIs checks if an account has one account site pointing to a given party site in an operating unit when creating Customer Account Sites. The query enforcing this constraint filters the ORG_ID and works in the _ALL table.
B E G I N S E L E C T' Y ' I N T Ol _ d u m m y F R O MH Z _ C U S T _ A C C T _ S I T E S _ A L L W H E R EC U S T _ A C C O U N T _ I D=p _ c u s t _ a c c t _ s i t e _ r e c . c u s t _ a c c o u n t _ i d A N DP A R T Y _ S I T E _ I D=p _ c u s t _ a c c t _ s i t e _ r e c . p a r t y _ s i t e _ i d A N DO R G _ I D=p _ c u s t _ a c c t _ s i t e _ r e c . o r g _ i d A N DR O W N U M=1 ; F N D _ M E S S A G E . S E T _ N A M E ( ' A R ' ,' H Z _ A P I _ D U P L I C A T E _ C O L U M N ') ; F N D _ M E S S A G E . S E T _ T O K E N ( ' C O L U M N ' ,' c u s t _ a c c o u n t _ i d-p a r t y _ s i t e _ i d ') ; F N D _ M S G _ P U B . A D D ; x _ r e t u r n _ s t a t u s: =F N D _ A P I . G _ R E T _ S T S _ E R R O R ; E X C E P T I O N W H E NN O _ D A T A _ F O U N DT H E N N U L L ; E N D ;

Modify Table Handlers With multiple organizations access control, the default values of the ORG_ID column (using CLIENT_INFO org context) in the Multiple Organizations tables are removed. Therefore, you must explicitly pass the ORG_ID value to the table handlers otherwise you end up inserting data but cannot query again, as the Multiple Organizations security policy will not allow you to query any global data (NULL ORG_ID value). As the ORG_ID is validated upstream and explicitly specified, you must insert the insert handlers in the _ALL entity. The insert handler takes an additional parameter of the ORG_ID with the value specified as NO DEFAULT. Example: Add the following parameter to the procedure Insert_Row() procedure:
X _ O R G _ I D I N N U M B E R

The insert handler inserts the ORG_ID into the _ALL table and explicitly passes the ORG_ID value as shown in the following code:
I N S E R TI N T OH Z _ C U S T _ A C C T _ S I T E S _ A L L( .. . . A P P L I C A T I O N _ I D , O R G _ I D ) V A L U E S . . .. . .. . . D E C O D E (X _ A P P L I C A T I O N _ I D ,F N D _ A P I . G _ M I S S _ N U M ,N U L L ,X _ A P P L I C A T I O N _ I D) , X _ O R G _ I D)R E T U R N I N G C U S T _ A C C T _ S I T E _ I D. . . .

Update handlers can go against _ALL tables, as a public API must validate the existing record that is updated for a secured synonym (with no organization filter). Select and Delete table handlers works on the secured synonyms if they do not validate upstream. While using secured synonyms, yo must rewrite the SQL to use one secured synonym and the _ALL tables reference for the rest. You must add the ORG_ID filter to the WHERE clause of the SQL query to avoid cartesian joins for tables that include the ORG_ID as a composite or driving key. Prevent ORG_ID from Updating You cannot update the operating unit (ORG_ID) field in user interfaces after committing the record as public APIs prevent the caller from updating the ORG_ID value for existing records.

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

43/59

4/25/13

Document 420787.1

The public APIs validates whether the ORG_ID is valid and the caller can access the updated record. This query works on the _ALL table and uses the ORG_ID filter. Example: When the TCA API HZ_CUST_ACCOUNT_SITE_V2PUB.update_cust_acct_site calls the validation procedure, it calls MO_GLOBAL.get_valid_org() API to validate the ORG_ID. If ORG_ID is invalid, then processing should stop. If the ORG_ID is valid, then it must use an additional filter in the query (based on _ALL tables) to restrict the data. Such queries must not be based on secured synonyms though the current organization is set due to the security policy overhead.
B E G I N l _ o r g _ i d : = M O _ G L O B A L . g e t _ v a l i d _ o r g ( p _ c u s t _ a c c t _ s i t e _ r e c . o r g _ i d ) ; I Fl _ o r g _ i di sN U L LT H E N x _ r e t u r n _ s t a t u s: =F N D _ A P I . G _ R E T _ S T S _ E R R O R ; R A I S EF N D _ A P I . G _ E X C _ E R R O R ; E N DI F ; M O _ G L O B A L . s e t _ p o l i c y _ c o n t e x t ( S , l _ o r g _ i d ) ; S E L E C TR O W I D ,O B J E C T _ V E R S I O N _ N U M B E R I N T Ol _ r o w i d ,l _ o b j e c t _ v e r s i o n _ n u m b e r F R O MH Z _ C U S T _ A C C T _ S I T E S _ A L L W H E R EC U S T _ A C C T _ S I T E _ I D = p _ c u s t _ a c c t _ s i t e _ r e c . c u s t _ a c c t _ s i t e _ i d A N DO R G _ I D=l _ o r g _ i d ; F O RU P D A T EN O W A I T ; I FN O T( (p _ o b j e c t _ v e r s i o n _ n u m b e rI SN U L LA N D l _ o b j e c t _ v e r s i o n _ n u m b e rI SN U L L)O R (p _ o b j e c t _ v e r s i o n _ n u m b e rI SN O TN U L LA N D l _ o b j e c t _ v e r s i o n _ n u m b e rI SN O TN U L LA N D p _ o b j e c t _ v e r s i o n _ n u m b e r=l _ o b j e c t _ v e r s i o n _ n u m b e r)) T H E N F N D _ M E S S A G E . S E T _ N A M E (' A R ' ,' H Z _ A P I _ R E C O R D _ C H A N G E D ') ; F N D _ M E S S A G E . S E T _ T O K E N (' T A B L E ' ,' h z _ c u s t _ a c c t _ r e l a t e ') ; F N D _ M S G _ P U B . A D D ; R A I S EF N D _ A P I . G _ E X C _ E R R O R ; E N DI F ; p _ o b j e c t _ v e r s i o n _ n u m b e r: =N V L (l _ o b j e c t _ v e r s i o n _ n u m b e r ,1)+1 ; E X C E P T I O N W H E NN O _ D A T A _ F O U N DT H E N F N D _ M E S S A G E . S E T _ N A M E (' A R ' ,' H Z _ A P I _ N O _ R E C O R D ') ; F N D _ M E S S A G E . S E T _ T O K E N (' R E C O R D ' ,' c u s t o m e ra c c o u n tr e l a t e ') ; F N D _ M E S S A G E . S E T _ T O K E N (' V A L U E ' , N V L (T O _ C H A R (p _ c u s t _ a c c t _ r e l a t e _ r e c . c u s t _ a c c o u n t _ i d) ,' n u l l ')| |' , '| |N V L ( T O _ C H A R (p _ c u s t _ a c c t _ r e l a t e _ r e c . r e l a t e d _ c u s t _ a c c o u n t _ i d) ,' n u l l ')) ; F N D _ M S G _ P U B . A D D ; R A I S EF N D _ A P I . G _ E X C _ E R R O R ; E N D ;

Use Secured Synonyms The API must go against secured synonyms when populating a product specific cache for system_parameters (that are org-striped) if there is NO additional ORG_ID filter. Note: Some foreign key validations continue to work similar to secured synonyms/reference views, as the synonyms/views have many product specific filters (other than the org_id) to protect you from the external products complexity. When using secured synonyms, you must rewrite the SQL to use one secured synonym and _ALL table references for the rest. You must add the ORG_ID joins to the WHERE clause of the SQL statement to avoid cartesian joins, for Multiple Organizations tables that include the ORG_ID as a composite or driving key.

Enhancements to Workflows
This section describes the changes to workflows. With multiple organizations access control, workflow processes must set the current organization ID instead of the CLIENT_INFO organization context. The workflow activities are processed for each record and the ORG_ID of the item key sets the Multiple Organizations application contexts the access mode and current organization ID which are used in the simple equality predicate of the Multiple Organizations security policy. The access must be validated at the begriming when processing the workflow using the multiple organizations profile options: MO: Security Profile, MO: Default Operating Unit, and not MO: Operating Unit. This behavior is limited to workflows only, as administrators and approvers must be able to process a workflow, although they have access privileges different from the initiator. Before Release 12, the workflow processes initialize the organization context (CLIENT_INFO) in the following methods: Set context manually Set context using callback functions Setting context manually is not very efficient as it sets the context in every activity. Callback functions are executed once per session per item key and are more efficient. The callback functions checks that the organization context the user sets and the organization that the workflow must process are the same. If same, then the workflow proceeds with the process otherwise, the workflow process resets the context that runs in the background engine. However, the workflow process does not reset the context for foreground jobs, but sets the process to a deferred mode so that the background engine processes the job later. Attention:

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

44/59

4/25/13
Attention:

Document 420787.1
With multiple organizations access control, use callback functions to set the current organization ID and not the CLIENT_INFO organization context.

Set Context using Callback Functions Oracle Workflow supports the callback function to reset or test item type context information. Oracle Workflow calls the callback function using the following command. SET_CTX Establish context information for an item type and item key combination which the function activity in the item type must execute. The workflow engine calls the callback function with this command each time it encounters a new item type and item key combination, to ensure the correct context information is always set. TEST_CTX Validate the current database session context before the workflow engine executes an activity. For example, when the user creates a new expense report in ORG_ID 204, the workflow engine executes the Expenses workflow callback function in the TEST_CTX mode. If the context information is correct, then the callback function returns TRUE, and the workflow engine does not reset the context. If the context information is incorrect, for example, if the expense report is approved in ORG_ID 458, the callback function calls the SET_CTX mode and resets the context information to CLIENT_INFO organization context. However, if the workflow process is executed synchronously, the callback function does not call the SET_CTX mode when the TEST_CTX returns FALSE and the process is set to deferred mode and executed asynchronously by the background engine. With multiple organizations access control, you must set the current organization ID and not the CLIENT_INFO org context. You must derive the current organization ID from item keys. Do not rely on MO: Security Profile, MO: Default Operating Unit, and MO: Operating Unit profile options when setting the organization context because the operating unit must be validated before initiating the workflow. SET_CTX Mode In SET_CTX mode, call the Multiple Organizations API MO_GLOBAL.set_policy_context() to set the organization context to single and the current organization ID in function activities. Pseudo Code SET_CTX Mode
B E G I N . .R e t r i e v eO r gI do fI t e mK e y ; I F( p _ c o m m a n d=' S E T _ C T X 'T H E N m o _ g l o b a l . s e t _ p o l i c y _ c o n t e x t ( g _ a c c e s s _ m o d e= > ' S ' , p _ o r g _ i d = > O r gI d ; E N DI F ; E N D ;

TEST_CTX Mode In TEST_CTX mode, check the values of access mode and the current organization ID. If the values are not set, you return FALSE to set the application contexts by calling the SET_CTX function, otherwise return TRUE to use the existing context values. Pseudo Code TEST_CTX Mode
B E G I N R e tr i v eO r gI do fI t e mK e y ; I F( p _ c o m m a n d=' T E S T _ C T X 'T H E N I F( N V L ( m o _ g l o b a l . g e t _ a c c e s s _ m o d e , ' N U L L ' )< >' S ' )O R ( N V L ( m o _ g l o b a l . g e t _ c u r r e n t _ o r g _ i d , 9 9 )< >O r gI d ) T H E N p _ r e s u l t: =' F A L S E ' ; E L S E p _ r e s u l t: =' T R U E ' ; E N DI F ; E N D ;

Access Multiple Operating Units Some workflow requires accessing multiple operating units to process a single transaction. When you set the current organization ID, the organization context is reset if the context is different from the previous transaction. Pseudo Code Get Order Lines
B E G I N l O p e r U n i t: =m o _ g l o b a l . g e t _ c u r r e n t _ o r g _ i d ; f o rl _ n e x t _ r e cI Nc _ w o r k _ o r d e r _ e l i g i b l eL O O P i f( l O p e r U n i t< >l _ n e x t _ r e c . o r g _ i d)t h e n f n d _ g l o b a l . a p p s _ i n i t i a l i z e ;( i fn e c e s s a r y ) m o _ g l o b a l . s e t _ p o l i c y _ c o n t e x t( p _ a c c e s s _ m o d e= >' S ' , p _ o r g _ i d= >l _ n e x t _ r e c . o r g _ i d ) ; e n di f ;

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

45/59

4/25/13
l O p e r U n i t: =l _ n e x t _ r e c . o r g _ i d ; . . . e n dl o o p ; E N D ;

Document 420787.1

Remove NVL Logic for ORG_ID and CLIENT_INFO reference Workflows must not refer to the CLIENT_INFO for org_id context in the code. The NVL function for the ORG_ID must be removed for better performance.

Enhancements to OA Framework Pages


The multiple organizations setup and transaction pages in OA Framework must expose the Operating Unit field. This allows users to select the operating unit and enter the setup or transaction for the operating unit and provide simple operating unit derivations from some attributes of the transaction, wherever possible. Product teams must change the setup and transaction pages for multiple organizations access control as described in the following sections. Attention: This document supplements the OA coding standards.

Multiple Organizations Initialization Every transaction that requires multiple organizations must call the Multiple Organizations initialization in the root Application Module (AM). Use the following declarative mechanism to initialize the multiple organizations settings for application teams to implement multiple organizations: 1. To enable multiple organizations for the root application module , go to the BC4J Application Module wizard - Properties section and specify the property as MULTIORG_ENABLED and value as either S (single operating unit mode) or M (Multiple operating unit mode). 2. Click Add, then Apply or OK. On specifying this property, the OA Framework automatically initializes the multiple organizations context at the following appropriate program event points: 1. When reserving or activating the application module. 2. When initializing or validating the Oracle Applications user session. You initialize the context once for each transaction and session and not instantiate for every page. If your transaction retains the root AM, then the above steps are the easiest to initialize multiple organizations. If a transaction has multiple pages and the root AM is not retained, then you must call the method OADBTransaction.setMultiOrgAccess to initialize the multiple organizations context to help the user select an operating unit for a transaction. If the operating unit the user selected must appear in the subsequent pages, then pass the curr_org_id to the page and use OADBTransaction.setMultiOrgPolicyContext method to set the operating unit context for the pages that need multiple organizations. Add Operating Unit Field Per the BLAF guidelines, the Operating Unit field is the first field in the page as the operating unit is the controlling field. You must add the operating unit and the organization ID (ORG_ID) fields to your page not expose the Operating Unit field for regions that are not needed and not display the organization ID field in any region. Please refer to the functional examples in Section 5.3.1 Recommendations for Operating Unit Field in OA Pages about regions that display the Operating Unit field. Use the attribute sets, provided for Operating Unit and Organization ID fields, to define these fields as shown: Operating Unit Field Details ID Item Style Attribute Set

OperatingUnit messageLovInput /oracle/apps/fnd/attributesets/HrOperatingUnits/OperatingUnitName_Transient Org Id Field Details Item Style

ID

Data Type

OrgId formValue NUMBER Create List of Values for Operating Unit Field You must attach a list of values (LOV) to the Operating Unit field by using the external LOV in /oracle/apps/fnd/multiorg/lov/webui/OperatingUnitsLovRN. The LOV mappings must be created as shown: Mapping for OperatingUnit Field LOV Region Item

ID

Return Item

Criteria Item

FromToOperatingUnit OUName

OperatingUnit OperatingUnit

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

46/59

4/25/13
Mapping for OrgID Field LOV Region Item Return Item OrgId

Document 420787.1

ID

ToOrganizationId OrganizationId

Default Operating Unit on Opening the Page You must default the operating unit (if set and valid) on the opening page by calling the Multi-Org java wrapper as shown. This method resides in the server side package as a method of the root Application Module. This method is executed before an operating unit is initialized. rootAMImpl
p u b l i cc l a s sE x p e n s e s A M I m p le x t e n d sO A A p p l i c a t i o n M o d u l e I m p l { p u b l i cv o i dg e t D e f a u l t O u ( )t h r o w sj a v a . s q l . S Q L E x c e p t i o n { O A D B T r a n s a c t i o n I m p lt r x= ( O A D B T r a n s a c t i o n I m p l ) g e t O A D B T r a n s a c t i o n ( ) ; N u m b e r [ ]d e f O r g I d={ n e wN u m b e r ( ) } ; S t r i n g [ ]d e f O u N a m e={ n e wS t r i n g ( ) } ; N u m b e r [ ]o u C o u n t={ n e wN u m b e r ( ) } ; t r y { M o U t i l s . g e t D e f a u l t O u ( t r x , d e f O r g I d , d e f O u N a m e , o u C o u n t ) ; } c a t c h( S Q L E x c e p t i o ns q l E ) { t h r o wO A E x c e p t i o n . w r a p p e r E x c e p t i o n ( s q l E ) ; } } / /P o p u l a t eO Ut r a n s a c t i o nv a l u ew i t hd e f a u l t / /R e n d e rO Ud e p e n d e n tf i e l d s . . . }

Handle Select/Derive Operating Unit feature Select Operating Unit: For page flows that support the select operating unit feature the dependent fields must appear after selecting the operating unit. Partial Page Rending (PPR) controls the behavior of the dependent fields. If the default operating unit is available, the Operating Unit field is populated and the dependent fields appear after opening the page. To enable PPR, you must create a special "application properties" view object and add it to your page's root Application Module. You must enable PPR on Operating Unit dependent fields, by specifying the property of the dependent fields. The following is an example of an initialization code that controls the appearance of the Operating Unit dependent fields in the Expense Entry page flow. The expense template field appears depending on the default operating unit. The method init is invoked from the ProcessRequest method within the Controller Object (CO).
p u b l i cv o i di n i t ( ) { O A V i e w O b j e c ta p p P r o p s V O= ( O A V i e w O b j e c t ) f i n d V i e w O b j e c t ( " G e n e r a l I n f o P V O 1 " ) ; i f( a p p P r o p s V O! =n u l l ) { / /I ft h eV Oa l r e a d yh a sar o w ,s k i pi t si n i t i a l i z a t i o n . i f( a p p P r o p s V O . g e t F e t c h e d R o w C o u n t ( )= =0 ) { a p p P r o p s V O . s e t M a x F e t c h S i z e ( 0 ) ; / /Y o um u s tc r e a t ea n di n s e r tar o wi nt h eV Ob e f o r ey o uc a n / /s t a r ts e t t i n gp r o p e r t i e s . a p p P r o p s V O . i n s e r t R o w ( a p p P r o p s V O . c r e a t e R o w ( ) ) ; / /S e tt h ep r i m a r yk e yv a l u ef o rt h i ss i n g l e r w oV O . O A R o wr o w=( O A R o w ) a p p P r o p s V O . f i r s t ( ) ; r o w . s e t A t t r i b u t e ( " R o w K e y " ,n e wN u m b e r ( 1 ) ) ; } h a n d l e O u C h a n g e E v e n t ( ( S t r i n g ) g e t O A D B T r a n s a c t i o n ( ) . g e t V a l u e ( " o u N a m e " ) ) ; } } p u b l i cv o i dh a n d l e O u C h a n g e E v e n t ( S t r i n go u ) { / /G e tt h es p e c i a l ,s i n g l e r o wa p p l i c a t i o np r o p e r t i e sa n dm a k e / /f i r s tr o wc u r r e n t O A V i e w O b j e c tv o= ( O A V i e w O b j e c t ) f i n d V i e w O b j e c t ( " G e n e r a l I n f o P V O 1 " ) ; O A R o wr o w=( O A R o w ) v o . f i r s t ( ) ; / /S e tt h ea p p l i c a t i o np r o p e r t yv a l u e sb a s e do nt h eP OA p p r o v a l

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

47/59

4/25/13

/ /S e tt h ea p p l i c a t i o np r o p e r t yv a l u e sb a s e do nt h eP OA p p r o v a l / /s t a t u sv a l u e . i f( o u = = n u l l ) { r o w . s e t A t t r i b u t e ( " M O _ O U _ S E L E C T E D _ R E N D E R E D _ E X P E N S E _ T E M P L A T E _ T E X T " , B o o l e a n . F A L S E ) ; } e l s e { r o w . s e t A t t r i b u t e ( " M O _ O U _ S E L E C T E D _ R E N D E R E D _ E X P E N S E _ T E M P L A T E _ T E X T " , B o o l e a n . T R U E ) ; } }

Document 420787.1

Derive Operating Unit: For pages that support derive operating unit feature, the Operating Unit specific fields appear with the operating unit depending on the attributes of the transaction. You must code these pages using PPR, so that when you select the operating unit the Operating Unit specific fields appear and vice versa. Setting the Policy Context Attention: You MUST NOT set the current org_id in the controller object code as shown for new OA Framework page flows. For new pages, you use the _ALL base tables and include the organization ID for the page (formValue bean) to restrict data to the operating unit that the user selects.

To save the existing page that works in the context of one operating unit, you remove or set the current organization and access mode policy contexts using the java wrappers available in OADBTransactionImpl class shown below. The multiple organizations security policy function uses a dynamic predicate to handle simple predicate when the access is limited to one operating unit and a complex predicate (exists sub-query) when the access involves multiple operating units. The predicate depends on the application context attribute value for access_mode. For example, in the Process Form Request method in the Controller Object (CO), call the multiple organizations methods depending on the operating unit selected from the list of values. PageCO
S t r i n ge v e n t=p a g e C o n t e x t . g e t P a r a m e t e r ( " e v e n t " ) ; i f( p a g e C o n t e x t . i s L o v E v e n t ( ) ) { / /F o r mw a ss u b m i t t e db e c a u s et h eu s e rs e l e c t e d / /av a l u ef r o mt h eL O Vm o d a lw i n d o w , / /o rb e c a u s et h eu s e rt a b b e do u to ft h eL O Vi n p u t . / /F i n do u tw h i c hL O Vi n p u tt r i g g e r e dt h ee v e n t . S t r i n gl o v I n p u t S o u r c e I d=p a g e C o n t e x t . g e t P a r a m e t e r ( S O U R C E _ P A R A M ) ; i f( " O p e r a t i n g U n i t " . e q u a l s ( l o v I n p u t S o u r c e I d ) ) { / /F i n do u tt h er e s u l tv a l u e so ft h eL O V . H a s h t a b l el o v R e s u l t s=p a g e C o n t e x t . g e t L o v R e s u l t s F r o m S e s s i o n ( l o v I n p u t S o u r c e I d ) ; i f( l o v R e s u l t s! =n u l l ) { / /U p d a t et h ep a g ed e p e n d i n go nt h ev a l u ec h o s e nb y / /b yu s e rt os e tc o n t e x t S t r i n go r g I d S=( S t r i n g ) l o v R e s u l t s . g e t ( " O r g I d " ) ; I n t e g e ro r g I d=n e wI n t e g e r ( o r g I d S ) ; O A D B T r a n s a c t i o nt r x=g e n e r a l I n f o A M . g e t O A D B T r a n s a c t i o n ( ) ; t r x . p u t V a l u e ( " o r g _ i d " , o r g I d ) ; t r x . p u t V a l u e ( " O u N a m e " ,( S t r i n g ) l o v R e s u l t s . g e t ( " O p e r a t i n g U n i t " ) ) ; t r x . s e t M u l t i O r g P o l i c y C o n t e x t ( " S " ,o r g I d . l o n g V a l u e ( ) ) ; S e r i a l i z a b l e [ ]p a r a m s={ o r g I d S } ; r o o t A M . i n v o k e M e t h o d ( " o u S e l e c t e d " , p a r a m s ) ; g e n e r a l I n f o A M . i n v o k e M e t h o d ( " h a n d l e O U C h a n g e E v e n t " , p a r a m s ) ; } e l s e { / / O Uc l e a r e d S e r i a l i z a b l e [ ]p a r a m s={ n u l l } ; g e n e r a l I n f o A M . i n v o k e M e t h o d ( " h a n d l e O U C h a n g e E v e n t " , p a r a m s ) ; } } }

The above code can be invoked from the ProcessRequest method when a default operating unit is available. Initialize Operating Unit Specific Attributes In Release 11i, operating unit specific attributes are initialized when opening a page as a responsibility has access to one operating unit. With multiple organizations access control, a responsibility can access multiple Operating Units, so initialization must happen after the user selects an Operating Unit or a default value appears. For example, in the Expense entry page flow the multiple organizations specific attributes are initialized in the ProcessFormRequest method after the user selects the operating unit or in the ProcessRequest method if there is a default operating unit. You can create a new method and consolidate all multiple organizations

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

48/59

4/25/13

the operating unit or in the ProcessRequest method if there is a default operating unit. You can create a new method and consolidate all multiple organizations initialization in that method as shown below:
p u b l i cv o i do u S e l e c t e d ( S t r i n go u )t h r o w sj a v a . s q l . S Q L E x c e p t i o n { i n i t G e n e r a l I n f o I n T r x n ( g e t E m p l o y e e I d I n T r a n s a c t i o n ( ) ) ; i n i t E x p e n s e T e m p l a t e s V O ( ) ; i n i t E x p e n s e T y p e s V O ( ) ; s e t u p . s e t F u n c t i o n a l C u r r e n c y I n f o ( t h i s ) ; }

Document 420787.1

Cache Operating Unit Information With multiple organizations access control, the cached operating unit information includes multiple operating units. OA Framework handles caching using the BC4J layer. To utilize OA caching, you must create an Entity Object (EO) and View Object (VO) for the operating unit specific attributes to cache, and make the ORG_ID the key attribute. To retrieve the operating unit attributes, you must use findByKey() method on the VO after selecting the operating unit using ORG_ID as the key. Here is an example:
O A V i e w O b j e c to u C a c h e V O= ( O A V i e w O b j e c t ) f i n d V i e w O b j e c t ( " o u C a c h e V O 1 " ) ; O b j e c t[ ]k e y V a l u e s=n e wO b j e c t [ 2 ] ; k e y V a l u e s [ 0 ]=n e wN u m b e r ( o u ) ; k e y V a l u e s [ 1 ]=n u l l ; R o w [ ]r o w s=o u C a c h e V O . f i n d B y K e y ( n e w K e y ( k e y V a l u e s ) ,1 ) ; o u C a c h e V O R o w I m p lr o w=( o u C a c h e V O R o w I m p l ) r o w s [ 0 ] ; . . .

In this example, there are two keys because the VO joins 2 views, AP_SYSTEM_PARAMETERS and GL_LEDGERS_PUBLIC_V. The key value for AP_SYSTEM_PARAMETERS is ORG_ID, and the key value for GL_LEDGERS is LEDGER_ID. The first time findByKey() is invoked for a record, it is retrieved from the database and is cached. Any subsequent call for the record is retrieved from the cache. Modify EOs/VOs for Operating Unit specific fields You must modify the EOs and VOs for LOVs used for Operating Unit specific fields according to the following the rules: Do not use the multiple organizations temporary table directly in the SQL query. Instead, use the PL/SQL functions to check the operating unit access and obtain the operating unit information. Add the ORG_ID filter to the WHERE clause of the VOs SQL to avoid cartesian joins for tables that include ORG_ID as the composite or driving key. Add ORG_ID Predicate in Client/Server Code In the client side and server side application codes, SQL statements issue Data Manipulation Language (DML) to multiple organizations views. The APIs that validate the data in an operating unit benefit by using the current organization ID set by the OA Framework pages before firing the validation logic, rather than passing the ORG_ID as a parameter. However, if the API is used in the reference view and server side validation for OA Framework pages, then modify the API to include the ORG_ID parameter as described in the reference views section. You must follow these rules: Do not use the temporary table directly in the SQL query. Instead, Use the PL/SQL functions to check the operating unit access and obtain the operating unit information. Rewrite SQL joins with two or more views to use one secured synonym depending on the driving table for the query and replace the remaining views with _ALL tables. Add the ORG_ID filter to the WHERE clause of the VOs SQL to avoid cartesian joins for tables that include the ORG_ID as the composite or the driving key. Modify Table Handlers Similar to forms, you must explicitly pass the ORG_ID value to the table handlers and remove the RDBMS default value (CLIENT_INFO logic) for ORG_ID column for the multiple organizations tables. Note: Product teams must not modify the RDBMS default ORG_ID value to use the current organization. The current_org is introduced to minimize the code change for the product code that is executed in one operating unit. The operating unit is validated up front in OA Framework pages. Therefore, it is safe to use this value in the table handlers rather than using the RDBMS default value.

Refer to Modify Table Handlers for examples on table handlers. Handle Operating Unit Value Change The user can change the operating unit anytime before committing the record to the database. The Operating Unit field appears read only after committing the record to the database, preventing users from updating the operating unit.

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

49/59

4/25/13

record to the database, preventing users from updating the operating unit.

Document 420787.1

Product teams must decide whether clearing the fields should clear the entire record or only the values in the Operating Unit specific fields, as changing the operating unit value clears the Operating Unit specific fields. The change is captured in the ProcessFormRequest method using PPR. Remove NVL logic and CLIENT_INFO reference You must not refer to the CLIENT_INFO for organization context in the framework code and also remove NVL function for ORG_ for better performance.

Enhancements to JTT Pages


A JTT-based application is a stateless application. Multiple organizations must be explicitly initialized for JTT-based pages. The developer must specify if the page is enabled for single operating unit mode or multiple operating units by indicating S or M, respectively, when calling the mo_global.init routine. When the operating unit context is determined for a given transaction flow, the current org_id context value must be captured by invoking the MultiOrgUtils.setMoPolicyContext() method. The developer must store the original state if the context is reset, if necessary, when changing the policy context (from multiple to single for a org_id value or vice versa),. This method sets application context at database and ICX session level. The methods, MultiOrgUtils.getCurrentOrgId and MultiOrgUtils.clearCurrentOrgContext, help the developer in controlling the context value. When establishing a new ICX session for the first time, the current organization ID in ICX session attributes must be null. Multiple organizations initialization depends on the multiple organizations mode, whether S (Single) for MO: Operating Unit profile option or M (Multiple) for MO: Security Profile, if one operating unit is defined. When initializing a JTT-based page, the multiple organizations initialization sets a policy context with the value stored in ICX table if the ICX session is already established. The access mode declared in the page (initMultiOrg()) is ignored in this case. If no current organization ID value is stored in ICX table, then multiple organizations initialization honors the access mode declared in the page. For example, a developer can call the mo_global.init with an appropriate access mode to a JTT-based page because the mo_global.init can be called from this page or from another page in a transaction flow. If the mo_global.init is called from another page (the calling page must invoke a new method for the set_policy_context that stores a single org_id value in the database and ICX session), then the page must contain a value from the ICX table. All context value are reinitialized and the access mode set by initMultiOrg() is applied when switching responsibilities. Specification for available API for JTT-based application Below is a list of APIs for handling multi organizations context in JTT applications.
p a c k a g eo r a c l e . a p p s . j t f . u t i l ; p u b l i cc l a s sG e n e r a l P r e f e r e n c e{ / * *i n i t i a l i z em u l t i o r gc o n t e x t .i fo n l yo n eo r gi sa c c e s s i b l e ,s e ti ti n *d a t a b a s ec o n t e x ta n dI C Xs e s s i o n *r e s e r v ec o n n e c t i o nf o rt h ee n t i r ed u r a t i o no ft h eH T T Pr e q u e s t . * / p u b l i cs t a t i cv o i di n i t M u l t i O r g ( S t r i n gp A c c e s s M o d e ) ( I n v o k et h i sm e t h o da tt h eb e g i n n i n go faJ S Pp a g ea f t e rS e r v l e t S e s s i o n M a n a g e r . s t a r t R e q u e s t ( ) . T h i sm e t h o dc a l l sM u l t i O r g U t i l s . i n i t M u l t i O r g ( ) t os e to r g c o n t e x t .I ta l s or e s e r v e s t h ed a t a b a s ec o n n e c t i o nf o rt h ed u r a t i o no ft h eH T T Pr e q u e s t ,s ot h a ts u b s e q u e n t c a l l st oT r a n s a c t i o n S c o p e . g e t C o n n e c t i o n ( )w i t h i nt h er e q u e s tr e t u r n st h es a m e c o n n e c t i o nw i t ho r g c o n t e x ti n i t i a l i z e d . ) } p a c k a g eo r a c l e . a p p s . f n d . m u l t i o r g . s e r v e r ; p u b l i cc l a s sM u l t i O r g U t i l s { / * *i n i t i a l i z em u l t i o r gc o n t e x t .i fo n l yo n eo r gi sa c c e s s i b l e ,s e ti ti n *d a t a b a s ec o n t e x ta n dI C Xs e s s i o n * / p u b l i cv o i di n i t M u l t i O r g ( W e b A p p s C o n t e x tc t x , O r a c l e C o n n e c t i o nd b C o n n e c t i o n , S t r i n gp A c c e s s M o d e ) t h r o w sS Q L E x c e p t i o n . . . " ( W h e nan e ws e s s i o ni se s t a b l i s h e d ,t h eo r gc o n t e x ti sn u l l .M Oi n i t i a l i z a t i o n i se x e c u t e dd e p e n d i n go nt h ea c c e s sm o d e-' S 'f o rs i n g l e( M O :O p e r a t i n gU n i t p r o f i l e )o r' M 'f o rm u l t i p l e( M O :S e c u r i t yP r o f i l ei fd e f i n e d ) . T h em e t h o ds h o u l dn o tb ec a l l e di fo r gc o n t e x ti sn o tn e c e s s a r yf o rag i v e n t r a n s a c t i o nf l o w . ) "

/ * *s e to r gp o l i c yc o n t e x ti nd a t a b a s ec o n n e c t i o na sw e l la si nI C Xs e s s i o n * / p u b l i cv o i ds e t M O P o l i c y C o n t e x t ( W e b A p p s C o n t e x tc t x , O r a c l e C o n n e c t i o nd b C o n n e c t i o n , S t r i n gp A c c e s s M o d e , l o n gp O r g I d ) " I n v o k et h i sm e t h o dt os t o r e' c u r r e n to r g _ i d 'c o n t e x tw h e nu s e rc h o o s e sa no r g f r o mo r gL O V .T h em e t h o dw i l li n v o k eM OA P Is e t _ p o l i c y _ c o n t e x t .T h i sm e t h o dw i l l

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

50/59

4/25/13
s e tp o l i c yc o n t e x ta td a t a b a s ea n dI C Xs e s s i o nl e v e l . "

Document 420787.1

/ * *g e tc u r r e n to r gc o n t e x tf r o mI C Xs e s s i o n * / p u b l i cl o n gg e t C u r r e n t O r g I d ( W e b A p p s C o n t e x tc t x , O r a c l e C o n n e c t i o nd b C o n n e c t i o n ) / * *c l e a ro r gc o n t e x tf r o mI C Xs e s s i o na sw e l la sd a t a b a s ec o n n e c t i o n * / p u b l i cv o i dc l e a r C u r r e n t O r g C o n t e x t ( W e b A p p s C o n t e x tc t x , O r a c l e C o n n e c t i o nd b C o n n e c t i o n )

" ( I n v o k et h i sm e t h o dt oc l e a r' c u r r e n to r g _ i d 'c o n t e x t .P r o d u c tt e a mi sr e s p o n s i b l e t oc a l li tw i t h i nt h e i rp r o g r a mw h e nr e q u i r e d ,J T T/M Ow i l ln o tc l e a ri tf o ry o u .( e g . c l i c k i n go nG l o b a lb u t t o nt oM a i nm e n ud o e sn o tc l e a rc u r r _ o r g _ i da u t o m a t i c a l l y ) . " W h e nR e s p o n s i b i l i t yi ss w i t c h e d ,o r gc o n t e x tv a l u es h o u l db ec l e a r e d ) }

Initializing Multi Organizations Context For all pages in JTT based applications, call API ServletSessionManager.startRequest() at the beginning of a page. For most applications, the API is called from include page jtfsrnfp.jsp In Release 12, multiple organizations enabled applications must call GeneralPreference.initMultiOrg() after ServletSessionManager.startRequest()in pages that require organizations context.
< % @i n c l u d ef i l e=" j t f i n c l . j s p "% > . . . < % @i n c l u d ef i l e=" j t f s r n f p . j s p "% > < %G e n e r a l P r e f e r e n c e . i n i t M u l t i O r g ( a c c e s s M o d e )% > . . . . . . < % @i n c l u d ef i l e=" j t f e r n l p . j s p "% > . . .

Note: Multiple organizations context must be initialized by calling the initMultiOrg() method when using TransactionScope.getNewConnection().

Additional Information on Search Services: 1. Connections established by calling TransactionScope.getNewConnection() must call MultiOrgUtils.initMultiOrg(...). 2. To implement the JTT Search Service , call MultiOrgUtils.initMultiOrg(..) on connecting by calling TransactionScope.getNewConnection(). Setting Policy Context GeneralPreference.initMultiOrg() initializes the context with multiple organizations if called in M mode and the user accesses more than one organization. To set the current org_id in the context, application must call MultiOrgUtils.setMoPolicyContext(). This is typically required when a user chooses one organization from the multiple organizations list of values. Get Current Organization Context To obtain the organization context, applications must call MultiOrgUtils.getCurrentOrgContext(). Clearing Current Org Context To clear the organization context, applications must call MultiOrgUtils.clearCurrentOrgContext(). JAVA wrappers are available in /fnddev/fnd/12.0/java/multiorg/server directory.

List of Public APIs


Integration Repository for Multiple Organizations Access Control: Path in Integration Repository: Applications Technology > Application Object Library > Application Security Context

Multiple Organizations Access Control Global APIs


Name: Multi-Org Access Control Global APIs Internal Name: MO_GLOBAL Product: Application Object Library Type: PL/SQL

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

51/59

4/25/13

Type: PL/SQL Status: Active Description: Multiple Organizations Access Control initialization related APIs Source file: patch/115/sql/AFMOGBLS.pls Procedures and Functions Name Initialize JTT initialize Internal Name INIT JTT_INIT Status Description Active Active Active Active Active Active Active Active Active Active Active

Document 420787.1

Set up multiple organizations context. Initialize multiple organizations for JTT based application. Check if the multiple organizations instance is enabled. Check if the operating unit is accessible. Get the operating unit name. Check if the organization is valid. Set the application policy context. Get the current organization ID in the application context. Get the application context mode. Get the operating unit count on the access control list. Get the current default/valid organization. Get the default organization and check if the organization is valid. Check if the multiple organization is initialized.

Is multi-org enabled is_multi_org_enabled Check access Get OU name Check valid org Set policy context Get current org Id Get access mode Get OU count Get valid org Validate org id public API Is MO initialization done check_access get_ou_name check_valid_org set_policy_context get_current_org_id get_access_mode get_ou_count get_valid_org

validate_orgid_pub_api Active is_mo_init_done Active

Internal Name: JTT_INIT Interface: MO_GLOBAL Description: The java API for initializing multiple organizations in JTT-based application. This API also initializes the ICX session attribute, JTTCURRENTORG, and tracks the current organization (ORG) context. Parameters Default Direction Precision/Size Value

Name

Type

Description Pass 'S' or 'M' to initialize the operating unit for single or multiple operating unit context. ICX session ID

p_appl_short_name NUMBER IN

p_icx_session_id

NUMBER IN

Internal Name: INIT Interface: MO_GLOBAL Description: Call this procedure to initialize the operating unit context. It is called when a new database session is established after calling FND_GLOBAL.apps_initialize routine. Parameters Default Direction Precision/Size Value

Name

Type

Description Pass 'S' or 'M' to initialize the operating unit for single or multiple operating unit context.

p_appl_short_name VARCHAR2 IN

Internal Name: is_multi_org_enabled Interface: MO_GLOBAL Description: This function determines whether the current instance is a multiple organizations database. Return Value: Y if database instance is multiple organizations, else N. Return Type: VARCHAR2 Internal Name: check_access Interface: MO_GLOBAL Description: This functions checks if the user can access the specific operating unit. This function checks the following: 1. If the operating unit exists in the PL/SQL array. The PL/SQL array is populated by the set_org_access multiple organizations API. 2. If the operating unit is same as the current organization ID for single ('S') organization initialization. Parameters

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

52/59

4/25/13

Parameters Default Direction Precision/Size Value IN

Document 420787.1

Name p_org_id

Type NUMBER

Description Pass the operating unit ID to check if the operating unit is present in the access list.

Return Value: Y if the operating unit is accessible, else N. Return Type: VARCHAR2 Internal Name: get_ou_name Interface: MO_GLOBAL Description: This function returns the operating unit name when provided with the ID. Parameters Default Direction Precision/Size Value IN

Name p_org_id

Type NUMBER

Description Pass the operating unit ID to get the name.

Return Value: Operating unit name. Return Type: VARCHAR2 Internal Name: check_valid_org Interface: MO_GLOBAL Description: This function checks if the specified operating unit exists in the session's access control list. This function is similar to the check_access function. But this function also displays an error message if the specified operating unit is null or not present in the access list. The calling application can check the value of the function and display an error message if the operating unit is not present. Parameters Default Direction Precision/Size Value IN

Name p_org_id

Type NUMBER

Description Pass the operating unit ID to check if it is present in the access control list. Display an error message if required and the value is N.

Return Value: Y if the operating unit is present in the access control list, else N. Return Type: VARCHAR2 Internal Name: set_policy_context Interface: MO_GLOBAL Description: This function sets the application context for the current organization and the access mode that must be set in server side code and multiple organizations security policy function for validations. Parameters Default Direction Precision/Size Value

Name

Type

Description Pass the access mode S or M to set the multiple organizations policy context for single or multiple operating units respectively. If access mode is S, pass an operating unit ID to set the current organization context.

p_access_mode VARCHAR2 IN

p_org_id

NUMBER

IN

Internal Name: get_current_org_id Interface: MO_GLOBAL Description: This function returns the current_org_id stored in the application context. Return Value: current_org_id stored in the application context. Return Type: NUMBER Internal Name: get_access_mode Interface: MO_GLOBAL Description: This function returns the access mode stored in the application context. Return Value: Access mode (S, M or A) stored in the application context. Return Type: VARCHAR2 Internal Name: get_ou_count Interface: MO_GLOBAL Description: This function returns the number of records (operating units) stored in the multiple organizations temporary table. Return Value: Number of accessible operating units .

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

53/59

4/25/13
Return Type: NUMBER

Document 420787.1

Internal Name: get_valid_org Interface: MO_GLOBAL Description: This function determines and returns the valid ORG_ID. The organization ID is obtained in the following order: 1. Parameter from the caller. 2. Current organization ID. 3. Default organization ID. Parameters Default Direction Precision/Size Value IN

Name p_org_id

Type NUMBER

Description Pass the operating unit ID and validate it against the access control list.

Return Value: Returns the valid organization ID if found, or when the organization ID is passed, else returns NULL. Return Type: NUMBER Internal Name: validate_orgid_pub_api Interface: MO_GLOBAL Description: This function is used in public API's for backward compatibility. The status is success (S) if the org_id is: 1. Either valid with MO: Security Profile or the current organization or MO: Operating Unit 2. Derived from the current organization or MO: Default Operating Unit or MO: Operating Unit The status is failure (F) if org_id: 1. Is either invalid with both MO: Security Profile and the current organization and MO: Operating Unit 2. Could not be derived. To suppress the error, pass the ERROR_MESG_SUPPR as Y. Arguments: ORG_ID org_id for the operating unit ERROR_MESG_ SUPPR Error message suppresser STATUS Validation/derivation result Parameters Default Direction Precision/Size Value IN - OUT

Name org_id

Type NUMBER

Description Pass an operating unit ID that must be validated. When the org_id is not passed, the system derives the org_id.

Error_mesg_suppr VARCHAR2 IN

A flag to suppress or raise an error when the organization ID passed is not valid or the system could not derive the org_id. S (success) if the org_id passed is valid or the system derives the org_id. F (failure) if org_id passed is invalid or system could not derive the org_id.

Status

VARCHAR2 OUT

Internal Name: is_mo_init_done Interface: MO_GLOBAL Description: This functions checks if multiple organizations is initialized. The order is Temp table -> Current Org -> Access Mode (e.g. S, M or A) Return Value: Y if initialization is done, else N. Return Type: VARCHAR2

Multiple Organizations Access Control Utility APIs


Name: Multi-Org Access Control Utility APIs Internal Name: MO_UTILS Product: Application Object Library Type: PL/SQL Status: Active Description: Multi-Org Access Control utility APIs Source file: patch/115/sql/AFMOUTLS.pls Procedures and Functions

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

Name

Internal Name

Status Description

54/59

4/25/13
Name Get Ledger Name Get ledger information Internal Name Get_Ledger_Name Get_Ledger_Info Status Description Active Active Active

Document 420787.1
Returns the ledger name. Returns information about the ledger. Gets the default operating unit from MO: Default Operating Unit profile or from current organization. Returns the organization ID of the default operating unit. Checks if the specified organization is present in the security profile. Checks if all operating units of a ledger are included in the security profile. Returns the operating unit name for an organization ID. Returns the operating unit ID and the number of operating units in the given ledger.

Get Default operating get_default_ou unit Get Default operating get_default_org_id unit Id Check org in security check_org_in_sp profile Check ledger in security profile Get organization name Get organization IDs for the ledger

Active Active

check_ledger_in_sp Active Get_Org_Name Active

get_orgid_fr_ledger Active

Internal Name: Get_Ledger_Name Interface: MO_UTILS Description: This function returns a primary ledger name associated with an operating unit. Parameters Default Direction Precision/Size Value IN

Name

Type

Description Operating unit ID.

p_operating_unit NUMBER

Return Value: primary ledger name. Return Type: VARCHAR2 Internal Name: Get_Ledger_Info Interface: MO_UTILS Description: This function returns information about a primary ledger, such as ledger name and ledger ID, which is associated with an operating unit. Parameters Default Direction Precision/Size Value IN OUT

Name p_ledger_id p_ledger_name

Type NUMBER

Description Operating unit ID. Ledger ID of an operating unit. Ledger Name of an operating unit.

p_operating_unit NUMBER

VARCHAR2 OUT

Internal Name: get_default_ou Interface: MO_UTILS Description: This function returns the default operating unit based on the MO: Default Operating Unit, MO: Security Profile and MO: Operating Unit profile options. Parameters Default Direction Precision/Size Value OUT OUT

Name p_default_org_id p_ou_count

Type NUMBER NUMBER

Description Operating unit ID. Default operating unit name. Number of operating units in the access list.

p_default_ou_name VARCHAR2 OUT

Internal Name: get_default_org_id Interface: MO_UTILS Description: This function returns the ID of the default operating unit. The default operating unit is determined by the MO: Default Operating Unit profile. If there is one operating unit in the access control list then the ID of that operating unit is returned as the default operating unit ID. Return Value: Organization ID of the default operating unit. Return Type: NUMBER Internal Name: check_org_in_sp Interface: MO_UTILS Description: This functions checks whether an operating unit is included in the security profile. FND_GLOBAL.apps_initialize() must be called before calling this API, since the profiles are read from the cache. Parameters

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

Default

55/59

4/25/13
Name p_org_id p_org_class Type NUMBER Default Direction Precision/Size Value IN

Document 420787.1
Description Operating unit ID. Organization is classified either OPERATING_UNIT or HR_BG.

VARCHAR2 IN

Return Value: Returns Y if an organization exists in the MO: Security Profile, else N if an organization does not exist in the MO: Security Profile or the profile option is not set. Return Type: VARCHAR2 Internal Name: check_ledger_in_spt Interface: MO_UTILS Description: Use this function to determine if the user has access to all operating units for a given Ledger_ID. Parameters Default Direction Precision/Size Value OUT

Name p_ledger_id

Type NUMBER

Description Ledger ID.

Return Value: Returns Y if all operating unit under a given ledger are accessible, else N. Return Type: VARCHAR2 Internal Name: Get_Org_Name Interface: MO_UTILS Description: This function returns the operating unit name for the passed operating unit ID. Parameters Default Direction Precision/Size Value IN

Name p_org_id

Type NUMBER

Description Operating unit ID.

Return Value: Operating unit name Return Type: VARCHAR2 Internal Name: get_orgid_fr_ledger Interface: MO_UTILS Description: Get the operating unit ID and the number of operating units in the given ledger ID. Parameters Default Direction Precision/Size Value IN OUT OUT

Name org_count org_Ids

Type NUMBER TABLE

Description Ledger ID. Number of operating units in the ledger. Table of operating unit IDs.

sob_or_ledger_id NUMBER

Multi-Org Access Control Java Wrappers


Name: Multi-Org Access Control Java Wrappers Internal Name: MoGlobal Product: Application Object Library Type: Java Status: Active Description: Multi-Org Access Control Java Wrappers for PL/SQL APIs Source file: java/multiorg/server/MoGlobal.java Methods Name Initialization Set Multi-Org policy context Internal Name Status Description init Active Initializes multiple organizations. Sets the multiple organizations policy context/application context to single or multiple operating units. setPolicyContext Active

Method Name: init Description: This method initializes the multiple organizations for the current database session. Parameters Name dbtransaction p_appl_short_name Type java.lang.String Description Application Short Name

oracle.jbo.server.DBTransaction Database transaction.

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

56/59

4/25/13
p_appl_short_name java.lang.String

Document 420787.1
Application Short Name

Wrapper for the PL/SQL API of MO_GLOBAL package: INIT Method Name: setPolicyContext Description: This method sets the multiple organizations policy context/application context. Parameters Name dbtransaction p_access_mode p_org_id Type java.lang.String oracle.jbo.domain.Number Description Pass access mode - S or M. Operating unit ID if the access mode is S.

oracle.jbo.server.DBTransaction Database transaction.

Wrapper for the PL/SQL API of MO_GLOBAL package: set_policy_context Name: Multi-Org Access Control Java Wrappers Internal Name: MoUtils Product: Application Object Library Type: Java Status: Active Description: Multi-Org Access Control Java Wrappers for PL/SQL APIs Source file: java/multiorg/server/MoUtils.java Methods Name Check ledger in security profile Check organization in security profile Internal Name Status Description Checks if all operating units assigned to the ledger are included in the security profile. Checks if the organization is included in the security profile. Returns the default operating unit for the current multiple organizations session. Obtain the default operating unit for the current multiple organizations context. Returns the ledger information of the operating unit. Returns the ledger name of the operating unit. Returns the organization name, on providing its ID.

checkLedgerInSp Active checkOrgInSp Active Active Active Active Active Active

Get default operating unit id getDefaultOrgId Get default operating unit Get Ledger information Get Ledger name Get organization name getDefaultOu getLedgerInfo getLedgerName getOrgName

Method Name: checkLedgerInSp Description: This method checks if all operating units belonging to the ledger are included in security profile and are accessible. Parameters Name dbtransaction p_ledger_id Type oracle.jbo.domain.Number Description Ledger ID

oracle.jbo.server.DBTransaction Database transaction.

Return Value: Returns Y if all operating unit in a given ledger are accessible, else N. Return Type: java.lang.String Wrapper for the PL/SQL API of MO_UTILS package: check_ledger_in_sp Method Name: checkOrgInSp Description: This method checks if the operating unit is included in the security profile. Parameters Name dbtransaction p_org_id p_org_class Type oracle.jbo.domain.Number Java.lang.String Description Operating unit ID. Organization classification code.

oracle.jbo.server.DBTransaction Database transaction.

Return Value: Returns Y if an organization exists in the MO: Security Profile, else N if an organization does not exist in the MO: Security Profile or the profile option is not set. Return Type: java.lang.String Wrapper for the PL/SQL API of MO_UTILS package: check_org_in_sp Method Name: getDefaultOrgId Description: This method returns the default operating unit ID.

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

57/59

4/25/13
Parameters Name dbtransaction Type Description

Document 420787.1

oracle.jbo.server.DBTransaction Database transaction.

Return Value: Organization ID of the default operating unit. Return Type: oracle.jbo.domain.Number Wrapper for the PL/SQL API of MO_UTILS package: get_default_org_id Method Name: getDefaultOu Description: This method finds the default operating unit for the current multiple organizations context. Parameters Name dbtransaction p_default_org_id p_default_ou_name p_ou_count Type oracle.jbo.domain.Number java.lang.String oracle.jbo.domain.Number Description Organization ID of the default operating unit. Name of the default operating unit. Number of operating units in the access control list.

oracle.jbo.server.DBTransaction Database transaction.

Wrapper for the PL/SQL API of MO_UTILS package: get_default_ou Method Name: getLedgerInfo Description: This method returns the ledger ID and ledger name of the operating unit. Parameters Name dbtransaction p_operating_unit p_ledger_id p_ledger_name Type oracle.jbo.domain.Number oracle.jbo.domain.Number java.lang.String Description Organization ID of the operating unit that is entered. Displays the ledger ID. Displays the ledger name.

oracle.jbo.server.DBTransaction Database transaction.

Wrapper for the PL/SQL API of MO_UTILS package: get_ledger_info Method Name: getLedgerName Description: The method returns the ledger name of an operating unit. Parameters Name dbtransaction p_operating_unit Type oracle.jbo.domain.Number Description Operating unit ID that is entered.

oracle.jbo.server.DBTransaction Database transaction.

Return Value: Ledger name of the operating unit. Return Type: java.lang.String Wrapper for the PL/SQL API of MO_UTILS package: get_ledger_name Method Name: getOrgName Description: This method returns the name of an operating unit on providing its ID. Parameters Name dbtransaction p_org_id Type oracle.jbo.domain.Number Description Operating unit ID that is entered.

oracle.jbo.server.DBTransaction Database transaction.

Change Record
Date July 06, 2007 January 29, 2008 Description of Change Published document. Implemented remarks and published document.

Oracle Corporation
https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4 58/59

4/25/13
Author and Date Ramasubramanian Balasundaram, Julianna Dodick, Jason Liu July 2007 Copyright Information Copyright 2007, 2008 Oracle. All rights reserved.

Document 420787.1

Disclaimer This document is provided for information purposes only and the contents hereof are subject to change without notice. This document is not warranted to be errorfree, nor subject to any other warranties or conditions, whether expressed orally or implied in law, including implied warranties and conditions of merchantability or fitness for a particular purpose. We specifically disclaim any liability with respect to this document and no contractual obligations are formed either directly or indirectly by this document. This document may not be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without our prior written permission. Trademark Information Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

References

Related
Products
Oracle E-Business Suite > Applications Technology > Lifecycle Management > Oracle Application Install > MO OR MRC CONVERSION WITH ADADMIN > MO OR MRC CONVERSION WITH ADADMIN

Keywords
INITIALIZE THE TEMPORARY

Errors
ERROR HANDLING; FND-1016 Back to Top
Copy right (c) 2013, Oracle. A ll rights reserv ed. Legal Notices and Terms of Use Priv acy Statement

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=168667848177608&id=420787.1&_afrWindowMode=0&_adf.ctrl-state=vrwsedtl_4

59/59