| Case Number | 00076976 |
| Oracle Module | Accounts Payable (AP) |
| EBS Version | R12 |
| Functional Area | AP Accounting / XLA Subledger Accounting / Invoice Distributions / Payment Events |
| Related Oracle Bug | 8966238 (ap_trx_missing_event_fix.sql — Missing AP Accounting Events) |
accounting_event_id values — the field is NULL on AP_INVOICE_DISTRIBUTIONS_ALL or AP_PAYMENT_HISTORY_ALL — preventing the Subledger Accounting (XLA) engine from creating journal entries for the affected transactions.cancellation_flag that prevents event generation from being triggered by standard AP programs.XLA_EVENTS record, an XLA_TRANSACTION_ENTITIES record, and an update to AP_INVOICE_DISTRIBUTIONS_ALL.accounting_event_id.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:
ap_trx_missing_event_fix.sql. Uses driver tables to identify affected invoices, prepayment distributions, and checks; calls AP_ACCOUNTING_EVENTS_PKG.Create_Events and AP_RECONCILIATION_PKG.insert_payment_history to generate missing events; commits per invoice/check.invoice_distribution_id = 44988861) where the XLA event and transaction entity records are entirely absent. Directly inserts into XLA_EVENTS and XLA_TRANSACTION_ENTITIES and updates AP_INVOICE_DISTRIBUTIONS_ALL.accounting_event_id.Driver Tables (must be populated before execution):
AP_TEMP_INV_DRIVER_8966238 — Invoice driver: (invoice_id, invoice_distribution_id, org_id, distribution_type, process_flag). Set process_flag = 'Y' for invoices to process.AP_TEMP_CHK_DRIVER_8966238 — Check driver: (check_id, org_id, process_flag). Set process_flag = 'Y' for checks to process.AP_TEMP_PREPAY_DRIVER_8966238 — Prepayment distribution driver: (invoice_distribution_id, distribution_type, process_flag).Backup Tables (created inline by the script if not already present):
AP_INV_DISTS_8966238 — Backup of AP_INVOICE_DISTRIBUTIONS_ALL for affected distributions.AP_SA_INV_DISTS_8966238 — Backup of AP_SELF_ASSESSED_TAX_DIST_ALL for affected self-assessed tax distributions.AP_INV_PAYMENTS_8966238 — Backup of AP_INVOICE_PAYMENTS_ALL rows where accounting_event_id IS NULL.AP_PAY_HIS_8966238 — Backup of AP_PAYMENT_HISTORY_ALL rows where accounting_event_id IS NULL.Prepayment pre-processing:
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.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'):
accounting_event_id IS NULL: calls AP_ACCOUNTING_EVENTS_PKG.Create_Events('INVOICES', ...) to generate the INVOICE VALIDATED event.accounting_event_id IS NULL: calls Create_Events('INVOICE CANCELLATION', ...) to generate the INVOICE CANCELLED event.AP_ACCTG_DATA_FIX_PKG.Print_html_table HTML output.Check processing loop (distinct check_id from driver, process_flag = 'Y'):
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.count_evt_created = 0): calls Create_Events('PAYMENT', ...) to generate the PAYMENT CREATED event; updates AP_INVOICE_PAYMENTS_ALL.accounting_event_id.count_his_created = 0): calls AP_RECONCILIATION_PKG.insert_payment_history to insert the missing PAYMENT CREATED payment history row.count_evt_cancelled = 0): calls Create_Events('PAYMENT CANCELLED', ...).Pay_Hist_Cur cursor — MATURITY, CLEARING) with accounting_event_id IS NULL: generates the appropriate event per transaction type.'D' (done) when the check is fully resolved.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):
CREATE TABLE rsi_ap_inv_dist_76976 AS SELECT * FROM ap_invoice_distributions_all WHERE invoice_distribution_id = 44988861.SELECT XLA_TRANSACTION_ENTITIES_S.nextval FROM dual — captures the next sequence value to use as the new entity_id.event_id = 43000, application_id = 200 (AP)event_type_code = 'INVOICE VALIDATED'event_date = 01-JUN-2016entity_id = <nextval from step 2>event_status_code = 'U', process_status_code = 'U' (unprocessed)event_number = 1entity_id = <nextval from step 2>, application_id = 200legal_entity_id = 23275entity_code = 'AP_INVOICES'source_id_int_1 = 25553452 (invoice_id)security_id_int_1 = 85 (org_id)transaction_number = '60499829'ledger_id = 2021accounting_event_id = 43000 where invoice_distribution_id = 44988861.| File | Description |
|---|---|
| 01_ap_missing_event_fix.sql | Oracle 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.sql | Phase 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. |
| Table | Action |
|---|---|
| AP_INVOICE_DISTRIBUTIONS_ALL | Reset 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_ALL | Reset cancellation_flag='N' for prepay dists in driver (Script 01) |
| AP_INVOICE_PAYMENTS_ALL | Update accounting_event_id for checks where PAYMENT event is newly created (Script 01) |
| AP_PAYMENT_HISTORY_ALL | Insert missing PAYMENT CREATED history rows via AP_RECONCILIATION_PKG.insert_payment_history (Script 01) |
| XLA_EVENTS | Insert new XLA event record (event_id=43000, INVOICE VALIDATED) for missing-entity distribution (Script 02) |
| XLA_TRANSACTION_ENTITIES | Insert new XLA transaction entity record linking AP invoice to XLA (Script 02) |
| AP_INV_DISTS_8966238 | Backup of AP_INVOICE_DISTRIBUTIONS_ALL for affected distributions (Script 01) |
| AP_SA_INV_DISTS_8966238 | Backup of AP_SELF_ASSESSED_TAX_DIST_ALL for affected distributions (Script 01) |
| AP_INV_PAYMENTS_8966238 | Backup of AP_INVOICE_PAYMENTS_ALL rows with null accounting_event_id (Script 01) |
| AP_PAY_HIS_8966238 | Backup of AP_PAYMENT_HISTORY_ALL rows with null accounting_event_id (Script 01) |
| Chk_New_Evnts_8966238 | Output table recording newly created check accounting events (Script 01) |
| rsi_ap_inv_dist_76976 | Backup of AP_INVOICE_DISTRIBUTIONS_ALL for invoice_distribution_id=44988861 (Script 02 — created inline) |