Search Results g_revision




Overview

WMS_RULE_2 is a private helper package body owned by APPS that supports the Warehouse Management System (WMS) rule engine, which evaluates user-defined picking and put-away rules to determine how material should be selected from inventory. The package operates within the WMS_RULE_PVT family and is classified as an OTHER API rather than a public interface API, indicating that it is intended to be called by other WMS rule components rather than by external integrations. Its principal role is to manage a stateful, server-side cursor over candidate inventory rows that satisfy a caller-supplied set of selection criteria. This cursor-based design allows the rule engine to retrieve and evaluate on-hand inventory records one row at a time — typically in a priority or FIFO/LIFO sequence determined by the rule definition — without materializing the entire candidate set in a single fetch. The package body shown in the ETRM documentation centers on OPEN_CURS, whose long parameter list mirrors the dimensions by which WMS rules can filter inventory, including organization, item, transaction type, revision, lot, subinventory, locator, cost group, serial attributes, LPN, and project/task references.

Key Procedures and Functions

The package exposes four documented subprograms:

  • OPEN_CURS — Opens and populates a cursor of candidate on-hand rows. It accepts the full set of rule-selection criteria (organization, item, transaction type, revision, lot number, subinventory, locator, cost group, PP transaction temp ID, serial-control flags, serial ranges, unit number, LPN, project, and task) and copies each into package-level global variables. The cursor handle is returned via the p_cursor IN OUT NOCOPY parameter, an efficiency technique that avoids copying the large WMS_RULE_PVT.cv_pick_type record between program units. An x_result OUT parameter reports success or failure. Notably, g_revision is declared as VARCHAR2(3) and assigned directly from p_revision, reflecting the standard EBS revision column width.
  • FETCH_ONE_ROW — Retrieves a single row from the open cursor, allowing the rule engine to evaluate candidates iteratively and stop as soon as a rule is satisfied.
  • FETCH_AVAILABLE_ROWS — Performs bulk retrieval of the remaining candidate rows when the caller requires the complete result set rather than a single match.
  • CLOSE_CURS — Closes the cursor and releases associated resources, completing the open/fetch/close lifecycle.

The global variables (for example g_organization_id, g_inventory_item_id, g_revision, g_lot_number, g_locator_id) preserve the rule criteria between the OPEN, FETCH, and CLOSE calls, since the caller cannot resupply the parameters on each fetch.

Tables Accessed

The package queries the following base inventory tables through APPS synonyms:

  • MTL_ONHAND_QUANTITIES_DETAIL — the core on-hand quantity table; source of candidate stock rows.
  • MTL_ITEM_LOCATIONS — supplies locator attributes used for rule qualification.
  • MTL_SECONDARY_INVENTORIES — provides subinventory attributes for filtering and prioritization.
  • MTL_LOT_NUMBERS — supports lot-controlled item selection.
  • MTL_SERIAL_NUMBERS — supports serial-controlled item and serial-range selection.
  • PLITBLM — the standard EBS temporary/result table used to hold intermediate selection output, commonly populated by bulk rule evaluation.

Usage Notes

WMS_RULE_2 is invoked internally by the WMS rule engine during picking, put-away, and material allocation processing. Typical callers include other WMS_RULE packages, the Warehouse Management mobile (MWA) pages, and shipping/manufacturing allocation logic that calls the rule engine to resolve which on-hand records to consume. Because it is a private package body rather than a documented public API, custom code should not call it directly; developers needing the same behavior should use the supported WMS_RULE or WMS_RULE_PVT entry points. One referenced package depends on this object, so changes to WMS_RULE_2 can have cascading effects. The pattern is strictly stateful: OPEN_CURS must precede any fetch, and CLOSE_CURS must be executed to avoid leaking open cursors in long-running sessions. The g_-prefixed globals are session-scoped within a single database call and are not safe to reuse across concurrent logical requests. The package is consistent in behavior between EBS 12.1.1 and 12.2.2.