← Back to Cases
AR Cash Receipt GL Date Correction and Reversed Receipt Data Repair
Case Number00058329
Oracle ModuleAccounts Receivable (AR)
EBS Version11i (11.5.10.2)
Functional AreaAR Cash Receipts / Receipt History / Receivable Applications / GL Distributions
Related PatchesNone

Symptoms

Root Cause

Two distinct issues require separate script phases:

Resolution — Script 01: Create Backup Tables

Pre-requisite — Create backup and error tables

Run 01_setup_backup_tables.sql before executing any fix scripts. Creates:


Resolution — Script 02: AR GL Date Correction (Phase C)

Correct gl_date from July 2015 to August 2015

Selects AR cash receipts where AR_RECEIVABLE_APPLICATIONS_ALL.posting_control_id = -3, gl_date is in July 2015, postable = 'Y', and org_id = 1. Processes up to 3 receipts (bounded by ROWNUM <= 3 in the initial scan).

For each qualifying receipt:

  1. Updates AR_CASH_RECEIPT_HISTORY_ALL: sets gl_date = 08/01/2015 where posting_control_id = -3.
  2. Updates AR_DISTRIBUTIONS_ALL: sets gl_date = 08/01/2015 where posting_control_id = -3 and source_id matches a cash receipt history ID for the receipt.
  3. Updates AR_RECEIVABLE_APPLICATIONS_ALL: sets gl_date = 08/01/2015 where posting_control_id = -3 and cash_receipt_id matches.
  4. Commits after processing all receipts.

Resolution — Script 03: Reversed Receipt Data Repair (Phase J)

Repair missing accounting rows for reversed cash receipts

Selects reversed AR cash receipts where AR_RECEIVABLE_APPLICATIONS_ALL.posting_control_id = -3, gl_date = 01-OCT-2015, postable = 'Y', org_id = 1, and AR_CASH_RECEIPTS_ALL.status = 'REV' (reversed).

For each reversed receipt, the script executes a self-contained per-receipt block (rolls back and logs errors individually on failure) with the following steps:

  1. Collect key IDs: reads CASH_RECEIPT_HISTORY_ID and ACCOUNT_CODE_COMBINATION_ID for the CONFIRMED and REVERSED history rows; reads THIRD_PARTY_ID and THIRD_PARTY_SUB_ID from existing distributions; reads AMOUNT from AR_CASH_RECEIPTS_ALL; reads PAYMENT_SCHEDULE_ID; reads existing receivable application IDs for application rules 97.2 and 96.
  2. Back up current rows: backs up AR_CASH_RECEIPT_HISTORY_ALL and AR_RECEIVABLE_APPLICATIONS_ALL rows for the receipt into the backup tables from Script 01.
  3. Insert REMITTED history row (when the remittance row is missing — i.e., only 2 rows exist in AR_CASH_RECEIPT_HISTORY_ALL for the receipt): inserts a new REMITTED row into AR_CASH_RECEIPT_HISTORY_ALL using AR_CASH_RECEIPT_HISTORY_S.nextval; updates the REVERSED row to link to the new REMITTED row (PRV_STAT_CASH_RECEIPT_HIST_ID); updates the CONFIRMED row to link its reversal to the REMITTED row (REVERSAL_CASH_RECEIPT_HIST_ID).
  4. Determine missing receivable application rows: counts existing rows in AR_RECEIVABLE_APPLICATIONS_ALL for the receipt; a complete reversal requires 6 rows — inserts either 2 or 4 UNAPP rows (with application rules 97.0, 97.1, 96) as needed using AR_RECEIVABLE_APPLICATIONS_S.nextval.
  5. Back up distribution rows from AR_DISTRIBUTIONS_ALL (CRH, RA, and MCD source tables) into RSI_AR_DISTS_58329.
  6. Insert missing AR_DISTRIBUTIONS_ALL rows:
  7. Commits per receipt. Errors are logged to RSI_AR_GL_ERRORS_58329 and the script proceeds to the next receipt.
Note: Script 02 (Phase C) targets receipts in org_id = 1 with gl_date in July 2015 and is bounded to a maximum of 3 receipts per run. Script 03 (Phase J) processes reversed receipts with gl_date = 01-OCT-2015 in org_id = 1. Both scripts use LAST_UPDATED_BY = -999 / CREATED_BY = -999 to identify rows inserted or updated by the fix, with LAST_UPDATE_DATE = SYSDATE. The backup tables created by Script 01 must exist before running either fix script. Script 03 conditionally skips the REMITTED row insertion and related distribution lines if a REMITTED row already exists (more than 2 rows in the history table for the receipt). Review the RSI_AR_GL_ERRORS_58329 table for any per-receipt errors after Phase J completes.

Script Inventory

FileDescription
01_setup_backup_tables.sqlCreates backup tables RSI_AR_DISTS_58329 (with CASH_RECEIPT_ID column and index), RSI_AR_CASH_REC_HIST_58329, RSI_AR_CASH_REC_APP_58329, and error table RSI_AR_GL_ERRORS_58329. Must be run first.
02_data_fix_phase_c.sqlPhase C: Updates gl_date from July 2015 to 08/01/2015 on AR_CASH_RECEIPT_HISTORY_ALL, AR_DISTRIBUTIONS_ALL, and AR_RECEIVABLE_APPLICATIONS_ALL for unposted cash receipts (posting_control_id=-3) in org_id=1. Bounded to 3 receipts per run.
03_data_fix_phase_j.sqlPhase J: Repairs reversed AR cash receipts (status='REV') missing accounting rows. Inserts REMITTED history row in AR_CASH_RECEIPT_HISTORY_ALL; inserts 2 or 4 missing UNAPP rows in AR_RECEIVABLE_APPLICATIONS_ALL; inserts up to 9 missing rows in AR_DISTRIBUTIONS_ALL (CRH REMITTANCE and RA UNAPP lines). Processes receipts with posting_control_id=-3 and gl_date=01-OCT-2015 in org_id=1. Logs per-receipt errors to RSI_AR_GL_ERRORS_58329.

Key Tables Affected

TableAction
AR_CASH_RECEIPT_HISTORY_ALLUpdate gl_date to 08/01/2015 (Phase C); insert REMITTED history row; update CONFIRMED and REVERSED rows to link to REMITTED row (Phase J)
AR_DISTRIBUTIONS_ALLUpdate gl_date to 08/01/2015 (Phase C); update existing REVERSED distribution source_id; insert REMITTANCE and UNAPP distribution lines for CRH and RA sources (Phase J)
AR_RECEIVABLE_APPLICATIONS_ALLUpdate gl_date to 08/01/2015 (Phase C); insert 2 or 4 missing UNAPP application rows with application rules 97.0, 97.1, 96 (Phase J)
RSI_AR_DISTS_58329Backup of AR_DISTRIBUTIONS_ALL rows per cash receipt (Phase J)
RSI_AR_CASH_REC_HIST_58329Backup of AR_CASH_RECEIPT_HISTORY_ALL rows per receipt (Phase J)
RSI_AR_CASH_REC_APP_58329Backup of AR_RECEIVABLE_APPLICATIONS_ALL rows per receipt (Phase J)
RSI_AR_GL_ERRORS_58329Error log for per-receipt processing failures in Phase J