| Case Number | 00040035 |
| Oracle Module | Accounts Payable (AP) |
| EBS Version | R12 |
| Functional Area | AP Invoices / Distributions / Tax / Invoice Cancellation / Accounting |
| Related Patches | Oracle Bug 9738413 (AP Misc Invoice Corruption Fix); Oracle Bug 9088967 (AP Cancel Invoice Fix) |
match_status_flag values, orphaned tax distributions, cancelled invoices with non-zero amount_paid, missing summary_tax_line_id on TAX distributions, and reversal distributions out of sync with their originals.Two separate Oracle-released Generic Data Fix (GDF) scripts address distinct but related corruption patterns:
AP_INVOICE_DISTRIBUTIONS_ALL, AP_HOLDS_ALL, AP_INVOICE_LINES_ALL, and tax tables. Caused by edge cases in the AP processing pipeline leaving distribution, hold, and line data in inconsistent states.Both scripts use the AP_ACCTG_DATA_FIX_PKG framework with pre-populated driver tables to identify and process affected invoices.
Populate AP_TEMP_DATA_DRIVER_9738413 with the invoice_id values for all affected invoices before running the fix script.
The script iterates through invoices in the driver table and applies fixes for up to 11 corruption types:
match_status_flag incorrect for posted distributions: sets match_status_flag = 'A' (Accounted).summary_tax_line_id: deletes the orphaned TAX distribution rows from AP_INVOICE_DISTRIBUTIONS_ALL.AP_SELF_ASSESSED_TAX_DIST_ALL.AP_INVOICE_DISTRIBUTIONS_ALL.accounting_event_id: sets force_revalidation_flag = 'Y' to trigger re-accounting.AP_HOLDS_ALL.amount_paid: zeros out amount_paid and sets payment_status_flag = 'N' on AP_PAYMENT_SCHEDULES_ALL.hold_flag = 'N' on the payment schedule.amount to -1 * original_distribution.amount.match_status_flag incorrect after validation error: sets match_status_flag = 'N' (Not validated).match_status_flag incorrect for cancelled invoice distributions: sets match_status_flag = 'A'.Populate AP_TEMP_DATA_DRIVER_9088967 with the invoice_id values for all invoices that are stuck and cannot be cancelled. Invoices with AWT (Automatic Withholding Tax) distributions are automatically marked as 'X' (skip) by the script — these must be handled separately.
'X' in the driver table — these are excluded from processing.AP_ACCTG_DATA_FIX_PKG to undo any payment accounting entries (XLA events) for the affected invoice.AP_INVOICE_DISTRIBUTIONS_ALLAP_HOLDS_ALLAP_INVOICE_LINES_ALLAP_SELF_ASSESSED_TAX_DIST_ALLZX_LINESZX_LINES_SUMMARYZX_REC_NREC_DISTZX_LINES_DET_FACTORSZX_LINES_DET_FACTORS, ZX_REC_NREC_DIST, ZX_LINES, and ZX_LINES_SUMMARY for the invoice.AP_SELF_ASSESSED_TAX_DIST_ALL.AP_INVOICE_DISTRIBUTIONS_ALL.exchange_rate = 1.AP_HOLDS_ALL.AP_INVOICE_LINES_ALL that have no remaining distribution rows.amount on remaining invoice lines to match distribution totals.total_tax_amount = 0 on the invoice header (AP_INVOICES_ALL).reversal_flag and cancellation_flag on remaining distributions.match_status_flag = 'N' on all remaining distributions, clearing prior validation state.AP_ACCOUNTING_EVENTS_PKG.UPDATE_INVOICE_EVENTS_STATUS per invoice to reset the event status so that the invoice can be re-validated and cancelled cleanly.| File | Description |
|---|---|
| 01_ap_misc_invoice_fix.sql | Oracle GDF for Bug 9738413 (AP_MISC_INVOICE_FIX). Uses AP_ACCTG_DATA_FIX_PKG and driver table AP_TEMP_DATA_DRIVER_9738413. Fixes 11 distribution/hold/line/tax corruption types across affected AP invoices. |
| 02_ap_cancel_invoice_fix.sql | Oracle GDF for Bug 9088967 (ap_cancel_inv_fix). Uses AP_ACCTG_DATA_FIX_PKG and driver table AP_TEMP_DATA_DRIVER_9088967. Full undo accounting + tax deletion + distribution cleanup + event reset to repair stuck invoice cancellations. Excludes AWT invoices. |
| Table | Action |
|---|---|
| AP_INVOICE_DISTRIBUTIONS_ALL | Delete orphan/tax/reversal distributions; update match_status_flag, reversal/cancellation flags, and amounts |
| AP_INVOICE_LINES_ALL | Delete lines with no distributions; update line amounts; clear discarded/cancelled flags |
| AP_HOLDS_ALL | Delete CANNOT EXECUTE ALLOCATION holds and all holds for cancel-fix invoices |
| AP_PAYMENT_SCHEDULES_ALL | Zero amount_paid; set payment_status_flag='N'; set hold_flag='N' |
| AP_SELF_ASSESSED_TAX_DIST_ALL | Delete orphan self-assessed tax distribution rows |
| AP_INVOICES_ALL | Set total_tax_amount=0 for cancel-fix invoices |
| ZX_LINES | Delete all tax lines for cancel-fix invoices; set cancel_flag and trx_number |
| ZX_LINES_SUMMARY | Delete all tax summary lines for cancel-fix invoices |
| ZX_LINES_DET_FACTORS | Delete all tax determination factor rows for cancel-fix invoices |
| ZX_REC_NREC_DIST | Delete recoverable/non-recoverable tax distribution rows for cancel-fix invoices |