Search Results get_max_periods




Overview

PSP_MATRIX_DRIVER2_PKG is a PL/SQL package body owned by APPS in the Oracle E-Business Suite, classified under the ETRM taxonomy as OTHER. It belongs to the Oracle Enterprise Resource Planning family of packages that support project scheduling, resource matrix generation, and period-based resource loading. Its primary business function is to persist and expose a dynamic, user-defined sliding window of accounting or scheduling periods over which resource requirements, schedule percentages, and resource distribution totals are calculated.

The package achieves this by storing a collection of period start dates (a specialized associative array indexed by BINARY_INTEGER and named dat) loaded from the schedule line table. Callers can then reference any period relative to a configurable starting period, obtain the maximum number of periods available, retrieve the start date of an offset period, aggregate the scheduled percentage for a specific period, and obtain a user-facing date prompt for display in Oracle Forms. The package therefore acts as an in-memory period navigator that sits between the underlying schedule definitions and the presentation layer, isolating calling code from the complexity of calculating period offsets directly.

Key Procedures and Functions

The package exposes seven documented program units:

  • LOAD_TABLE — Reads the schedule lines associated with a given schedule hierarchy and populates the internal dat collection of period start dates. It is the mandatory initialization step before any other function is used.
  • PURGE_TABLE — Empties the internal dat collection, releasing session memory and preparing the package for a fresh load cycle.
  • SET_START_PERIOD — Assigns the numeric starting offset used as the anchor point for all subsequent period calculations. It controls which period is treated as the first period visible to the user.
  • GET_MAX_PERIODS — Returns the count of loaded periods via the collection's COUNT method, enabling callers to bound any iteration over the period range.
  • GET_START_PERIOD — Returns the DATE value of the period located at a given offset from the configured start period, providing direct date access for a specific window position.
  • GET_DYNAMIC_TOTALS — Aggregates the sum of PERIOD_SCHEDULE_PERCENT from the temporary driver table for the period corresponding to the requested offset. This delivers the total scheduled percentage allocated to that period. The implementation guards against offsets that fall before the first valid period and returns NULL in that case.
  • GET_DYNAMIC_PROMPT — Returns a formatted date string (MON-YY) suitable for display as a dynamic column prompt or form label, based on the requested period offset.

Tables Accessed

The package references the following objects through APPS synonyms:

  • PSP_MATRIX_DRIVER2 — The temporary driver table that holds computed scheduling percentages keyed by period. GET_DYNAMIC_TOTALS issues a SUM aggregation against this table using the resolved period date as the predicate.
  • PSP_SCHEDULE_LINES — The source of schedule hierarchy definitions. LOAD_TABLE declares a cursor over this table, retrieving schedule line identifiers, begin and end dates, and schedule percentages for a supplied schedule hierarchy ID. These rows drive the population of the internal period collection.
  • PLITBLM — A standard Oracle Applications temporary/PL/SQL table used in matrix driver processing, referenced during the load and processing cycle.

Usage Notes

PSP_MATRIX_DRIVER2_PKG is not a public API in the ETRM sense; it is classified as OTHER and is referenced by one other package, indicating it is consumed internally within the matrix driver framework rather than called directly by external integrations. Typical invocation follows a strict lifecycle: a calling form or program first invokes LOAD_TABLE with the relevant schedule hierarchy and date range, then optionally calls SET_START_PERIOD to align the visible window, after which GET_DYNAMIC_PROMPT and GET_DYNAMIC_TOTALS are repeatedly called as the user scrolls or navigates the period columns of the resource matrix. GET_MAX_PERIODS is used to determine loop boundaries, and GET_START_PERIOD supplies the underlying date for any calculation requiring a concrete period value. PURGE_TABLE should be invoked after processing completes to clear session state before the next load. Because the package depends on session-level collection state, callers must ensure LOAD_TABLE is executed in the same database session as any subsequent accessor call; invoking GET_START_PERIOD or GET_DYNAMIC_TOTALS without a prior successful load will produce invalid or null results. Customizations should avoid modifying the package directly and instead wrap it, since its behavior is bound to the internal matrix driver processing sequence.