Search Results p_invoice_type




Overview

APPS.AP_MATCH_UTILITIES_PUB is a public PL/SQL package body within the Oracle Payables (AP) module of Oracle E-Business Suite. Its documented purpose is to provide utility logic that supports the matching relationship between Payables documents (invoices, credit memos, and debit memos) and Purchasing (PO) documents. The package body header indicates a revision lineage dating to 2011 (aprmtutb.pls 120.4), which places it within the maintenance stream common to both EBS 12.1.1 and 12.2.2.

The central business problem the package addresses is the integrity of the PO-to-invoice matching lifecycle. When a user attempts to unreserve funds against a PO or to final close a PO, Payables must first determine whether any unvalidated documents remain matched to that PO. If unvalidated matched documents exist, allowing the operation to proceed would produce inconsistent encumbrance and matching states. AP_MATCH_UTILITIES_PUB encapsulates that check so that it can be reused across unreserve and close operations at multiple levels of the PO document hierarchy.

Key Procedures and Functions

The package exposes a single documented function:

  • CHECK_UNVALIDATED_INVOICES — Returns TRUE if there are unvalidated Payables documents (invoices, credit memos, or debit memos) matched to a Purchase Order, based on the input parameters supplied. The function is designed to be called when the user unreserves funds for a PO, and it can also be used to prevent Final Close of a PO when unvalidated invoices remain matched to it.

The documented parameters for this function include p_invoice_type and p_po_header_id, both described as required. p_invoice_type accepts the values 'INVOICE' or 'CREDIT'. The remaining parameters address progressively finer levels of the PO hierarchy — PO line, line location (shipment), and PO distribution — plus p_invoice_id and p_calling_sequence.

Tables Accessed

The documented ETRM metadata does not enumerate the base tables referenced by this package through APPS synonyms. Based on its stated function, the package necessarily queries the Payables invoice and invoice distribution tables (such as AP_INVOICES_ALL and AP_INVOICE_DISTRIBUTIONS_ALL) and the Purchasing matching and distribution tables to correlate invoices with the PO, line, shipment, and distribution identifiers passed as parameters. Because no table list is published in the metadata, this section should be verified against the package source in the target instance before being relied upon for customization.

Usage Notes

The function is invoked in two principal contexts. First, during unreserve of PO funds, the caller passes a level-appropriate subset of parameters: unreserving from the PO header passes the line, line location, and distribution identifiers as NULL; unreserving from the PO line passes line location and distribution as NULL; unreserving from the PO shipment passes distribution as NULL; and unreserving from the PO distribution passes all parameters. Second, during invoice validation, Payables invokes po_actions.close_po() to Final Close a PO that has been marked for Final Match.

The p_invoice_id parameter exists specifically for that Final Match case. When close_po() is invoked as a result of a Final Match, the invoice performing the match must be passed in so that the check skips it; otherwise the invoice would block its own match and the PO could never be closed. Custom code calling this function should therefore always supply a correct calling sequence and should respect the NULL-passing convention for hierarchy levels above the one being acted upon.