Search Results body_code
Overview
CN_SCA_RULES_BATCH_GEN_PVT is a private PL/SQL package body in the APPS schema that serves as an internal processing engine for Oracle E-Business Suite's Advanced Pricing and credit rule functionality within the Oracle Trade Management (formerly Contracts) module. The package is classified as a Private (PVT) API, meaning it is intended for internal consumption by other packages rather than direct invocation by customers or external integrations. Its stated purpose, as documented in the package header comments, is to process Credit Rules and their associated allocation percentages. The package generates batch definitions for credit rules, dynamically constructing and executing SQL statements against the credit rule repository to evaluate and populate rule matches. Two global variables — g_package_name and g_org_id — track the executing package and the operating unit (ORG_ID), reflecting the multi-org architecture that the package honors. The current source version carries a header identifier indicating it was last revised in August 2011 (120.10), with notable history entries including the June 2003 creation by Rao.Chenna and a November 2005 enhancement by vensrini that added ORG_ID checks to the POPULATE_MATCHES procedure.
Key Procedures and Functions
The package exposes three documented procedures, each contributing to the batch generation lifecycle:
- GEN_SCA_RULES_BATCH_DYN — The namesake driver procedure. It generates the batch of SCA (Sales Credit Allocation) rules dynamically, orchestrating the assembly of rule logic and the construction of executable SQL used to evaluate rule conditions.
- POPULATE_MATCHES — Populates the set of matching credit rules and their allocation outcomes based on the evaluated conditions. This procedure was enhanced to honor ORG_ID checks, ensuring that matches are restricted to the correct operating unit in a multi-org environment.
- CREATE_SCA_RULES_BATCH_DYN — Dynamically creates the SCA rules batch, working in concert with the generation procedure to persist the batch definition. The "DYN" suffix on both GEN and CREATE procedures signals that these routines build SQL statements at runtime rather than relying on static cursors.
Supplementing these are internal helper routines, including GET_MIN (a numeric comparison utility), SEARCH_DELIMITER_SELECT (a parser that locates SQL operators and delimiters such as * , - , + , / , ( , ) , and commas within a dynamically built SELECT string), and related parsing functions. These utilities indicate that the package performs expression parsing to translate stored credit rule conditions into valid SQL predicates.
Tables Accessed
The package reads and writes a broad set of repository and configuration tables, accessed through APPS synonyms:
- CN_SCA_CREDIT_RULES — The primary credit rule repository; also the source of the ORG_ID global variable data type.
- CN_SCA_CONDITIONS and CN_SCA_COND_DETAILS — Store rule conditions and their detailed components used to build match logic.
- CN_SCA_RULE_ATTRIBUTES and CN_SCA_COMBINATIONS — Provide the attribute definitions and combination criteria for rule evaluation.
- CN_SOURCE — Supplies source information referenced by rule definitions.
- CN_OBJECTS, CN_MODULES, and CN_REPOSITORIES — Repository metadata tables defining object, module, and package registration.
- PLITBLM — A PL/SQL table-of-varchar2 type used for bulk collections and dynamic SQL bind handling.
- DBMS_SQL and DBMS_APPLICATION_INFO — Oracle-supplied packages used for dynamic SQL execution and instrumentation/concurrent request context tracking.
- USER_ERRORS — Referenced for compile-error diagnostics of dynamically generated code.
Usage Notes
Because this package is classified as a Private API, it is not intended for direct invocation by end users or external programs. It is referenced by exactly one other package, confirming its role as a subordinate internal engine. Typical invocation paths include the credit rules setup and processing flows within Oracle Trade Management / Advanced Pricing, where a calling public API or concurrent program triggers batch generation and match population. Because the package relies on DBMS_SQL and PLITBLM to assemble and execute SQL dynamically, DBMS_SQL open-cursor limits and bind-variable hygiene are relevant operational considerations. In R12.1.1 and R12.2.2, ORG_ID is enforced by POPULATE_MATCHES to respect multi-org security, so callers must ensure the correct operating unit context is initialized before invocation. The package depends on the CN_ schema tables being intact, and any repopulation of credit rules should be performed through the supported public interfaces rather than by calling this private package directly.
-
PACKAGE BODY: APPS.CN_SCA_RULES_BATCH_GEN_PVT
12.2.2
-
PACKAGE BODY: APPS.CN_FORMULA_GEN_PKG
12.1.1
-
PACKAGE BODY: APPS.CN_FORMULA_GEN_PKG
12.2.2
-
APPS.CN_SCA_RULES_BATCH_GEN_PVT SQL Statements
12.1.1
-
PACKAGE BODY: APPS.CN_SCA_RULES_ONLINE_GEN_PVT
12.1.1
-
PACKAGE BODY: APPS.CN_SCA_RULES_ONLINE_GEN_PVT
12.2.2
-
PACKAGE BODY: APPS.CN_SCA_RULES_BATCH_GEN_PVT
12.1.1
-
APPS.CN_SCA_RULES_BATCH_GEN_PVT SQL Statements
12.2.2
-
VIEW: APPLSYS.FND_ADG_PACKAGE#
12.2.2
-
VIEW: HR.PAY_TRIGGER_SUPPORT#
12.2.2
-
APPS.CN_SCA_RULES_ONLINE_GEN_PVT SQL Statements
12.1.1
-
APPS.CN_FORMULA_GEN_PKG SQL Statements
12.1.1
-
APPS.CN_SCA_RULES_ONLINE_GEN_PVT SQL Statements
12.2.2
-
APPS.CN_FORMULA_GEN_PKG SQL Statements
12.2.2
-
VIEW: APPLSYS.FND_ADG_PACKAGE#
12.2.2
owner:APPLSYS, object_type:VIEW, object_name:FND_ADG_PACKAGE#, status:VALID,
-
VIEW: HR.PAY_TRIGGER_SUPPORT#
12.2.2
owner:HR, object_type:VIEW, object_name:PAY_TRIGGER_SUPPORT#, status:VALID,
-
PACKAGE BODY: APPS.CN_COLLECTION_GEN
12.1.1
-
PACKAGE BODY: APPS.CN_UTILS
12.2.2
-
PACKAGE BODY: APPS.CN_COLLECTION_GEN
12.2.2
-
TABLE: APPLSYS.FND_ADG_PACKAGE
12.2.2
owner:APPLSYS, object_type:TABLE, fnd_design_data:FND.FND_ADG_PACKAGE, object_name:FND_ADG_PACKAGE, status:VALID,
-
PACKAGE BODY: APPS.CN_CLASSIFICATION_GEN
12.1.1
-
PACKAGE BODY: APPS.CN_CLASSIFICATION_GEN
12.2.2
-
PACKAGE BODY: APPS.CN_UTILS
12.1.1
-
TABLE: HR.PAY_TRIGGER_SUPPORT
12.1.1
owner:HR, object_type:TABLE, fnd_design_data:PAY.PAY_TRIGGER_SUPPORT, object_name:PAY_TRIGGER_SUPPORT, status:VALID,
-
TABLE: HR.PAY_TRIGGER_SUPPORT
12.2.2
owner:HR, object_type:TABLE, fnd_design_data:PAY.PAY_TRIGGER_SUPPORT, object_name:PAY_TRIGGER_SUPPORT, status:VALID,
-
PACKAGE: APPS.CN_SCA_RULES_ONLINE_GEN_PVT
12.1.1
-
PACKAGE: APPS.CN_UTILS
12.1.1
-
PACKAGE: APPS.CN_UTILS
12.2.2
-
PACKAGE: APPS.CN_SCA_RULES_ONLINE_GEN_PVT
12.2.2
-
APPS.CN_CLASSIFICATION_GEN SQL Statements
12.2.2
-
APPS.CN_CLASSIFICATION_GEN SQL Statements
12.1.1
-
PACKAGE: APPS.CN_SCA_RULES_BATCH_GEN_PVT
12.1.1
-
PACKAGE: APPS.CN_SCA_RULES_BATCH_GEN_PVT
12.2.2
-
APPS.CN_COLLECTION_GEN SQL Statements
12.1.1
-
APPS.CN_COLLECTION_GEN SQL Statements
12.2.2
-
APPS.PAYWSDYG_PKG SQL Statements
12.2.2
-
APPS.PAYWSDYG_PKG SQL Statements
12.1.1
-
PACKAGE BODY: APPS.CN_SCA_INTERFACE_MAP_PVT
12.1.1
-
PACKAGE BODY: APPS.CN_SCA_INTERFACE_MAP_PVT
12.2.2
-
APPS.CN_SCA_RULES_BATCH_GEN_PVT dependencies on CN_UTILS
12.2.2
-
APPS.CN_SCA_RULES_BATCH_GEN_PVT dependencies on CN_UTILS
12.1.1
-
APPS.CN_SCA_RULES_BATCH_GEN_PVT dependencies on CN_SCA_COMBINATIONS
12.1.1
-
APPS.CN_SCA_RULES_BATCH_GEN_PVT dependencies on CN_SCA_COMBINATIONS
12.2.2
-
APPS.CN_FORMULA_GEN_PKG dependencies on CN_UTILS
12.2.2
-
APPS.CN_FORMULA_GEN_PKG dependencies on CN_MESSAGE_PKG
12.2.2
-
APPS.CN_SCA_RULES_ONLINE_GEN_PVT dependencies on CN_UTILS
12.2.2
-
APPS.CN_SCA_RULES_ONLINE_GEN_PVT dependencies on CN_UTILS
12.1.1
-
APPS.CN_FORMULA_GEN_PKG dependencies on FND_LOG
12.2.2
-
APPS.CN_FORMULA_GEN_PKG dependencies on CN_UTILS
12.1.1
-
APPS.CN_FORMULA_GEN_PKG dependencies on CN_MESSAGE_PKG
12.1.1