Search Results get_avail_line_corr_amount
Overview
APPS.AP_MATCHING_UTILS_PKG is a shared PL/SQL utility package within the Oracle E-Business Suite Payables (AP) module. Its primary business function is to supply the low-level computational and data-retrieval logic required to support invoice-to-purchase-order and invoice-to-receipt matching. Invoice matching is the process by which Payables validates that supplier invoices correspond to goods received and purchase order commitments before payment is authorized. Rather than performing matching itself, AP_MATCHING_UTILS_PKG provides the helper routines that the higher-level matching engine (AP_MATCHING_PKG) and validation processes call to determine quantities, prices, amounts, and correction tolerances on receipts, distributions, and invoice lines. The package is classified as OTHER in the ETRM metadata, indicating it is not an externally-facing public API but an internal utility library. It resides in the APPS schema, is VALID, and exposes twenty-seven documented procedures and functions.
Key Procedures and Functions
The documented subprograms fall into several functional groupings:
- Session and setup: INITIALIZE prepares the package state before matching operations begin.
- Quantity and distribution retrieval: GET_NUM_PO_DISTS and GET_NUM_LINE_DISTS return counts of purchase order distributions and invoice line distributions. GET_RECEIPT_QUANTITIES, GET_RECPT_DIST_QTY_BILLED, and GET_RECPT_DIST_AMT_BILLED retrieve received, billed, and outstanding quantities and amounts at the receipt and receipt-distribution level.
- Correction calculations: GET_CORRECTION_QUANTITY, GET_CORRECTION_UNIT_PRICE, GET_CORRECTION_AMOUNT, and GET_CORRECTION_QUANTITY_DIST compute corrective quantities, unit prices, and amounts needed when matching tolerances or prior matches must be adjusted.
- Available correction limits: GET_AVAIL_DIST_CORR_AMOUNT, GET_AVAIL_LINE_CORR_AMOUNT, GET_AVAIL_LINE_CORR_QTY, and GET_AVAIL_INV_CORR_AMOUNT determine how much correction remains available against a distribution, line, or invoice.
- Matching operations: MATCH_INVOICE_LINE performs the core line-level matching action; INSERT_ADJUSTED_RECEIPT_IDS records receipts adjusted during matching; GET_LINE_ASSOC_CHARGE identifies associated charges.
- Recoupment and upgrade handling: AP_RECOUP_INVOICE_LINE and GET_INV_LINE_RECOUPED_AMOUNT manage recoupment of invoice lines, while AP_UPGRADE_PO_SHIPMENT supports data upgrade paths for purchase order shipments.
Tables Accessed
The package operates against the core Payables and related transactional tables through APPS synonyms. Invoice and line data are read from AP_INVOICES, AP_INVOICES_ALL, AP_INVOICE_LINES, and AP_INVOICE_LINES_ALL, with distribution-level detail held in AP_INVOICE_DISTRIBUTIONS and AP_INVOICE_DISTRIBUTIONS_ALL. Supplier and site context is obtained from AP_SUPPLIERS and AP_SUPPLIER_SITES_ALL. Payment and term reference data draws on AP_INVOICE_PAYMENTS and AP_TERMS. System-wide behavior is governed by AP_SYSTEM_PARAMETERS, while AP_ALLOCATION_RULE_LINES supports allocation logic. Currency, territory, and message lookups use FND_CURRENCIES, FND_TERRITORIES_TL, and FND_NEW_MESSAGES respectively. These tables supply the quantities, amounts, and configuration settings required for matching computations and correction tolerance checks.
Usage Notes
AP_MATCHING_UTILS_PKG is an internal dependency rather than a directly invoked public API. The ETRM metadata shows it is referenced by sixteen other packages, including AP_MATCHING_PKG, AP_APPROVAL_PKG, AP_INVOICE_LINES_PKG, AP_PO_AMT_MATCH_PKG, AP_RCT_AMT_MATCH_PKG, AP_RECT_MATCH_PKG, AP_PREPAY_PKG, AP_RETAINAGE_RELEASE_PKG, AP_RECURRING_INVOICES_PKG, and AP_IMPORT_UTILITIES_PKG, as well as the views AP_INVOICE_LINES_V, AP_VIEW_PREPAYS_V, and AP_VIEW_PREPAYS_FR_PREPAY_V. In practice it is exercised whenever invoices are entered, matched, approved, or imported through the Payables forms and concurrent programs, since those processes delegate the underlying matching calculations to it. Customizations should generally avoid calling this package directly, as its interface is not guaranteed for external use; instead, extensions should invoke the documented matching APIs that wrapper this utility. Its own dependencies are limited to SYS.STANDARD, confirming it is a foundational helper layer within the AP stack.