← Back to Cases
AP Missing XLA Accounting Events Fix — Oracle GDF Bug 8966238 and Manual Distribution Event Creation
Case Number00076976
Oracle ModuleAccounts Payable (AP)
EBS VersionR12
Functional AreaAP Accounting / XLA Subledger Accounting / Invoice Distributions / Payment Events
Related Oracle Bug8966238 (ap_trx_missing_event_fix.sql — Missing AP Accounting Events)

Symptoms

Root Cause

Oracle Bug 8966238 addresses a class of data corruption in R12 AP where accounting_event_id is not populated on invoice distributions or payment history records. This can occur due to failed accounting program runs, mid-process errors during invoice validation or payment processing, or incomplete data migration from 11i. Without a valid accounting_event_id, the XLA accounting engine cannot link the AP transaction to its subledger journal entries.

Two resolution approaches are used:


Resolution — Script 01: Oracle GDF Bug 8966238 (ap_trx_missing_event_fix.sql)

Generate missing XLA accounting events for AP invoices and checks

Driver Tables (must be populated before execution):

Backup Tables (created inline by the script if not already present):

Prepayment pre-processing:

  1. Resets cancellation_flag = 'N' on AP_INVOICE_DISTRIBUTIONS_ALL and AP_SELF_ASSESSED_TAX_DIST_ALL for prepayment distributions in the driver table where the flag is incorrectly set.
  2. Calls AP_ACCTG_DATA_FIX_PKG.repop_prepay_dists to repopulate prepayment accounting events before processing individual invoices.

Invoice processing loop (distinct invoice_id from driver, process_flag = 'Y'):

  1. If active non-cancelled distributions exist with accounting_event_id IS NULL: calls AP_ACCOUNTING_EVENTS_PKG.Create_Events('INVOICES', ...) to generate the INVOICE VALIDATED event.
  2. If cancelled distributions exist with accounting_event_id IS NULL: calls Create_Events('INVOICE CANCELLATION', ...) to generate the INVOICE CANCELLED event.
  3. Commits per invoice. Logs progress via AP_ACCTG_DATA_FIX_PKG.Print_html_table HTML output.

Check processing loop (distinct check_id from driver, process_flag = 'Y'):

  1. Creates output table Chk_New_Evnts_8966238 (columns: CHECK_ID, CHECK_NUMBER, CHECK_DATE, VENDOR_NAME, VENDOR_SITE_CODE, TRANSACTION_TYPE, EVENT_ID, ORG_ID) for reporting corrected payment events.
  2. If no PAYMENT event exists (count_evt_created = 0): calls Create_Events('PAYMENT', ...) to generate the PAYMENT CREATED event; updates AP_INVOICE_PAYMENTS_ALL.accounting_event_id.
  3. If no PAYMENT CREATED history record exists (count_his_created = 0): calls AP_RECONCILIATION_PKG.insert_payment_history to insert the missing PAYMENT CREATED payment history row.
  4. If check status is VOIDED and no PAYMENT CANCELLED event exists (count_evt_cancelled = 0): calls Create_Events('PAYMENT CANCELLED', ...).
  5. For other payment history types (Pay_Hist_Cur cursor — MATURITY, CLEARING) with accounting_event_id IS NULL: generates the appropriate event per transaction type.
  6. Marks driver rows as 'D' (done) when the check is fully resolved.
  7. Commits per check.

Resolution — Script 02: Manual Single-Distribution Fix (Phase A)

Manual XLA event and entity creation for invoice_distribution_id = 44988861

Used when a single AP invoice distribution is missing its XLA accounting event and the associated transaction entity record entirely. The fix performs the following steps sequentially (each step's output is used by the next):

  1. Backup distribution: CREATE TABLE rsi_ap_inv_dist_76976 AS SELECT * FROM ap_invoice_distributions_all WHERE invoice_distribution_id = 44988861.
  2. Get entity ID: SELECT XLA_TRANSACTION_ENTITIES_S.nextval FROM dual — captures the next sequence value to use as the new entity_id.
  3. Insert XLA_EVENTS: inserts one row with hardcoded values:
  4. Insert XLA_TRANSACTION_ENTITIES: inserts one row linking the new entity to the AP invoice:
  5. Update AP_INVOICE_DISTRIBUTIONS_ALL: sets accounting_event_id = 43000 where invoice_distribution_id = 44988861.
Note: Script 01 (GDF Bug 8966238) is the general-purpose solution and should be used first for all invoices and checks in the driver tables. Script 02 (Phase A) is a targeted manual fix for a specific distribution where the XLA entity and event are entirely absent — it is appropriate only when the standard GDF script cannot generate the event because the XLA_TRANSACTION_ENTITIES record itself is missing. The hardcoded values in Script 02 (event_id=43000, entity_id from sequence, source_id_int_1=25553452, ledger_id=2021, legal_entity_id=23275) are specific to the invoice being fixed; these must be determined from the actual transaction data when reusing the pattern for other distributions. The driver tables for Script 01 (AP_TEMP_INV_DRIVER_8966238, AP_TEMP_CHK_DRIVER_8966238, AP_TEMP_PREPAY_DRIVER_8966238) must be created and populated before running the GDF script. The backup table rsi_ap_inv_dist_76976 for Script 02 is created inline on first run.

Script Inventory

FileDescription
01_ap_missing_event_fix.sqlOracle GDF Bug 8966238 (ap_trx_missing_event_fix.sql). Generates missing AP accounting events for invoices (INVOICE VALIDATED, INVOICE CANCELLATION) and checks (PAYMENT CREATED, PAYMENT CANCELLED, MATURITY, CLEARING) via AP_ACCOUNTING_EVENTS_PKG.Create_Events and AP_RECONCILIATION_PKG.insert_payment_history. Resets cancellation_flag on prepayment distributions; calls AP_ACCTG_DATA_FIX_PKG.repop_prepay_dists. Driver tables: AP_TEMP_INV_DRIVER_8966238, AP_TEMP_CHK_DRIVER_8966238, AP_TEMP_PREPAY_DRIVER_8966238. Output table: Chk_New_Evnts_8966238.
02_data_fix_phase_a.sqlPhase A: Manual fix for invoice_distribution_id=44988861. Backs up to rsi_ap_inv_dist_76976; inserts XLA_EVENTS (event_id=43000, INVOICE VALIDATED, event_date=01-JUN-2016, application_id=200, status=U); inserts XLA_TRANSACTION_ENTITIES (entity_code=AP_INVOICES, source_id_int_1=25553452, ledger_id=2021, legal_entity_id=23275); updates AP_INVOICE_DISTRIBUTIONS_ALL.accounting_event_id=43000.

Key Tables Affected

TableAction
AP_INVOICE_DISTRIBUTIONS_ALLReset cancellation_flag='N' for prepay dists (Script 01); update accounting_event_id for processed invoices (Script 01); update accounting_event_id=43000 for invoice_distribution_id=44988861 (Script 02)
AP_SELF_ASSESSED_TAX_DIST_ALLReset cancellation_flag='N' for prepay dists in driver (Script 01)
AP_INVOICE_PAYMENTS_ALLUpdate accounting_event_id for checks where PAYMENT event is newly created (Script 01)
AP_PAYMENT_HISTORY_ALLInsert missing PAYMENT CREATED history rows via AP_RECONCILIATION_PKG.insert_payment_history (Script 01)
XLA_EVENTSInsert new XLA event record (event_id=43000, INVOICE VALIDATED) for missing-entity distribution (Script 02)
XLA_TRANSACTION_ENTITIESInsert new XLA transaction entity record linking AP invoice to XLA (Script 02)
AP_INV_DISTS_8966238Backup of AP_INVOICE_DISTRIBUTIONS_ALL for affected distributions (Script 01)
AP_SA_INV_DISTS_8966238Backup of AP_SELF_ASSESSED_TAX_DIST_ALL for affected distributions (Script 01)
AP_INV_PAYMENTS_8966238Backup of AP_INVOICE_PAYMENTS_ALL rows with null accounting_event_id (Script 01)
AP_PAY_HIS_8966238Backup of AP_PAYMENT_HISTORY_ALL rows with null accounting_event_id (Script 01)
Chk_New_Evnts_8966238Output table recording newly created check accounting events (Script 01)
rsi_ap_inv_dist_76976Backup of AP_INVOICE_DISTRIBUTIONS_ALL for invoice_distribution_id=44988861 (Script 02 — created inline)