| Case Number | 00058329 |
| Oracle Module | Accounts Receivable (AR) |
| EBS Version | 11i (11.5.10.2) |
| Functional Area | AR Cash Receipts / Receipt History / Receivable Applications / GL Distributions |
| Related Patches | None |
gl_date values on AR_CASH_RECEIPT_HISTORY_ALL, AR_DISTRIBUTIONS_ALL, and AR_RECEIVABLE_APPLICATIONS_ALL — the receipts have posting_control_id = -3 (unposted) and their GL date falls in the prior period (July 2015) rather than the correct period (August 2015).'REV') are missing required accounting rows: the AR_CASH_RECEIPT_HISTORY_ALL table is missing a REMITTED history line; AR_RECEIVABLE_APPLICATIONS_ALL is missing 2 to 4 UNAPP application rows; and AR_DISTRIBUTIONS_ALL is missing the corresponding CRH and RA distribution lines needed for GL posting.posting_control_id = -3.Two distinct issues require separate script phases:
posting_control_id = -3 (not yet posted to the GL), the GL date can be corrected directly on the three AR tables without reversing posted entries.AR_CASH_RECEIPT_HISTORY_ALL and the corresponding UNAPP receivable application rows and AR distribution lines. In Oracle 11i AR, a reversal of a confirmed receipt requires: CONFIRMED → REMITTED → REVERSED history sequence; six UNAPP receivable application rows (two confirming, two remitting); and the matching CRH and RA distribution lines in AR_DISTRIBUTIONS_ALL. Missing rows from this sequence prevent GL posting of the reversal.Run 01_setup_backup_tables.sql before executing any fix scripts. Creates:
RSI_AR_DISTS_58329 — mirrors AR_DISTRIBUTIONS_ALL structure, with an additional CASH_RECEIPT_ID column and index, for backing up distribution rows per receipt.RSI_AR_CASH_REC_HIST_58329 — mirrors AR_CASH_RECEIPT_HISTORY_ALL for receipt history backups.RSI_AR_CASH_REC_APP_58329 — mirrors AR_RECEIVABLE_APPLICATIONS_ALL for receivable application backups.RSI_AR_GL_ERRORS_58329 — error tracking table (receipt_id, error_message, error_block) used by Phase J to log per-receipt processing errors without halting the full run.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:
AR_CASH_RECEIPT_HISTORY_ALL: sets gl_date = 08/01/2015 where posting_control_id = -3.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.AR_RECEIVABLE_APPLICATIONS_ALL: sets gl_date = 08/01/2015 where posting_control_id = -3 and cash_receipt_id matches.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:
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.AR_CASH_RECEIPT_HISTORY_ALL and AR_RECEIVABLE_APPLICATIONS_ALL rows for the receipt into the backup tables from Script 01.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).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.AR_DISTRIBUTIONS_ALL (CRH, RA, and MCD source tables) into RSI_AR_DISTS_58329.source_id to point to the new REMITTED history ID.RSI_AR_GL_ERRORS_58329 and the script proceeds to the next receipt.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.
| File | Description |
|---|---|
| 01_setup_backup_tables.sql | Creates 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.sql | Phase 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.sql | Phase 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. |
| Table | Action |
|---|---|
| AR_CASH_RECEIPT_HISTORY_ALL | Update 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_ALL | Update 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_ALL | Update 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_58329 | Backup of AR_DISTRIBUTIONS_ALL rows per cash receipt (Phase J) |
| RSI_AR_CASH_REC_HIST_58329 | Backup of AR_CASH_RECEIPT_HISTORY_ALL rows per receipt (Phase J) |
| RSI_AR_CASH_REC_APP_58329 | Backup of AR_RECEIVABLE_APPLICATIONS_ALL rows per receipt (Phase J) |
| RSI_AR_GL_ERRORS_58329 | Error log for per-receipt processing failures in Phase J |