← Back to Cases
AR Cash Receipt Accounting Distributions Incorrect — Rebuild AR_DISTRIBUTIONS_ALL for Multiple Receipts
Case Number00027242
Oracle ModuleAccounts Receivable (AR)
EBS VersionR12
Functional AreaCash Receipts / AR Distributions / Receipt Reversal
Related PatchesNone

Symptoms

Root Cause

AR cash receipt distribution records in AR_DISTRIBUTIONS_ALL were created with incorrect source types, incorrect amounts, or duplicated rows. When the receipts are reversed, the AR module checks for specific distribution row patterns (source_type = 'REC' for the receivable credit, and two UNAPP rows — one DR and one CR for the unapplied cash clearing). If these rows are missing, duplicated, or have wrong amounts, the reversal fails. The fix removes the incorrect distributions and inserts the correct three-row pattern (REC, UNAPP-DR, UNAPP-CR) for each affected receipt.

Resolution

Step 1 – Create logging infrastructure

Run 01_setup_log_tables.sql. Creates the RSI_27242_RCPT_LOG_MESSAGES table with a sequence and index for tracking fix progress and errors.

Step 2 – Create logging package

Run 02_log_package_spec.sql and 03_log_package_body.sql to compile the logging package used by the fix scripts.

Step 3 – Fix transaction-level distributions (script 04)

Run 04_data_fix_transaction.txt. For the affected transaction's cash receipt:

  1. Verify whether incorrect distribution rows exist (query for source_table='RA' distributions linked via receivable application IDs).
  2. If incorrect rows exist: back up to RSI_27242_AR_DISTS_ALL, then delete them.
  3. Insert three replacement distribution rows using ra_cust_trx_line_gl_dist_s.nextval for line_id:
  4. Commit and attempt to reverse/delete the receipt.
Step 4 – Fix per-receipt distributions (scripts 05 through 09)

Run 05_data_fix_receipt_1.txt through 09_data_fix_receipt_5.txt. Each script applies the same pattern to a different cash receipt:

  1. Back up incorrect AR_DISTRIBUTIONS_ALL rows to a per-receipt backup table (joined via AR_CASH_RECEIPT_HISTORY_ALL, excluding source_table = 'CRH' rows).
  2. Delete the incorrect rows.
  3. Insert the three correct distribution rows (REC credit, UNAPP debit, UNAPP credit) with the correct amounts, CCIDs, and party information.
  4. Commit and attempt to reverse the receipt.
Note: The logging package (RSI_27242_RCPT_LOG_MESSAGES and companion objects) must be created before running the data fix scripts. Each receipt fix script targets a specific cash_receipt_id and associated receivable_application_id values — verify these against the database before executing. The correct CCID values for the REC and UNAPP distribution lines must be confirmed against the AR accounting rules for the affected operating unit before inserting.

Script Inventory

FileDescription
01_setup_log_tables.sqlCreates RSI_27242_RCPT_LOG_MESSAGES table, index, and sequence for fix progress tracking.
02_log_package_spec.sqlLogging package specification.
03_log_package_body.sqlLogging package body.
04_data_fix_transaction.txtFixes AR_DISTRIBUTIONS_ALL for one cash receipt: backs up, deletes incorrect rows, inserts REC and UNAPP distribution pairs.
05_data_fix_receipt_1.txt through 09_data_fix_receipt_5.txtPer-receipt fix scripts (five receipts). Each backs up, deletes, and re-inserts correct REC and UNAPP distribution rows for one cash receipt.

Key Tables Affected

TableAction
AR_DISTRIBUTIONS_ALLDelete incorrect distribution rows; insert correct REC and UNAPP source type rows for each affected receipt
AR_CASH_RECEIPT_HISTORY_ALLRead only — used to identify associated distribution rows
AR_RECEIVABLE_APPLICATIONS_ALLRead only — used to identify associated distribution rows