← Back to Cases
AP Invoice Lines generate_dists Incorrect and AP One-Off Invoice Corruption Fix — Oracle GDF (Bug 13579759)
Case Number00040385
Oracle ModuleAccounts Payable (AP)
EBS VersionR12
Functional AreaAP Invoices / Lines / Distributions / Tax / Matching / Prepayments
Related PatchesOracle Bug 13579759 (AP One-Off Scripts Fix)

Symptoms

Root Cause

Two separate issues are addressed by this case:

Resolution — Script 01: AP Invoice Lines generate_dists Fix

Fix generate_dists flag on AP_INVOICE_LINES_ALL
  1. Back up affected lines into a backup table (lines for invoice_id = 106840 where generate_dists = 'Y').
  2. Update AP_INVOICE_LINES_ALL: set generate_dists = 'D' for all lines in the backup table (identified by invoice_id and line_number).
  3. Commit. Re-validate the invoice.

Resolution — Script 02: AP One-Off Invoice Corruption Fix (Oracle GDF Bug 13579759)

Pre-requisite — Populate driver table

Populate AP_TEMP_DATA_DRIVER_13579759 with invoice IDs, line numbers, distribution IDs, and CORRUPTION_TYPE codes before running. Run the companion selection script (ap_one_off_scripts_sel.sql) to identify affected invoices if not already done. Set PROCESS_FLAG = 'Y' for rows to be processed.

The script processes one component per run, determined by the leading 3 characters of CORRUPTION_TYPE in the driver table (INV, CAN, MAT, TAX, or PRE).

INV Component — Invoice Data Corruption Types
CAN Component — Invoice Cancellation Corruption Types
MAT Component — Matching Corruption Types
TAX Component — Tax and AWT Corruption Types
PRE Component — Prepayment Corruption Types
Note: Script 01 contains references to an internal schema prefix in the backup table name — the actual backup table is XX_CUSTOM_AP_INVOICE_LINES_241699. Script 02 is Oracle GDF Bug 13579759 (ap_one_off_scripts_fix.sql) — it uses AP_ACCTG_DATA_FIX_PKG for HTML log output and email delivery, and driver table AP_TEMP_DATA_DRIVER_13579759. Only one corruption component (INV, CAN, MAT, TAX, or PRE) is processed per run. Populate the driver table with the correct CORRUPTION_TYPE codes and run the selection script before executing the fix. After applying, re-validate affected invoices through the AP Invoice Validation concurrent program.

Script Inventory

FileDescription
01_ap_lines_fix.sqlSets generate_dists='D' on AP_INVOICE_LINES_ALL for invoice_id=106840 lines where generate_dists='Y'. Backs up affected lines before update.
02_ap_one_off_fix.sqlOracle GDF Bug 13579759 (ap_one_off_scripts_fix.sql). Uses AP_ACCTG_DATA_FIX_PKG and driver table AP_TEMP_DATA_DRIVER_13579759. Fixes 5 component categories (INV, CAN, MAT, TAX, PRE) with 16 distinct corruption types across AP invoice, line, distribution, batch, tax, matching, and prepayment data.

Key Tables Affected

TableAction
AP_INVOICE_LINES_ALLSet generate_dists='D'; set included_tax_amount=0; set discarded_flag='N'; set default_dist_ccid=NULL; sync UOM; clear junk characters from description
AP_INVOICE_DISTRIBUTIONS_ALLSet amount/base_amount=0 for null reversed dists; set accrual/cash posted flags='N'; sync quantity_invoiced; populate rcv_transaction_id; clear junk description; delete prepayment dists
AP_INVOICES_ALLSet invoice_type_lookup_code='STANDARD'; set party_id/party_site_id; set WFApproval_Status; set force_revalidation_flag='Y'
AP_BATCHES_ALLSet org_id=NULL for mismatched batches
AP_SUPPLIER_SITES_ALLSet tax_reporting_site_flag='N' for inactive duplicate sites
AP_INV_APRVL_HIST_ALLInsert APPROVED history record for cancelled invoices
PO_DISTRIBUTIONS_ALLZero quantity_billed and amount_billed for unmatched distributions
PO_LINE_LOCATIONS_ALLRecalculate billed quantities/amounts from PO distributions
XLA_EVENTSDelete unprocessed prepayment events
XLA_AE_HEADERS / XLA_AE_LINESStrip junk characters; delete orphaned prepayment AE headers/lines
XLA_DISTRIBUTION_LINKSDelete orphaned prepayment distribution links
AP_PREPAY_HISTORY_ALL / AP_PREPAY_APP_DISTSDelete prepayment history and application distribution rows