Search Results set_request_context
Overview
APPS.PO_MOAC_UTILS_PVT is a private (PVT) PL/SQL utility package within the Oracle Purchasing (PO) module. Its name reflects its role as a Multi-Org Access Control (MOAC) helper for Purchasing — "PO" for Purchasing, "MOAC" for Multi-Org Access Control, and "UTILS_PVT" denoting a private utility package. The package was authored with the header identifier POXVMOUS.pls and is declared using AUTHID CURRENT_USER, meaning that its unqualified references to database objects are resolved in the schema of the calling user rather than the package owner, consistent with Oracle's recommended practice for MOAC-aware code.
The central business problem this package solves is organizational context management. In a multi-organization deployment, a single user session may need to view or transact against any number of operating units. Rather than relying on legacy mechanisms such as FND_CLIENT_INFO or DBMS_APPLICATION_INFO calls to establish the current organization, PO_MOAC_UTILS_PVT centralizes that responsibility. It determines which operating units are accessible, validates requested organization IDs, caches the set of valid organizations in a global temporary table, and applies the appropriate policy context so that secured views return only authorized data. In EBS 12.1.1 and 12.2.2 the package remains a foundational dependency, referenced by approximately one hundred other packages throughout the PO and related schemas.
Key Procedures and Functions
The package exposes fourteen documented procedures and functions, several of which are straightforward accessors and others of which perform substantive context management.
- INITIALIZE — Populates the global temporary table with the set of organizations to which the current user has access. This routine is the prerequisite for all subsequent context operations.
- SET_ORG_CONTEXT — Establishes the organization context for the session. As documented in the source header, it first checks whether the global temporary table is already populated; if not, it invokes the initialize routine. It then sets the context to a single operating unit matching the supplied organization ID.
- SET_POLICY_CONTEXT — Applies the policy context for a specified organization, enabling row-level security against the secured PO views.
- SET_REQUEST_CONTEXT — Establishes the request-level context, typically invoked at the start of concurrent program or report execution.
- GET_CURRENT_ORG_ID — Returns the organization ID currently effective in the session.
- GET_ENTITY_ORG_ID — The function of particular interest to the searcher. It resolves the owning operating unit (org_id) associated with a given business entity — for example, a requisition, purchase order, release, line, shipment, or distribution — by consulting the corresponding PO table. This allows calling code to determine the correct organization context before invoking SET_POLICY_CONTEXT.
- GET_VALID_ORG and VALIDATE_ORGID_PUB_API — Validate that a supplied organization ID is accessible to the current user, providing a gate before transactional operations proceed.
- GET_DEFAULT_OU and GET_OU_COUNT — Return, respectively, the default operating unit and the number of operating units available to the user.
- GET_OU_NAME and GET_OU_SHORTCODE — Retrieve the descriptive name and short code for an operating unit.
- CHECK_ACCESS — Verifies whether the current user is authorized for a specified organization.
- NAME — A naming or identification utility.
Two groups of public constants are also declared: document types (REQUISITION, PO, PA, RELEASE) and document levels (HEADER, LINE, SHIPMENT, DISTRIBUTION). These constants standardize the arguments passed to the entity-resolution routines, including GET_ENTITY_ORG_ID.
Tables Accessed
The package references a broad set of Purchasing and HR tables through APPS synonyms. Organizational data is drawn from HR_ALL_ORGANIZATION_UNITS, HR_ALL_ORGANIZATION_UNITS_TL, and HR_ORGANIZATION_INFORMATION, which together supply operating unit identities, translated names, and organization classifications. Document type validation uses PO_DOCUMENT_TYPES.
Entity resolution — the work performed by GET_ENTITY_ORG_ID and its callers — requires access to the principal Purchasing documents: PO_HEADERS_ALL, PO_LINES_ALL, PO_LINE_LOCATIONS_ALL, PO_DISTRIBUTIONS_ALL, PO_RELEASES_ALL, PO_REQUISITION_HEADERS_ALL, PO_REQUISITION_LINES_ALL, and PO_REQ_DISTRIBUTIONS_ALL. Each of these carries an org_id column, allowing the package to map any document at any level to its owning operating unit.
Usage Notes
PO_MOAC_UTILS_PVT is an internal package and is not intended for direct invocation by end users or customizations. It is principally consumed by Purchasing forms, concurrent programs, and by other PO packages that require the session organization context to be established before a query or transaction executes. The typical pattern is a call to SET_ORG_CONTEXT at the outset of processing, followed by GET_ENTITY_ORG_ID or GET_VALID_ORG to resolve or validate the organization associated with a specific document, and then SET_POLICY_CONTEXT to enforce secured access. Because the package is private and its interface is subject to change between releases, custom code should avoid hard-coded dependencies on it and instead use the corresponding public APIs where available.