Search Results prepay_dist_reverse




Overview

AP_ACCTG_PREPAY_DIST_PKG is a PL/SQL package body in the APPS schema of Oracle E-Business Suite (validated in 12.1.1 and 12.2.2). It is the core engine of the Payables prepayment accounting flow. Its function is to generate, adjust, reverse, and maintain the accounting distributions that result when a prepayment invoice is applied to, or released against, a standard invoice. When a supplier prepayment is applied, the prepayment is effectively consumed and the true expense or asset must be reclassified from the prepayment account to the final liability and expense distributions. This package performs that reclassification by writing rows to the AP_PREPAY_APP_DISTS and AP_PREPAY_HISTORY structures and by creating corresponding Subledger Accounting (SLA/XLA) events and headers so that the General Ledger receives balanced, auditable journal entries. Because AP_PREPAY_APP_DISTS is the primary target table of the package, the user's search term ap_prepay_app_dists_s (the sequence governing its surrogate key) points directly at the surrogate-key population logic handled inside this body.

Key Procedures and Functions

  • PREPAY_DIST_PROC — Main driver procedure that orchestrates creation of prepayment application distributions for an applied prepayment.
  • PREPAY_DIST_APPL — Builds distributions corresponding to the amount by which a prepayment is applied against an invoice.
  • PREPAY_DIST_INSERT — Performs the physical insert of calculated distribution rows into the prepayment distribution tables, including surrogate-key assignment via AP_PREPAY_APP_DISTS_S.
  • PREPAY_DIST_REVERSE — Reverses previously generated prepayment distributions, typically on unapply, invoice cancellation, or payment void.
  • PREPAY_DIST_CASCADE_ADJ — Cascades adjustments through dependent distributions when an upstream amount, tax, or exchange-rate component changes.
  • PREPAY_DIST_TAX_DIFF — Computes and posts the tax-difference portion arising when tax is recalculated on application.
  • PREPAY_DIST_ERV — Handles exchange-rate variance (realized gain/loss) on prepayment application in a multi-currency ledger.
  • UPDATE_GAIN_LOSS_IND — Maintains the gain/loss indicator flag on affected distribution records.
  • DELETE_HIST_DISTS — Removes obsolete prepayment history distribution rows, supporting reprocessing and cleanup.
  • UPG_DIST_LINKS_INSERT — Upgrade routine that back-fills distribution linkage rows so pre-existing data conforms to the current model, supporting migration to later releases.

Tables Accessed

The package reads AP_INVOICES_ALL, AP_INVOICE_LINES(_ALL), AP_INVOICE_DISTRIBUTIONS(_ALL), AP_PAYMENT_HISTORY_ALL, and AP_CHECKS_ALL to identify the prepayment, its applications, and the underlying payment. It writes AP_PREPAY_APP_DISTS and AP_PREPAY_HISTORY (keyed by AP_PREPAY_APP_DISTS_S and AP_PREPAY_HISTORY_S) to persist the generated distributions and their audit trail. AP_SYSTEM_PARAMETERS_ALL and FINANCIALS_SYSTEM_PARAMS_ALL supply accounting and rounding options; GL_CURRENCY_API, AP_ACCTG_PAY_ROUND_PKG, and AP_ACCOUNTING_PAY_PKG provide currency and rounding logic. PO_DISTRIBUTIONS_ALL and RCV_TRANSACTIONS are consulted for matched purchase-order and receiving distributions, while XLA_EVENTS and XLA_AE_HEADERS are used to create and manage the SLA events and journal headers. APP_EXCEPTION, FND_MESSAGE, FND_GLOBAL, FND_LOG, and FND_LOG_MESSAGES provide error handling, message resolution, and debug logging.

Usage Notes

This is an internal accounting package rather than a public API. It is invoked indirectly by the Payables invoice-application and prepayment-release logic — notably through AP_ACCOUNTING_PAY_PKG — whenever a prepayment is applied, adjusted, or reversed, and during the Payables Accounting Process (Create Accounting). It is also called during upgrade to populate distribution links via UPG_DIST_LINKS_INSERT. Custom code should not call these procedures directly; instead, use supported Payables APIs or the Create Accounting concurrent program, allowing this package to be triggered within the correct transaction and SLA event context. Its outputs are ultimately surfaced in the Prepayment Application Distributions and Prepayment History inquiry forms and flow through to the General Ledger.