| Case Number | 00166693 |
| Oracle Module | Accounts Payable (AP) / Subledger Accounting (XLA) |
| EBS Version | R12 |
| Functional Area | XLA Subledger Accounting / GL Transfer / AP Invoice Distributions / AP Liability Balance |
| Related Patches | None |
XLA_AE_HEADERS rows exist for AP invoice events (application_id=200, February 2019, ledger_id=7244) with gl_transfer_status_code = 'Y' (transferred) and accounting_entry_status_code = 'F' (final), but no corresponding rows exist in GL_IMPORT_REFERENCES — meaning the subledger accounting was marked as transferred to the GL but no actual GL journal lines were created.POSTED_FLAG = 'Y', ACCRUAL_POSTED_FLAG = 'Y') despite the absence of GL journal entries, causing the AP subledger to show balances that do not exist in the GL.The XLA accounting entry creation and GL transfer process completed for a set of AP invoice headers but the corresponding GL_IMPORT_REFERENCES rows (which link XLA subledger lines to GL journal lines) were never created — or were deleted after transfer. The headers are stuck in a state that prevents normal re-transfer. The resolution is to delete the orphaned XLA accounting structures (headers, lines, and distribution links), reset the associated XLA events to unprocessed, and reset the AP invoice distributions to unposted so the full Create Accounting → Transfer to GL sequence can be repeated.
Script 01_setup_driver_tables.sql is labeled for Case 158080 and addresses a related but separate AP Liability Balance CCID problem included with this engagement. It uses EXECUTE IMMEDIATE to create a driver table named RSI_AP_DRIVER_TABLE_158080.
EXECUTE IMMEDIATE statement for creating RSI_AP_DRIVER_TABLE_158080 contains only a bare SELECT statement rather than a CREATE TABLE AS SELECT statement. As written, the dynamic SQL executes a query and discards the result set — it does not create the table. The SELECT identifies XLA_AE_HEADERS rows (application_id=200, AP_INVOICES entity, February 2019, ledger_id=7244, gl_transfer_status_code='Y', accounting_entry_status_code='F') that have a gl_sl_link_id but no corresponding GL_IMPORT_REFERENCES entry, grouped by invoice_id, event_id, ae_header_id, ledger_id, period_name, group_id, and account. The table must be created manually by prepending CREATE TABLE RSI_AP_DRIVER_TABLE_158080 AS to the SELECT before execution.
Script 02_apply_data_fix.sql is also labeled for Case 158080 and corrects incorrect code_combination_id values on AP_LIABILITY_BALANCE and AP_AE_LINES_ALL. Logic is identical to the Case 88203 liability balance fix pattern:
RSI_AP_DRIVER_TABLE_158080.inv_credit <> 0) in the driver.AP_LIABILITY_BALANCE to AP_AE_LINES_ALL where code_combination_id <> v_new_ccid and LAST_UPDATED_BY <> -158080.RSI_AP_AE_LINES_158080 and RSI_AP_LIA_BALANCE_158080.AP_LIABILITY_BALANCE.CODE_COMBINATION_ID and AP_AE_LINES_ALL.CODE_COMBINATION_ID to the correct value.l_gl_transfer flag — currently FALSE). Uses RSI_GL_INTERFACE_158080 as the GL interface staging table.RSI_AP_TB_RECON_158080.Script 03_supplemental_fix.sql is the primary operational fix for Case 00166693. It is plain SQL (no PL/SQL wrapper) and executes the following steps:
CREATE TABLE rsi_ap_driver_table_166693A AS
SELECT ... FROM XLA_AE_HEADERS xah
JOIN XLA_TRANSACTION_ENTITIES xte ON ...
WHERE xah.application_id = 200
AND xte.entity_code = 'AP_INVOICES'
AND xah.period_name LIKE '%FEB-19%'
AND xah.ledger_id = 7244
AND xah.gl_transfer_status_code = 'Y'
AND xah.accounting_entry_status_code = 'F'
AND NOT EXISTS (SELECT 1 FROM GL_IMPORT_REFERENCES gir
WHERE gir.gl_sl_link_id = xah.gl_sl_link_id)
GROUP BY invoice_id, event_id, ae_header_id, ledger_id,
period_name, group_id, account
Creates three indexes on the driver: RSI_AP_DRIVER_IDX1_166693 (INVOICE_ID), RSI_AP_DRIVER_IDX2_166693 (EVENT_ID), RSI_AP_DRIVER_IDX3_166693 (AE_HEADER_ID).
rsi_xla_events_166693A — from XLA_EVENTS keyed by EVENT_IDrsi_xla_headers_166693A — from XLA_AE_HEADERS keyed by AE_HEADER_IDrsi_xla_lines_166693A — from XLA_AE_LINES keyed by AE_HEADER_IDrsi_xla_dist_links_166693A — from XLA_DISTRIBUTION_LINKS keyed by AE_HEADER_IDrsi_ap_inv_dist__166693A — from AP_INVOICE_DISTRIBUTIONS_ALL keyed by INVOICE_IDDELETE FROM XLA_AE_HEADERS WHERE ae_header_id IN (SELECT ae_header_id FROM rsi_ap_driver_table_166693A)DELETE FROM XLA_AE_LINES WHERE ae_header_id IN (...)DELETE FROM XLA_DISTRIBUTION_LINKS WHERE ae_header_id IN (...)UPDATE XLA_EVENTS
SET event_status_code = 'U',
process_status_code = 'U'
WHERE event_id IN (SELECT event_id FROM rsi_ap_driver_table_166693A)
Resets affected events to unprocessed so Create Accounting can re-run.
UPDATE AP_INVOICE_DISTRIBUTIONS_ALL
SET POSTED_FLAG = 'N',
ACCRUAL_POSTED_FLAG = 'N'
WHERE invoice_id IN (SELECT invoice_id FROM rsi_ap_driver_table_166693A)
Resets distributions to unposted so the GL transfer can re-process them.
After Script 03 completes, the standard AP Create Accounting concurrent program and Transfer Journal Entries to GL process can be re-run for the affected invoices.
rsi_ap_driver_table_166693A) is specific to February 2019 transactions on ledger_id=7244; adjust the period and ledger filters for different engagements.
| File | Description |
|---|---|
| 01_setup_driver_tables.sql | Case 158080 supplemental: Attempts to create RSI_AP_DRIVER_TABLE_158080 via EXECUTE IMMEDIATE. Contains code defect — the dynamic SQL is a bare SELECT (not CREATE TABLE AS SELECT) and will not create the table as written. The SELECT identifies XLA_AE_HEADERS for AP invoices in Feb 2019 on ledger 7244 with gl_transfer_status_code='Y' but no GL_IMPORT_REFERENCES match. |
| 02_apply_data_fix.sql | Case 158080 supplemental: Corrects incorrect code_combination_id on AP_LIABILITY_BALANCE and AP_AE_LINES_ALL for invoices with multiple liability balance entries. Driven by RSI_AP_DRIVER_TABLE_158080. Backs up to RSI_AP_AE_LINES_158080 and RSI_AP_LIA_BALANCE_158080. GL_INTERFACE path inactive (l_gl_transfer=FALSE). |
| 03_supplemental_fix.sql | Primary operational fix for Case 00166693: creates driver table rsi_ap_driver_table_166693A (Feb 2019, ledger_id=7244, AP invoices with XLA headers flagged as transferred but missing GL_IMPORT_REFERENCES); creates 5 backup tables; deletes XLA_AE_HEADERS, XLA_AE_LINES, XLA_DISTRIBUTION_LINKS; resets XLA_EVENTS to event_status_code='U'; resets AP_INVOICE_DISTRIBUTIONS_ALL POSTED_FLAG='N'. Enables re-run of Create Accounting and Transfer to GL. |
| Table | Action |
|---|---|
| XLA_AE_HEADERS | Delete orphaned accounting headers with no GL_IMPORT_REFERENCES (Script 03); backed up to rsi_xla_headers_166693A |
| XLA_AE_LINES | Delete accounting lines for orphaned headers (Script 03); backed up to rsi_xla_lines_166693A |
| XLA_DISTRIBUTION_LINKS | Delete distribution links for orphaned headers (Script 03); backed up to rsi_xla_dist_links_166693A |
| XLA_EVENTS | Reset event_status_code='U', process_status_code='U' for affected events (Script 03); backed up to rsi_xla_events_166693A |
| AP_INVOICE_DISTRIBUTIONS_ALL | Reset POSTED_FLAG='N', ACCRUAL_POSTED_FLAG='N' (Script 03); backed up to rsi_ap_inv_dist__166693A |
| GL_IMPORT_REFERENCES | Read-only — used in driver query to identify orphaned headers with no GL journal link |
| AP_LIABILITY_BALANCE | Update CODE_COMBINATION_ID (Script 02 — Case 158080 supplemental); backed up to RSI_AP_LIA_BALANCE_158080 |
| AP_AE_LINES_ALL | Update CODE_COMBINATION_ID (Script 02 — Case 158080 supplemental); backed up to RSI_AP_AE_LINES_158080 |
| rsi_ap_driver_table_166693A | Driver table — AP invoice XLA headers with gl_transfer_status_code='Y' but missing GL_IMPORT_REFERENCES (Feb 2019, ledger_id=7244) |