Results for “okc_context”
50+ results
AI-generated from documented ETRM metadata — verify critical details on the linked pages.
Overview
OKC_CONTEXT is a server-side PL/SQL package body in the APPS schema that manages Multi-Org Access Control (MOAC) context for the Oracle Contracts (OKC) module. Its central responsibility is to establish, cache, and restore the organizational identifiers — Org ID, Organization ID, and Business Group ID — that determine which operating unit's contract data a session is permitted to see and modify. Because contracts are operating-unit–partitioned, virtually every contract query and DML statement depends on a correctly initialized Org context. OKC_CONTEXT abstracts that initialization into a small set of reusable entry points so that forms, concurrent programs, and other contract packages do not each have to re-derive the values from profile options or the HR organization model.
The package maintains package-level globals including the Organization ID, Business Group ID, MOAC access mode, and current Org ID, which are populated once per session and subsequently referenced by callers. The header comment in the source, dated 2010, references performance re-fixes and the MOAC project, indicating the package evolved to support multiple operating unit access rather than a single default operating unit.
Key Procedures and Functions
- SET_OKC_ORG_CONTEXT — Initializes the OKC organizational context. When the operating unit and organization identifiers are passed in explicitly, those values are used; when they are not supplied, the procedure derives them from user profile options and the HR organization model. It resolves the associated business group by querying the HR organization units and their organization information records, and it has historically written the Org ID into the OKC_CONTEXT namespace attribute via DBMS_SESSION.SET_CONTEXT. A cursor against HR_ALL_ORGANIZATION_UNITS and HR_ORGANIZATION_INFORMATION performs the business group lookup, with a commented-out alternative against OKX_ORGANIZATION_DEFS_V retained as a reference implementation.
- GET_OKC_ORG_ID — Returns the Org ID currently in effect for the OKC context. Callers use this rather than reading profile options directly, ensuring that the value reflects any prior SET_OKC_ORG_CONTEXT invocation within the session.
- GET_OKC_ORGANIZATION_ID — Returns the Organization ID held in the package global. This is the inventory/HR organization identifier corresponding to the operating unit, distinct from the Org ID used by the MOAC security model.
- SAVE_CURRENT_CONTEXTS — Captures the current context values so that they can be reinstated later. This supports scenarios in which a process must temporarily switch operating unit context and then return to the caller's original context.
- RESTORE_CONTEXTS — Reapplies the values previously captured by SAVE_CURRENT_CONTEXTS, restoring the session to its pre-switch state.
The save/restore pair is the standard pattern for nested or cross-operating-unit processing, where failing to restore context would cause subsequent operations in the calling code to act against the wrong organization.
Tables Accessed
- HR_ALL_ORGANIZATION_UNITS — Read to identify the operating unit organization and resolve its business group. The organization ID supplied to SET_OKC_ORG_CONTEXT is validated against this table.
- HR_ORGANIZATION_INFORMATION — Read in conjunction with the organization units table to retrieve classification and context information, specifically the "Operating Unit Information" context used to confirm that the organization is an operating unit and to obtain its business group identifier.
- OKC_K_HEADERS_ALL_B — The contract headers base table. It represents the contracts whose organizational ownership the context governs; it is the principal OKC table the context values are ultimately applied to.
- DBMS_SESSION — Not a table but the built-in package invoked to write the Org ID into the OKC_CONTEXT namespace attribute, enabling server-side context-based security within the database session.
Usage Notes
OKC_CONTEXT is a foundational utility: the ETRM metadata records that it is referenced by approximately 60 other packages, making it one of the more widely depended-upon objects in the OKC schema. It is typically invoked at the start of a user session or at the entry point of a contract-related form, concurrent program, or PL/SQL API, so that all downstream contract logic operates within the correct operating unit. Application code executing in a cross-operating-unit capacity should bracket its work with SAVE_CURRENT_CONTEXTS and RESTORE_CONTEXTS to avoid leaking an altered context into the remainder of the transaction. Customizations that query OKC tables directly should call SET_OKC_ORG_CONTEXT, or at minimum verify GET_OKC_ORG_ID, before issuing queries; otherwise MOAC-enforced views may return no rows or the wrong rows. Because profile option values are the fallback source when parameters are omitted, session initialization order matters — the package should be called after FND profile initialization has occurred.
-
CONTEXT: SYS.OKC_CONTEXT 12.1.1
-
CONTEXT: SYS.OKC_CONTEXT 12.2.2
-
PACKAGE: APPS.OKC_CONTEXT 12.2.2
-
PACKAGE: APPS.OKC_CONTEXT 12.1.1