| Case Number | 00030090 |
| Oracle Module | Accounts Payable (AP) / Purchasing (PO) |
| EBS Version | R12 |
| Functional Area | Invoice Processing / PO Matching |
| Related Patches | None |
The AP invoice distributions for the affected invoice became orphaned or stuck due to a failed accounting or matching event. The PO distribution tables (PO_DISTRIBUTIONS_ALL, PO_LINE_LOCATIONS_ALL) retained non-zero quantity_billed and amount_billed values even though the corresponding AP distributions were in an inconsistent state. Additionally, charge allocation (AP_CHRG_ALLOCATIONS_ALL) and multi-currency distribution (AP_MC_INVOICE_DISTS) records were orphaned.
Verify the affected invoice ID and PO distribution/line location IDs by querying AP_INVOICE_DISTRIBUTIONS_ALL and PO_DISTRIBUTIONS_ALL.
Run data_fix.sql — the script begins by creating backup tables for all rows that will be modified or deleted:
rsi_ap_dist_<case> — backup of AP_INVOICE_DISTRIBUTIONS_ALLrsi_ap_chrg_alloc_<case> — backup of AP_CHRG_ALLOCATIONS_ALLrsi_ap_mc_inv_<case> — backup of AP_MC_INVOICE_DISTSrsi_po_dist_<case> — backup of PO_DISTRIBUTIONS_ALLrsi_po_line_loc_<case> — backup of PO_LINE_LOCATIONS_ALLUpdate PO_DISTRIBUTIONS_ALL and PO_LINE_LOCATIONS_ALL to zero out quantity_billed and amount_billed for the affected PO distribution and line location.
Delete records in the following order to avoid foreign key violations:
AP_MC_INVOICE_DISTS for the affected invoice.AP_CHRG_ALLOCATIONS_ALL for charge allocations linked to the affected invoice distributions.AP_INVOICE_DISTRIBUTIONS_ALL for the affected invoice.Issue COMMIT. Verify that the invoice no longer shows distributions and the PO billed quantities are cleared.
| File | Description |
|---|---|
| data_fix.sql | Creates backup tables, resets PO billed quantities, deletes orphaned AP charge allocations, multi-currency distributions, and invoice distributions. Issues COMMIT. |
| Table | Action |
|---|---|
| PO_DISTRIBUTIONS_ALL | Update quantity_billed, amount_billed to 0 |
| PO_LINE_LOCATIONS_ALL | Update quantity_billed, amount_billed to 0 |
| AP_MC_INVOICE_DISTS | Delete for affected invoice |
| AP_CHRG_ALLOCATIONS_ALL | Delete for affected invoice distributions |
| AP_INVOICE_DISTRIBUTIONS_ALL | Delete for affected invoice |