← Back to Cases
AP Invoice ZX Tax Lines Transaction Number Incorrect — Update ZX_LINES, ZX_LINES_SUMMARY, ZX_LINES_DET_FACTORS
Case Number00039693
Oracle ModuleAccounts Payable (AP) / E-Business Tax (ZX)
EBS VersionR12
Functional AreaAP Invoices / Tax / ZX Tax Lines
Related PatchesNone

Symptoms

Root Cause

The E-Business Tax (ZX) tax line tables (ZX_LINES, ZX_LINES_SUMMARY, ZX_LINES_DET_FACTORS) store the AP invoice number in a trx_number column. For the two affected invoices, this value was populated incorrectly at invoice creation time and does not match the current invoice_num in AP_INVOICES_ALL. The fix updates trx_number to the correct invoice number across all three ZX tables, sets cancel_flag = 'Y' on the ZX lines where applicable, and resets the object_version_number as required by the ZX data model.

Identification SQL

Use the following query to identify invoices where the ZX transaction number does not match the AP invoice number:

SELECT ai.invoice_id, ai.invoice_num, zl.trx_number
FROM   ap_invoices_all ai
       JOIN zx_lines zl ON zl.trx_id = ai.invoice_id
                       AND zl.application_id = 200
                       AND zl.entity_code = 'AP_INVOICES'
WHERE  ai.invoice_id IN (&invoice_ids)
  AND  zl.trx_number != ai.invoice_num;

Resolution

Step 1 – Create backup tables

Run data_fix.sql (backup section). Creates backup copies of all affected ZX rows before any updates:

Step 2 – Correct ZX_LINES_DET_FACTORS trx_number

For each affected invoice, update ZX_LINES_DET_FACTORS to set trx_number to the correct invoice number (matching AP_INVOICES_ALL.invoice_num). The update is keyed on trx_id = <invoice_id> and application_id = 200.

Step 3 – Correct ZX_LINES trx_number and set cancel_flag

For each affected invoice, update ZX_LINES to:

The update is applied separately for each of the two invoice IDs.

Step 4 – Correct ZX_LINES_SUMMARY trx_number

For each affected invoice, update ZX_LINES_SUMMARY to set trx_number to the correct invoice number. The update is keyed on trx_id = <invoice_id>.

Step 5 – Commit and validate

Commit after all updates. Verify that trx_number in all three ZX tables now matches invoice_num in AP_INVOICES_ALL for both affected invoices. Re-run any tax reports or reconciliation processes that previously showed the mismatch.

Note: The two affected invoice IDs are 5191146 and 5118262. Each invoice is handled separately within the script, as the correct trx_number values differ per invoice. The object_version_number = 1296120000 value is a standard reset value used in ZX data fixes to force the row to be treated as newly written; confirm this is appropriate for the ZX version in the target environment. Always back up before applying.

Script Inventory

FileDescription
data_fix.sqlCreates backup tables for ZX_LINES_DET_FACTORS, ZX_LINES, and ZX_LINES_SUMMARY. For each of the two affected invoice IDs: updates trx_number to match AP_INVOICES_ALL.invoice_num in all three ZX tables; sets cancel_flag='Y' and object_version_number=1296120000 on ZX_LINES.

Key Tables Affected

TableAction
ZX_LINESUpdate trx_number to correct invoice number; set cancel_flag='Y'; set object_version_number=1296120000
ZX_LINES_SUMMARYUpdate trx_number to correct invoice number
ZX_LINES_DET_FACTORSUpdate trx_number to correct invoice number
AP_INVOICES_ALLRead only — source for correct invoice_num values