Search Results check_unvalidated_invoices




Overview

APPS.AP_MATCH_UTILITIES_PUB is a public PL/SQL package within the Oracle E-Business Suite Payables module that provides utility logic supporting the matching relationship between payables documents and Purchasing purchase orders. Its central purpose is to determine whether unvalidated payables documents — invoices, credit memos, or debit memos — remain matched to a given purchase order before a state-changing action is permitted. Because funds reservation and purchase order closure depend on the accuracy of matched and validated documents, this package acts as a guard within the integration between Payables and Purchasing.

The package is declared with AUTHID CURRENT_USER, meaning its database objects are resolved under the privileges of the invoking user rather than the package owner, a design consistent with Oracle's public API conventions that rely on APPS synonyms and grants.

Key Procedures and Functions

The package exposes a single documented function, CHECK_UNVALIDATED_INVOICES. Its role is to return a Boolean 'TRUE' when unvalidated payables documents are matched to a purchase order, based on the identifiers supplied by the caller. The function is used to block two significant operations: unreserving funds against a purchase order, and performing a 'Final Close' on a purchase order while unvalidated invoices remain attached.

The function supports several input parameters that scope the check by level of the purchasing hierarchy. Required inputs are p_invoice_type (with values 'INVOICE' or 'CREDIT') and p_po_header_id. Optional parameters p_po_line_id, p_line_location_id, and p_po_distribution_id allow the caller to narrow the check to a PO line, shipment, or distribution respectively. A special parameter, p_invoice_id, addresses the case of a 'Final Match': when invoice validation triggers po_actions.close_po() to final close the PO, passing the invoice identifier excludes that invoice from the check, otherwise the final match or close would be impossible. A p_calling_sequence parameter records the calling module for diagnostic purposes. No other public procedures or functions are documented for this package.

Tables Accessed

The documented ETRM metadata does not enumerate specific base tables accessed by AP_MATCH_UTILITIES_PUB, and the package necessarily relies on APPS synonyms to reach Payables and Purchasing data. In practice, the function queries matched payables documents — invoices and credit or debit memos — against purchase order headers, lines, shipments, and distributions, likely through Payables invoice and matching tables such as AP_INVOICES_ALL, AP_INVOICE_DISTRIBUTIONS_ALL, and the PO-related distribution and matching views. Because the check is read-oriented, the function does not commit transactional changes; it returns a Boolean result that the caller uses to enforce business rules.

Usage Notes

CHECK_UNVALIDATED_INVOICES is typically invoked from Payables and Purchasing flows rather than executed directly by end users. It is called when a user unreserves funds for a PO, with the documented usage pattern selecting the appropriate parameters: passing p_po_line_id, p_line_location_id, and p_po_distribution_id as NULL when unreserving from the PO header; passing p_line_location_id and p_po_distribution_id as NULL from the PO line; passing p_po_distribution_id as NULL from the PO shipment; and passing all parameters when unreserving from the PO distribution.

It is also invoked to prevent Final Close of a purchase order containing unvalidated matched invoices, and during invoice validation final match processing, where the current p_invoice_id is passed to exempt the matching invoice. The ETRM metadata records that the package is referenced by two other packages, reflecting embedded calls within Payables and Purchasing APIs. Custom code should call the function through the APPS schema, respect the required parameters, and avoid maintaining its own copies of the validation logic.