Search Results get_stream_count
Overview
The MSD_COMPOSITE_GROUPING package is a PL/SQL package owned by the APPS schema in Oracle E-Business Suite, classified under the ETRM 12.2.2 metadata as an OTHER API type. It supports the composite sorting and stream grouping functionality within Oracle Advanced Supply Chain Planning (ASCP) and related MSD (Manufacturing Scheduling and Distribution) components. The package's primary business function is to group planning streams — logical partitions of planning data used to scope and manage very large planning runs — based on composite grouping definitions stored in the MSD_CS_DEFINITIONS family of tables.
The package is declared with AUTHID CURRENT_USER, meaning that privilege resolution for its SQL statements is performed based on the invoking user's schema rather than the definer's, and that all referenced objects resolve through APPS synonyms in the standard EBS configuration. The header comment indicates the package was created in early 2004, and its logic remains supported across both the 12.1.1 and 12.2.2 releases.
Overall the package addresses two activities: identifying and grouping streams (MSD_GROUP_STREAMS), and providing helper functions that resolve dimension codes, count streams, and determine designator usage for a composite sorting definition.
Key Procedures and Functions
- MSD_GROUP_STREAMS — The principal public procedure. It performs the actual grouping of streams according to a composite sorting definition, accepting standard concurrent program OUT parameters (ERRBUF and RETCODE) plus an optional mode and an optional overlap threshold parameter. It is the entry point used by concurrent processing.
- MSD_ASSIGN_GROUPS — Listed in the metadata as a documented procedure (commented out in the source excerpt), used to assign groups from an internally typed stream table. Note that in the shipped source it is disabled, so it is present for documentation/reference only.
- GET_DIM_CODE — A function that returns the dimension code (as a VARCHAR2) for a given level ID. Used to translate an MSD_LEVELS level identifier into its corresponding dimension.
- GET_STREAM_COUNT — A function returning the number of streams that exist for a supplied composite sorting definition ID; typically used to size subsequent processing.
- NUMBER_OF_DESIGNATORS — A function returning the count of designators associated with a composite sorting definition ID, used to validate or inform grouping logic.
Tables Accessed
Per the documented metadata, the package references the following tables via APPS synonyms:
- MSD_CS_DEFINITIONS, MSD_CS_DEFN_DIM_DTLS, and MSD_CS_DATA — the composite sorting definition header, dimension detail, and data tables that drive grouping logic.
- MSD_BOOKING_DATA, MSD_SHIPMENT_DATA, and MSD_MFG_FORECAST — source planning/transaction data (bookings, shipments, forecasts) used to resolve stream membership and dimension values.
- MSD_LEVELS and MSD_LEVEL_VALUES — the level and level-value hierarchies used by GET_DIM_CODE and dimension resolution.
- MSD_CS_DTLS_TEMP and MSD_DISTINCT_DIM_VAL_TEMP — temporary work tables that hold intermediate grouping data during processing.
- PLITBLM — the standard EBS PL/SQL index-by table synonym used for internal list handling.
Usage Notes
MSD_COMPOSITE_GROUPING is invoked primarily from concurrent programs and from the Oracle Advanced Supply Chain Planning setup flow governing composite sorting definitions. The MSD_GROUP_STREAMS procedure follows the standard concurrent program signature, taking ERRBUF and RETCODE as OUT parameters, which allows it to be registered and executed as a concurrent program that reports success, warning (G_WARNING = 1), or error (G_ERROR = 2).
The package references the profile option MRP_DEBUG through a global G_MSC_DEBUG variable initialized via FND_PROFILE.Value('MRP_DEBUG') with a default of 'N'. This is the object relevant to the search term g_msc_debug: it controls diagnostic tracing and is read at package initialization, so enabling MRP_DEBUG at the site, application, or user level produces additional debug output during stream grouping. This behavior is common across MSC/MSD packages.
Because the package is documented as referenced by zero other packages, it is effectively a top-level utility rather than a shared library, meaning callers should invoke it directly (typically through concurrent processing) rather than through chained API dependencies. Customizations should restore the original concurrent program definition after modification and re-test composite grouping on a representative plan.