← Back to Cases
AP Invoice Tax Distributions Out of Sync with ZX Tables
Case Number00030902
Oracle ModuleAccounts Payable (AP) / eBusiness Tax (ZX)
EBS VersionR12
Functional AreaInvoice Validation / Tax Processing
Related PatchesNone

Symptoms

Root Cause

A partial or failed accounting event left certain invoice lines and their associated eBusiness Tax (ZX) records in an inconsistent state. Specifically, an XLA event was created and linked to some distributions, but the corresponding ZX tax calculation tables (ZX_REC_NREC_DIST, ZX_LINES, ZX_LINES_SUMMARY, ZX_LINES_DET_FACTORS) retained stale or duplicate rows. The fix removes the orphaned XLA event and ZX records, cleans up the affected invoice lines, then corrects the remaining distribution amounts.

Resolution

Step 1 – Create backup tables

Run data_fix.sql. The script creates backup tables for all affected rows across AP and ZX tables before any modifications:

Step 2 – Delete orphaned ZX tax records

Delete from ZX tables in the following order for the affected invoice and accounting event:

  1. ZX_REC_NREC_DIST — for distributions linked to the orphaned accounting event and for specific invoice line numbers
  2. ZX_LINES — for the affected transaction and line IDs
  3. ZX_LINES_SUMMARY — for the affected summary tax line IDs
  4. ZX_LINES_DET_FACTORS — for the affected transaction/line/entity/event class combination
Step 3 – Delete AP distributions and invoice lines

Delete from AP_INVOICE_DISTRIBUTIONS_ALL for distributions linked to the orphaned accounting event and the specific invoice line numbers. Delete the corresponding rows from AP_INVOICE_LINES_ALL.

Step 4 – Delete orphaned XLA event

Delete the orphaned row from XLA_EVENTS by event ID.

Step 5 – Correct invoice and distribution amounts

Update AP_INVOICES_ALL to clear force_revalidation_flag and validation_request_id. Update AP_HOLDS_ALL to release outstanding holds. Correct distribution amounts in AP_INVOICE_DISTRIBUTIONS_ALL and line amounts in AP_INVOICE_LINES_ALL to reflect the correct totals.

Step 6 – Commit and revalidate

Issue COMMIT. Re-run AP Invoice Validation for the affected invoice to regenerate tax lines and accounting events cleanly.

Note: The original script (iteration A) was superseded; this is the final working version (iteration B). Ensure all backup tables are created successfully before proceeding with the deletes.

Script Inventory

FileDescription
data_fix.sqlCreates backups for AP and ZX tables; deletes orphaned ZX tax records, AP distributions, AP invoice lines, and the stale XLA event; corrects invoice/distribution amounts; releases holds.

Key Tables Affected

TableAction
XLA_EVENTSDelete orphaned event
ZX_REC_NREC_DISTDelete orphaned tax distributions
ZX_LINESDelete orphaned tax lines
ZX_LINES_SUMMARYDelete orphaned tax line summaries
ZX_LINES_DET_FACTORSDelete orphaned tax determining factor records
AP_INVOICE_DISTRIBUTIONS_ALLDelete affected distributions; correct amounts
AP_INVOICE_LINES_ALLDelete affected lines; correct amounts
AP_INVOICES_ALLClear revalidation flags
AP_HOLDS_ALLRelease outstanding holds