← Back to Cases
AP Multiple GDF Data Fixes — Closed Period Sweep, Accounting Date Sync, Missing Exchange Rates, XLA Multi-Entity, and Manual Payment Posting
Case Number00043404
Oracle ModuleAccounts Payable (AP) / Subledger Accounting (XLA)
EBS VersionR12
Functional AreaAP Invoices / Payments / Accounting Events / Exchange Rates / XLA Transaction Entities
Related PatchesOracle Bug 8529957; Oracle Bug 8531305; Oracle Bug 17941503; Oracle Bug 9651687

Symptoms

Root Cause

This case applies seven separate scripts addressing four Oracle-released GDF bugs plus three client-specific one-off data corrections:


Resolution — Script 01: Unaccounted Transactions in Closed Period Sweep (Bug 8529957)

Pre-requisite — Populate driver table

Populate AP_TEMP_DATA_DRIVER_8529957 with the invoice_id or check_id and associated entity type (AP_INVOICES or AP_PAYMENTS) for all unaccounted transactions in closed periods. Optionally set sweep_to_date to override the target period start date.

Fix Steps
  1. For each row in the driver table, determines the start_date of the next open or future-entry GL period relative to the current accounting date.
  2. AP_INVOICES entity: updates accounting_date on AP_INVOICE_DISTRIBUTIONS_ALL, AP_SELF_ASSESSED_TAX_DIST_ALL, AP_PREPAY_HISTORY_ALL, and ZX_REC_NREC_DIST to the target period start date.
  3. AP_PAYMENTS entity: updates accounting_date on AP_INVOICE_DISTRIBUTIONS_ALL (AWT distributions), AP_INVOICE_PAYMENTS_ALL, and AP_PAYMENT_HISTORY_ALL.
  4. Updates XLA_EVENTS.event_date to the same target date for both entity types.
  5. Commits after each invoice or payment processed.

Resolution — Script 02: Accounting Date Out of Sync with XLA Events (Bug 8531305)

Pre-requisite — Populate driver table

Populate AP_TEMP_DATA_DRIVER_8531305 with the event IDs for all transactions where AP accounting dates differ from XLA_EVENTS.event_date.

Fix Steps
  1. For each event in the driver table, reads the correct date from XLA_EVENTS.event_date.
  2. Updates accounting_date on AP_INVOICE_DISTRIBUTIONS_ALL to match the XLA event date.
  3. Updates accounting_date on AP_SELF_ASSESSED_TAX_DIST_ALL, ZX_REC_NREC_DIST, AP_INVOICE_PAYMENTS_ALL, AP_PAYMENT_HISTORY_ALL, and AP_PREPAY_HISTORY_ALL as applicable for the event type.
  4. Commits after all updates for each event.

Resolution — Script 03: AP Missing Exchange Rate Fix (Bug 17941503)

Pre-requisite — Populate driver table

Populate AP_TEMP_DATA_DRIVER_17941503 with the affected check_id values and the event types that are missing exchange rates (PAYMENT CREATED, PAYMENT MATURITY, PAYMENT CLEARING). Identify whether each payment is FOREIGN (foreign currency, domestic bank) or INTERNATIONAL (foreign bank account) using AP_RECONCILIATION_PKG.Case_Type.

Fix Steps
  1. For PAYMENT MATURITY events that were already (incorrectly) accounted: calls AP_ACCTG_DATA_FIX_PKG.undo_acctg_entries to undo those accounting entries before applying the rate correction.
  2. For each affected check, derives the correct exchange rate using ap_utilities_pkg.get_exchange_rate for the applicable exchange rate type and date.
  3. Calculates base_amount using gl_currency_api.convert_amount_sql.
  4. Updates AP_CHECKS_ALL: sets exchange_rate, base_amount, and (for maturity events) maturity_exchange_rate and maturity_base_amount.
  5. Updates AP_INVOICE_PAYMENTS_ALL: sets exchange_rate and payment_base_amount for affected payment rows.
  6. Updates AP_PAYMENT_HISTORY_ALL: sets exchange_rate and pmt_to_base_xrate for PAYMENT CREATED, MATURITY, and CLEARING history rows.
  7. Handles INTERNATIONAL payments separately, updating the bank-side exchange rate columns (bank_to_base_xrate, cleared_base_amount) as appropriate for CLEARING events.
  8. Commits per check.

Resolution — Script 04: XLA Duplicate Transaction Entities Fix (Bug 9651687)

Pre-requisite — Populate driver table

Populate XTE_MULTIPLE_9651687 with the duplicate entity_id pairs — for each AP transaction that has multiple entity rows in XLA_TRANSACTION_ENTITIES, record the min_entity_id (surviving) and the duplicate entity IDs to be retired. Uses XLA_GLOBAL_DATA_FIX_PKG framework.

Fix Steps
  1. For duplicate entities where event_count = 0: sets entity_code = 'MANUAL' on XLA_TRANSACTION_ENTITIES and XLA_TRANSACTION_ENTITIES_UPG — effectively retiring the empty duplicate.
  2. For duplicate entities that have events:
  3. Commits after processing each entity group.

Resolution — Scripts 05 and 07: Manual AP Invoice Amount Paid Correction

Parametric one-off fix

Both scripts use the same template. For a specified invoice_id and trackit reference number:

  1. Creates a backup table XX_CUSTOM_AP_INV_DRIVER_<trackit> with the current AP_INVOICES_ALL row for the specified invoice.
  2. Updates AP_INVOICES_ALL: sets amount_paid and payment_status_flag to the correct values for the specified invoice.
  3. Commits.

Resolution — Script 06: Manual Force-Post AP Payment Records

Force-post 27 AP payment accounting records
  1. Creates backup tables for AP_PAYMENT_HISTORY_ALL, AP_INVOICE_PAYMENTS_ALL, XLA_EVENTS, and XLA_AE_HEADERS for the 27 affected check and entity IDs.
  2. Updates XLA_EVENTS: sets event_status_code = 'P' (Processed) and process_status_code = 'P' for the affected event IDs.
  3. Updates XLA_AE_HEADERS: sets gl_transfer_status_code = 'Y' (transferred to GL) for the affected AE header IDs.
  4. Updates AP_PAYMENT_HISTORY_ALL: sets posted_flag = 'Y' for the affected check IDs.
  5. Updates AP_INVOICE_PAYMENTS_ALL: sets posted_flag = 'Y', accrual_posted_flag = 'Y', and cash_posted_flag = 'Y' for payments associated with the affected check IDs.
  6. Commits.
Note: Scripts 01 through 04 are Oracle-released GDF scripts. Each requires its respective driver table to be populated before execution. Scripts 05 and 07 are client-specific parametric scripts — the backup table prefix has been sanitized from the original client schema prefix to XX_CUSTOM_. Script 06 targets a hardcoded list of 27 check IDs and entity IDs specific to this case engagement. All scripts use AP_ACCTG_DATA_FIX_PKG for HTML log output, backup management, and optional email delivery of logs. Always take a full database backup and verify driver table contents before executing any GDF script.

Script Inventory

FileDescription
01_ap_unacct_trx_closed_period_fix.sqlOracle GDF Bug 8529957 (ap_unacct_trx_closed_period_fix.sql). Sweeps unaccounted AP invoice and payment event dates from closed periods to the start of the next open/future-entry GL period. Updates AP_INVOICE_DISTRIBUTIONS_ALL, AP_SELF_ASSESSED_TAX_DIST_ALL, AP_PREPAY_HISTORY_ALL, ZX_REC_NREC_DIST, AP_INVOICE_PAYMENTS_ALL, AP_PAYMENT_HISTORY_ALL, XLA_EVENTS. Driver: AP_TEMP_DATA_DRIVER_8529957.
02_ap_acctg_date_out_of_synch_fix.sqlOracle GDF Bug 8531305 (ap_acctg_date_out_of_synch_fix.sql). Synchronizes AP transaction accounting dates to match XLA_EVENTS.event_date. Updates AP_INVOICE_DISTRIBUTIONS_ALL, AP_SELF_ASSESSED_TAX_DIST_ALL, ZX_REC_NREC_DIST, AP_INVOICE_PAYMENTS_ALL, AP_PAYMENT_HISTORY_ALL, AP_PREPAY_HISTORY_ALL. Driver: AP_TEMP_DATA_DRIVER_8531305.
03_ap_rate_missing_fix.sqlOracle GDF Bug 17941503 (ap_rate_missing_fix.sql). Populates missing exchange rates on AP checks for PAYMENT CREATED, PAYMENT MATURITY, and PAYMENT CLEARING events. Undoes incorrectly-accounted maturity events via AP_ACCTG_DATA_FIX_PKG.undo_acctg_entries. Updates AP_CHECKS_ALL, AP_INVOICE_PAYMENTS_ALL, AP_PAYMENT_HISTORY_ALL. Handles FOREIGN and INTERNATIONAL payment types. Driver: AP_TEMP_DATA_DRIVER_17941503.
04_xla_multi_entity_fix.sqlOracle GDF Bug 9651687 (xla_mulent_fix.sql). Consolidates duplicate XLA_TRANSACTION_ENTITIES rows for AP transactions. Reassigns XLA_EVENTS, XLA_AE_HEADERS, and XLA_DISTRIBUTION_LINKS to the surviving min_entity_id. Retires duplicate entities by setting entity_code='MANUAL'. Uses XLA_GLOBAL_DATA_FIX_PKG. Driver: XTE_MULTIPLE_9651687.
05_ap_invoice_update.sqlClient-specific parametric script. Creates backup table XX_CUSTOM_AP_INV_DRIVER_<trackit>. Updates AP_INVOICES_ALL.amount_paid and payment_status_flag for a specified invoice_id.
06_ap_payment_update.sqlClient-specific script. Creates backups for 27 AP payment records. Force-sets XLA_EVENTS (event_status_code='P', process_status_code='P'), XLA_AE_HEADERS (gl_transfer_status_code='Y'), AP_PAYMENT_HISTORY_ALL (posted_flag='Y'), AP_INVOICE_PAYMENTS_ALL (posted_flag='Y', accrual_posted_flag='Y', cash_posted_flag='Y').
07_ap_inv_flexfield_update.sqlClient-specific parametric script (same template as script 05). Creates backup table XX_CUSTOM_AP_INV_DRIVER_<trackit>. Updates AP_INVOICES_ALL.amount_paid and payment_status_flag for a specified invoice_id.

Key Tables Affected

TableAction
AP_INVOICE_DISTRIBUTIONS_ALLUpdate accounting_date (scripts 01, 02); update accounting_date for AWT distributions (script 01)
AP_SELF_ASSESSED_TAX_DIST_ALLUpdate accounting_date (scripts 01, 02)
AP_PREPAY_HISTORY_ALLUpdate accounting_date (scripts 01, 02)
ZX_REC_NREC_DISTUpdate accounting_date (scripts 01, 02)
AP_INVOICE_PAYMENTS_ALLUpdate accounting_date (scripts 01, 02); update exchange_rate/payment_base_amount (script 03); set posted_flag flags (script 06)
AP_PAYMENT_HISTORY_ALLUpdate accounting_date (scripts 01, 02); update exchange rates (script 03); set posted_flag (script 06)
XLA_EVENTSUpdate event_date (script 01); update event_status_code/process_status_code='P' (script 06); reassign entity_id (script 04)
XLA_AE_HEADERSSet gl_transfer_status_code='Y' (script 06); reassign entity_id (script 04)
XLA_DISTRIBUTION_LINKSUpdate applied_to_entity_id to surviving min_entity_id (script 04)
XLA_TRANSACTION_ENTITIES / XLA_TRANSACTION_ENTITIES_UPGSet entity_code='MANUAL' on retired duplicate entities (script 04)
AP_CHECKS_ALLUpdate exchange_rate, base_amount, maturity_exchange_rate, maturity_base_amount (script 03)
AP_INVOICES_ALLUpdate amount_paid and payment_status_flag (scripts 05, 07)