← Back to Cases
AP Prepayment Distribution ID Not Populated on Tax Distributions
Case Number00031880
Oracle ModuleAccounts Payable (AP)
EBS VersionR12
Functional AreaPrepayment Application / Tax Distributions
Related PatchesOracle Bug 9243855 (ap_prepay_dist_id_pop_fix.sql)

Symptoms

Root Cause

Oracle Bug 9243855: Due to a code defect, when a prepayment is applied to a standard invoice, the tax distributions created for the prepay application/unapplication lines do not have their PREPAY_DISTRIBUTION_ID, PREPAY_INVOICE_ID, and PREPAY_LINE_NUMBER columns populated. This missing linkage prevents correct accounting regeneration for the prepayment.

Resolution

This fix uses the Oracle Generic Data Fix (GDF) framework via the AP_Acctg_Data_Fix_PKG package.

Step 1 – Run identification script

Run the companion selection script (ap_prepay_dist_id_pop_sel.sql) first to populate the driver table AP_TEMP_DATA_DRIVER_9243855 with the affected invoice distribution records.

Step 2 – Execute the fix script

Run data_fix.sql as a SYSDBA or AP schema user via SQL*Plus. The script prompts for:

Execute command:

sqlplus <user_name>/<password>@<database> @data_fix.sql
Step 3 – Script processing

The script performs the following automatically:

  1. Initializes Oracle Applications context via AP_Acctg_Data_Fix_PKG.apps_initialize.
  2. Creates backup tables: AP_INV_LINES_9243855_BKP and AP_INV_DISTS_9243855_BKP.
  3. Merges into the driver table to match tax distributions with their prepay distribution parent records using a hierarchical query.
  4. Updates AP_INVOICE_DISTRIBUTIONS_ALL to populate PREPAY_DISTRIBUTION_ID on affected distributions.
  5. Updates AP_INVOICE_LINES_ALL to populate PREPAY_INVOICE_ID and PREPAY_LINE_NUMBER on affected lines.
  6. Deletes and recreates AP_PREPAY_APP_DISTS and AP_PREPAY_HISTORY_ALL records for invoices with unaccounted prepayment events.
  7. Calls AP_ACCTG_PREPAY_DIST_PKG.prepay_dist_appl API to recreate the prepayment accounting distributions.
  8. Issues COMMIT and writes an HTML log report of fixed and unfixed transactions.
Step 4 – Review log output

Review the HTML log file generated in the Oracle UTL_FILE directory. Verify all records in the driver table show process_flag = 'P' (processed successfully).

Note: Records that cannot be fixed will show process_flag <> 'P' and an error message in the driver table. Review these individually. The driver table AP_TEMP_DATA_DRIVER_9243855 must be populated by the selection script before running this fix.

Script Inventory

FileDescription
data_fix.sqlOracle GDF fix script for Bug 9243855. Populates PREPAY_DISTRIBUTION_ID, PREPAY_INVOICE_ID, and PREPAY_LINE_NUMBER on AP invoice distributions and lines. Recreates prepay history and distribution records. Uses AP_Acctg_Data_Fix_PKG framework with logging and email notification.

Related Oracle Patches / Bugs

Bug / PatchDescription
Bug 9243855PREPAY_DISTRIBUTION_ID not populated on AP_INVOICE_DISTRIBUTIONS_ALL for tax distributions created during prepayment application
Bug 9243854Related RCA bug for the root cause analysis
Bug 17412439Enhancement to initialize Apps context within the fix script

Key Tables Affected

TableAction
AP_TEMP_DATA_DRIVER_9243855Driver table — populated by selection script, updated with process_flag
AP_INV_LINES_9243855_BKPBackup of AP_INVOICE_LINES_ALL (created by fix)
AP_INV_DISTS_9243855_BKPBackup of AP_INVOICE_DISTRIBUTIONS_ALL (created by fix)
AP_INVOICE_DISTRIBUTIONS_ALLUpdate PREPAY_DISTRIBUTION_ID; reset accounting_event_id for reprocessing
AP_INVOICE_LINES_ALLUpdate PREPAY_INVOICE_ID, PREPAY_LINE_NUMBER
AP_PREPAY_APP_DISTSDelete and recreate for affected invoices
AP_PREPAY_HISTORY_ALLDelete and recreate for affected invoices