← Back to Cases
AP Invoice Base Amount and Variance Incorrect (Oracle Bug 9574881)
Case Number00061582
Oracle ModuleAccounts Payable (AP) / eBusiness Tax (ZX)
EBS VersionR12
Functional AreaInvoice Processing / PO Matching / Base Amount Calculation
Related Oracle Bug9574881

Symptoms

Root Cause

Oracle Bug 9574881 caused AP invoice distributions to be created with incorrect base_amount values or with amount and base_amount having opposite signs, leading to variance distribution miscalculations. The fix script uses the Oracle GDF framework to classify affected invoices into reason categories, then corrects each category with appropriate recalculations using AP_UTILITIES_PKG.ap_round_currency and the AP events status API.

Resolution

Step 1 – Populate the driver table

Populate AP_TEMP_DATA_DRIVER_9574881 with the affected invoice IDs and a reason classification before running the fix script. Reason values used by the script:

Step 2 – Run the fix script

Run data_fix.sql via SQL*Plus. The script prompts for User Name, Responsibility Name, and optionally an email address for log delivery. It creates backup tables and then processes each reason category.

Step 3 – Backup data

Backup tables are created for:

Step 4 – Fix non-cancelled invoices

For active (non-cancelled) invoices:

  1. Corrects AP_INVOICES_ALL.base_amount using ap_utilities_pkg.ap_round_currency(invoice_amount * exchange_rate).
  2. Nulls out base_amount and rounding_amt on affected invoice lines.
  3. Deletes incorrect variance distributions (TRV, TERV, TIPV, REC_TAX, NONREC_TAX) from AP_INVOICE_DISTRIBUTIONS_ALL and linked ZX_REC_NREC_DIST records.
  4. Deletes uncorrected ERV/IPV distributions.
  5. Recalculates distribution amounts using quantity × unit price for PO-matched distributions.
  6. Recalculates base_amount on reversal distributions.
  7. Nulls out total_dist_amount and total_dist_base_amount.
  8. Sets force_revalidation_flag = 'Y' on the invoice header.
  9. Calls AP_ACCOUNTING_EVENTS_PKG.UPDATE_INVOICE_EVENTS_STATUS for each affected invoice.
Step 5 – Fix cancelled invoices

For cancelled invoices:

  1. Zeros base_amount and rounding_amt on cancelled/discarded lines with zero amounts.
  2. Recalculates base_amount on distributions using the exchange rate.
  3. Recalculates total_dist_amount and total_dist_base_amount.
  4. Calls RSI_AP_Acctg_Data_Fix_PKG.repop_prepay_dists to repopulate prepayment distributions.
Step 6 – Commit and validate

The script commits and updates process_flag = 'P' in the driver table. Re-validate affected non-cancelled invoices via the AP Validate Invoices program.

Note: This fix uses the Oracle GDF (Generic Data Fix) framework via RSI_AP_Acctg_Data_Fix_PKG. The driver table AP_TEMP_DATA_DRIVER_9574881 must be created and populated before running this script. Affected invoices flagged as non-cancelled must be revalidated after the fix.

Script Inventory

FileDescription
data_fix.sqlOracle GDF fix script (Bug 9574881). Corrects AP invoice header base_amount; nulls/recalculates line and distribution base amounts; deletes incorrect variance distributions; recalculates PO-matched amounts; sets force_revalidation_flag; calls accounting events status API. Handles both cancelled and non-cancelled invoices.

Key Tables Affected

TableAction
AP_INVOICES_ALLUpdate base_amount; set force_revalidation_flag = 'Y'
AP_INVOICE_LINES_ALLNULL or zero base_amount and rounding_amt
AP_INVOICE_DISTRIBUTIONS_ALLDelete variance distributions; recalculate amounts and base_amounts; NULL total_dist_amount
ZX_REC_NREC_DISTDelete records linked to deleted variance distributions
AP_TEMP_DATA_DRIVER_9574881Driver table — read for processing; updated to process_flag = 'P' on completion