Search Results terr_globals




Overview

IEX_TERR_WINNERS_PUB is a public PL/SQL package in the Oracle E-Business Suite Territory Management (ETRM) module, owned by the APPS schema and defined with AUTHID CURRENT_USER. Its primary business function is to support the concurrent program Generate Access Records, which is responsible for generating territory access records that determine which users, resources, and sales agents are granted access to specific opportunities, leads, and accounts based on territory assignments. The package serves as the public interface layer for the dependent procedures invoked by that concurrent job, encapsulating the logic and shared state needed to drive access record generation across potentially large volumes of territory-qualified data.

The package metadata indicates it contains the TERR_GLOBALS record type, which aggregates runtime context and control variables for the Generate Access Records process. This record includes fields such as user_id, last_update_login, prog_appl_id, prog_id, request_id, prev_request_id, and sequence, which are standard concurrent program context attributes. It also includes execution control and counting fields such as num_child_processes, min_num_parallel_proc, max_rank, run_mode, and boolean-style flags like oppor_territories_exist, lead_territories_exist, and manager_has_access, along with qualification counters (num_acct_qual, num_oppor_qual, num_lead_qual). This structure reflects the package's role in coordinating parallel worker processes and tracking the volume of qualifying accounts, opportunities, and leads processed during a run.

Key Procedures and Functions

The ETRM 12.2.2 documentation records two procedures/functions in this package:

  • PRINT_DEBUG — A diagnostic helper used to emit debug output during execution of the Generate Access Records process. This is typically gated by a debug or logging flag stored in the TERR_GLOBALS record or a related profile option, allowing developers and support personnel to trace processing behavior without affecting normal production runs.
  • ANALYZE_TABLE — A utility that gathers statistics on tables relevant to the access record generation process. By invoking DBMS_STATS, this procedure helps ensure the cost-based optimizer has current statistics, which is important when large parallel operations must choose efficient execution plans.

Neither procedure is documented with a specific parameter list in the available metadata. The names and the referenced DBMS_STATS dependency indicate that these are internal support routines rather than business-facing APIs. The broader package also contains the dependent procedures referenced by the Generate Access Records concurrent job, though those are not individually enumerated in the metadata excerpt.

Tables Accessed

The documented tables referenced via APPS synonyms are:

  • DBMS_STATS — Invoked by ANALYZE_TABLE to gather or manage optimizer statistics on the underlying territory and access-related tables. Maintaining fresh statistics supports reliable performance for the parallel worker queries that drive access record generation.
  • DUAL — Used for lightweight PL/SQL control expressions, default value assignment, and SQL constructs that do not require a physical table, common in package initialization and flag evaluation logic.

The package indirectly operates on the ETRM territory and access record tables that the Generate Access Records concurrent program populates, but those specific tables are not listed in the provided metadata. The TERR_GLOBALS record fields referencing account, opportunity, and lead qualification counters strongly imply reads against territory qualification and assignment views as part of the generation logic.

Usage Notes

IEX_TERR_WINNERS_PUB is not intended as a general-purpose business API. It is described explicitly as the public package for the concurrent program Generate Access Records and is to be used by the dependent procedures of that job. Typical invocation occurs through the standard EBS concurrent manager framework, where the program is submitted from the Territory Manager responsibility or scheduled as part of territory administration.

Because the package is classified as PUB, it may be invoked by other ETRM packages; the metadata notes that it is referenced by three other packages. Custom code should treat calls to this package with caution, since its procedures are tightly coupled to the Generate Access Records process and its TERR_GLOBALS record structure. When integrating or troubleshooting, the PRINT_DEBUG procedure is the appropriate entry point for enabling trace output, while ANALYZE_TABLE may be invoked separately to refresh statistics before large territory access generation runs. In Oracle EBS 12.1.1 and 12.2.2, the package remains schema-owner APPS and should be called only with the standard EBS initialization context (APPS credentials, correct org and user context) to ensure that AUTHID CURRENT_USER resolution and concurrent request identifiers are populated correctly.