Search Results in_period




Overview

ONT_PRT_MARGIN_ANA_PKG is an Oracle E-Business Suite PL/SQL package owned by the APPS schema and classified as a non-public (OTHER) API. It supports the Order-to-Cash margin analysis functionality within Oracle Order Management (ONT). The package is responsible for populating and querying the margin analysis tables that back the "Profit Margin Analysis" reporting feature available for order and order line transactions. In effect, it computes and stores margin data derived from cost (CST) and item (MTL) sources, then exposes aggregated margin and sales figures for a given accounting or reporting period. The package is declared AUTHID CURRENT_USER, meaning its unqualified object references resolve under the privileges of the invoking user rather than as the definer, which aligns with standard APPS-level security conventions in both 12.1.1 and 12.2.2.

Key Procedures and Functions

The package exposes four documented program units:

  • BUILD_ONT_PRT_MARGIN_TABLE — A procedure that constructs or refreshes the margin analysis data, populating the ONT_PRT_MARGIN_ANALYSIS table from the underlying cost and item sources. It is the primary data-generation routine of the package.
  • GET_TOTAL_MARGIN — A function that returns a numeric total margin figure for a supplied period. It is restricted with a PRAGMA RESTRICT_REFERENCES clause (WNDS, RNPS, WNPS), confirming it does not write database state, read no package state, and write no package state.
  • GET_TOTAL_SALES — A function that returns a numeric total sales figure for a supplied period, carrying the same purity restrictions as GET_TOTAL_MARGIN.
  • GET_ITEM_NUMBER — A function that accepts an item identifier and returns the corresponding item number as a VARCHAR2. This is the routine most directly associated with the search term "get_item_number." It provides a lookup translation from the internal inventory item ID to the user-facing item number, likely drawing on the item flexfield view described below.

The purity restrictions indicate that the three functions are read-only and therefore safe for use inside SQL statements and other query contexts.

Tables Accessed

The documented tables referenced via APPS synonyms are:

  • CST_MARGIN_BUILD — Source cost data used during the margin build process.
  • CST_MARGIN_SUMMARY — Pre-aggregated cost/margin summary data consumed by the build.
  • MTL_SYSTEM_ITEMS_KFV — The key flexfield view of inventory items, providing the item number translation used by GET_ITEM_NUMBER.
  • ONT_PRT_MARGIN_ANALYSIS — The target margin analysis table written by BUILD_ONT_PRT_MARGIN_TABLE and read by the aggregation functions.
  • ONT_PRT_MARGIN_ANA_ERR — An error/logging table that captures exceptions or rejected records encountered during the build.

Usage Notes

ONT_PRT_MARGIN_ANA_PKG is typically invoked indirectly. The BUILD_ONT_PRT_MARGIN_TABLE procedure is expected to be driven by a concurrent program or scheduled job that refreshes margin analysis data for a period; the GET_TOTAL_MARGIN, GET_TOTAL_SALES, and GET_ITEM_NUMBER functions are then called from Oracle Forms, OAF pages, or custom reports to display margin and item details. GET_ITEM_NUMBER in particular is a convenient utility for resolving an item ID to its display number inside a SQL query. Because the package is classified as OTHER rather than a certified public API and is referenced by zero other packages, it should be treated as an internal implementation object; customizations should call it with caution and avoid depending on its signature across patches or upgrades. Support for the package should be confirmed against the specific 12.1.1 or 12.2.2 patch level in use.