Search Results cn_trx




Overview

APPS.CN_COLLECTION_AR_GEN is a server-side PL/SQL package body within the Oracle E-Business Suite Collections (Advanced Collections / ETRM) module. Its principal business function is to generate and maintain the transaction staging records that feed the Collections engine, converting source Receivables activity into the internal CN_TRX header and line structures used by the collections workflow. The package is the AR side of the Collections generation layer, orchestrating inserts and updates against transaction header, transaction line, sales line, invoice total, and commission line stores.

The body is heavily metadata-driven. Rather than hard-coding column mappings, it resolves source-to-destination column relationships from the Collections mapping repository (CN_TABLE_MAPS, CN_COLUMN_MAPS, CN_OBJECTS). The internal cursor header_direct_maps demonstrates this pattern, selecting destination column names and expressions for mapping type 'INV1' while honoring Multi-Org Access Control (MOAC) through ORG_ID predicates on each mapping table. The header indicates a legacy lineage dating from 1993, with continued maintenance through 2005 and later MOAC retrofits.

Key Procedures and Functions

Eight documented procedures compose the public interface of the package:

  • INSERT_TRX — Inserts header-level records into the CN_TRX table, assembling column values from the resolved mapping metadata for the given module, event, and organization.
  • UPDATE_TRX — Maintains existing CN_TRX header records, applying refreshed or corrected mapping values.
  • INSERT_LINES — Creates CN_TRX line-level records associated with a transaction header.
  • UPDATE_LINES — Modifies existing transaction line records to reflect source changes.
  • INSERT_SALES_LINES — Populates sales line detail used to represent the revenue/line-item composition of the underlying AR transaction.
  • UPDATE_SALES_LINES — Maintains existing sales line detail records.
  • UPDATE_INVOICE_TOTAL — Recalculates and refreshes invoice total amounts held against the transaction header.
  • INSERT_COMM_LINES — Inserts commission-related line records associated with the transaction.

The procedures accept diagnostic and context parameters including a procedure name, module and event identifiers, an organization identifier, and a code accumulator used to append generated SQL and debug text. The code accumulator is manipulated via CN_UTILS helpers such as appendcr and org-id set/unset calls, and tracing is emitted through CN_DEBUG and FND_FILE.

Tables Accessed

The package reads and writes the following documented tables through APPS synonyms:

  • CN_EVENTS — Supplies the Collections event context that drives which mapping and generation logic applies.
  • CN_MODULES — Identifies the source module (and module type) being collected, governing which column maps are selected.
  • CN_TABLE_MAPS — Defines table-level mapping rows, including the INV1 mapping type used for transaction header generation and the ORG_ID used for MOAC filtering.
  • CN_COLUMN_MAPS — Provides column-level mapping expressions that resolve destination values for the CN_TRX structures.
  • CN_OBJECTS — Resolves destination column identities and names referenced by the column maps.

Writes are directed to the CN_TRX header, line, sales line, invoice total, and commission line tables implied by the procedure set.

Usage Notes

CN_COLLECTION_AR_GEN is invoked as a generation utility rather than called directly from end-user forms. It is typically executed by the Collections generation and refresh flow — either from a concurrent program or from within the parent Collections package that encapsulates the AR collection routines — when AR transactions must be staged into CN_TRX. It is referenced by one other package in the documented dependency set, indicating it is a subordinate building block consumed by higher-level collection orchestration logic.

Because the procedure interface exchanges an IN OUT NOCOPY code accumulator, callers are expected to initialize and subsequently execute or log the generated statements using CN_UTILS facilities. Custom code should avoid direct invocation unless reproducing the standard generation sequence, and should always pass a valid ORG_ID, since the metadata queries are MOAC-filtered on ORG_ID and will return no mappings outside the caller's organization context.