| Case Number | 00040385 |
| Oracle Module | Accounts Payable (AP) |
| EBS Version | R12 |
| Functional Area | AP Invoices / Lines / Distributions / Tax / Matching / Prepayments |
| Related Patches | Oracle Bug 13579759 (AP One-Off Scripts Fix) |
generate_dists = 'Y' when they should have 'D' (distributions already generated), causing the AP Invoice Validation process to attempt to regenerate distributions that already exist.Two separate issues are addressed by this case:
generate_dists = 'Y' but the distributions were already created. This causes the validation engine to re-attempt distribution generation, creating duplicates or validation errors.ap_one_off_scripts_fix.sql). Addresses 5 categories of AP invoice data corruption across INV (invoice), CAN (cancel), MAT (matching), TAX (tax/AWT), and PRE (prepayment) components. Uses the AP_ACCTG_DATA_FIX_PKG framework with pre-populated driver table AP_TEMP_DATA_DRIVER_13579759.generate_dists = 'Y').AP_INVOICE_LINES_ALL: set generate_dists = 'D' for all lines in the backup table (identified by invoice_id and line_number).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).
amount = 0, base_amount = 0 on parent and reversal distributions.description in AP_INVOICE_LINES_ALL, AP_INVOICE_DISTRIBUTIONS_ALL, XLA_AE_HEADERS, and XLA_AE_LINES.default_dist_ccid = NULL.org_id mismatch between AP batches and invoices → set AP_BATCHES_ALL.org_id = NULL.invoice_type_lookup_code NULL for upgraded invoices → set to 'STANDARD'.party_id and party_site_id null on upgraded invoices → populate from AP_Suppliers and AP_Supplier_Sites_All.generate_dists flag incorrect for expense report invoice lines → set 'D'.accrual_posted_flag and cash_posted_flag null for unaccounted distributions → set both to 'N'.discarded_flag = 'N'.included_tax_amount not null for cancelled invoice → set to 0 on AP_INVOICE_LINES_ALL.AP_INV_APRVL_HIST_ALL; set WFApproval_Status = 'NOT REQUIRED' on AP_INVOICES_ALL.quantity_billed, amount_billed, and related columns on PO_DISTRIBUTIONS_ALL; recalculate sums on PO_LINE_LOCATIONS_ALL.UNIT_MEAS_LOOKUP_CODE from PO_LINE_LOCATIONS_ALL to AP lines; sync MATCHED_UOM_LOOKUP_CODE on AP distributions.quantity_invoiced mismatch between AP line and distribution → recalculate per distribution based on whether single or multiple ITEM/ACCRUAL distributions exist for the line.rcv_transaction_id → populate from driver table PO_AP_LINE_ID / PO_AP_DIST_ID columns.base_amount = amount.tax_reporting_site_flag = 'N' on AP_SUPPLIER_SITES_ALL.accounting_date and period_name from parent distribution; reset accounting_event_id = NULL and match_status_flag = 'N'; delete unprocessed XLA events and prepay history rows.force_revalidation_flag = 'Y' on AP_INVOICES_ALL.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.
| File | Description |
|---|---|
| 01_ap_lines_fix.sql | Sets 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.sql | Oracle 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. |
| Table | Action |
|---|---|
| AP_INVOICE_LINES_ALL | Set 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_ALL | Set 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_ALL | Set invoice_type_lookup_code='STANDARD'; set party_id/party_site_id; set WFApproval_Status; set force_revalidation_flag='Y' |
| AP_BATCHES_ALL | Set org_id=NULL for mismatched batches |
| AP_SUPPLIER_SITES_ALL | Set tax_reporting_site_flag='N' for inactive duplicate sites |
| AP_INV_APRVL_HIST_ALL | Insert APPROVED history record for cancelled invoices |
| PO_DISTRIBUTIONS_ALL | Zero quantity_billed and amount_billed for unmatched distributions |
| PO_LINE_LOCATIONS_ALL | Recalculate billed quantities/amounts from PO distributions |
| XLA_EVENTS | Delete unprocessed prepayment events |
| XLA_AE_HEADERS / XLA_AE_LINES | Strip junk characters; delete orphaned prepayment AE headers/lines |
| XLA_DISTRIBUTION_LINKS | Delete orphaned prepayment distribution links |
| AP_PREPAY_HISTORY_ALL / AP_PREPAY_APP_DISTS | Delete prepayment history and application distribution rows |