← Back to Cases
AP Invoice Missing Accounting Event — Event Generation via AP_ACCOUNTING_EVENTS_PKG
Case Number00164579
Oracle ModuleAccounts Payable (AP) / Subledger Accounting (XLA)
EBS VersionR12
Functional AreaInvoice Processing / Accounting Events
Related PatchesNone

Symptoms

Root Cause

The accounting_event_id was not populated on one or more AP_INVOICE_DISTRIBUTIONS_ALL rows for the affected invoice during the normal validation process. Without an event ID, AP_ACCOUNTING_EVENTS_PKG.Create_Events cannot link distributions to an XLA event, and Create Accounting has no event to process. The fix allocates a new event ID from the XLA_EVENTS_S sequence, stamps it onto the affected distributions, and then calls AP_ACCOUNTING_EVENTS_PKG.Create_Events to generate the missing invoice accounting event.

Identification SQL

Use the following query to identify AP invoice distributions with a missing accounting event ID:

SELECT *
FROM ap_invoice_distributions_all
WHERE invoice_id  = &Invoice_ID
  AND accounting_event_id IS NULL;

Resolution

Step 1 – Create backup table

Run data_fix.sql. A backup of the affected AP_INVOICE_DISTRIBUTIONS_ALL rows (those with accounting_event_id IS NULL) is created.

Step 2 – Set org context

Call MO_GLOBAL.SET_POLICY_CONTEXT('S', <org_id>) to establish the correct operating unit context for the affected invoice.

Step 3 – Allocate a new event ID

Select xla_event_s.nextval to obtain a new accounting event ID that will be used to link the distributions to the new XLA event.

Step 4 – Stamp distributions with the new event ID

Update AP_INVOICE_DISTRIBUTIONS_ALL.accounting_event_id to the newly allocated event ID for all distributions on the affected invoice where accounting_event_id IS NULL. Commit.

Step 5 – Generate the missing accounting event

Call AP_ACCOUNTING_EVENTS_PKG.Create_Events with event type 'INVOICES', passing the invoice ID and the new event ID. This creates the XLA event record and links it to the stamped distributions. Commit after the call.

Step 6 – Re-run Create Accounting

Re-run the Create Accounting process for the affected invoice to generate the XLA accounting entries and transfer to GL.

Note: This fix targets a single invoice with distributions that have a NULL accounting_event_id. For cases involving multiple invoices or invoices with payment or cancellation events also missing, see case 00088818 which uses the full Oracle GDF framework with driver tables for batch processing across invoices, payments, and prepayments.

Script Inventory

FileDescription
data_fix.sqlPL/SQL anonymous block. Creates backup of affected AP_INVOICE_DISTRIBUTIONS_ALL rows; sets MO_GLOBAL org context; allocates xla_event_s.nextval; updates accounting_event_id on distributions with NULL event ID; calls AP_ACCOUNTING_EVENTS_PKG.Create_Events to generate the missing INVOICES accounting event.

Key Tables Affected

TableAction
AP_INVOICE_DISTRIBUTIONS_ALLUpdate accounting_event_id from NULL to new xla_event_s.nextval
XLA_EVENTSNew event record created by AP_ACCOUNTING_EVENTS_PKG.Create_Events