| Case Number | 00068994 |
| Oracle Module | Accounts Receivable (AR) |
| EBS Version | 11i (11.5.10.2) |
| Functional Area | AR Transaction Archiving / Receipt History / Receivable Applications / Adjustments |
| Related Patches | None |
gl_date_closed prior to 01-JAN-1998 cannot be processed by the AR archiving program because their posting_control_id values are not set to the sentinel value -9999 that the archive program requires.posting_control_id = -9999 across RA_CUSTOMER_TRX_ALL, RA_CUST_TRX_LINE_GL_DIST_ALL, AR_RECEIVABLE_APPLICATIONS_ALL, AR_CASH_RECEIPT_HISTORY_ALL, and AR_ADJUSTMENTS_ALL. Transactions whose posting_control_id was not correctly set by earlier processes remain stuck outside the archive scope.posting_control_id = -9999 on all affected tables, making the transactions visible to the archive program.In Oracle 11i AR, the archiving mechanism uses posting_control_id = -9999 as an eligibility flag across multiple AR tables. Transactions that were closed prior to 01-JAN-1998 but were never stamped with this value — due to data migration gaps, prior incomplete archive runs, or manual posting corrections — remain ineligible for archiving. The fix directly sets posting_control_id = -9999 on all relevant AR tables after backing up the current values, enabling the standard archive program to process these transactions.
The solution is delivered in four phases with increasing scope:
customer_trx_id = 110653. Updates 4 tables (no adjustments). Used to validate the mechanism before broader execution.trx_date < 01-JAN-1998. Updates the same 4 tables as Phase B.RSI_DriverView_68994_V. Expands scope to 5 tables (adds AR_ADJUSTMENTS_ALL) and includes full audit stamping (LAST_UPDATE_DATE, LAST_UPDATED_BY = -9999).Run 01_setup_objects.sql first. Creates all backup and error tables idempotently (ORA-955 handler skips creation if already present):
RSI_CUST_TRX_68994 — Stores (posting_control_id, customer_trx_id) from RA_CUSTOMER_TRX_ALL before update. Unique index on customer_trx_id.RSI_CUST_TRX_DIST_68994 — Stores (posting_control_id, customer_trx_id) from RA_CUST_TRX_LINE_GL_DIST_ALL before update. Unique index on customer_trx_id.RSI_REC_APP_68994 — Stores (posting_control_id, receivable_application_id) from AR_RECEIVABLE_APPLICATIONS_ALL before update. Unique index on receivable_application_id.RSI_CASH_REC_HIST_68994 — Stores (posting_control_id, cash_receipt_history_id) from AR_CASH_RECEIPT_HISTORY_ALL before update. Unique index on cash_receipt_history_id.RSI_AR_ADJUSTMENTS_68994 — Stores (posting_control_id, customer_trx_id) from AR_ADJUSTMENTS_ALL before update. Unique index on customer_trx_id.RSI_DATAFIX_68994_ERRORS — Error tracking table (customer_trx_id, table_name, error_message, error_block) for per-transaction processing failures.Run 02_setup_driver_table.sql to create the view RSI_DriverView_68994_V. This view identifies AR transactions eligible for archive (closed prior to 01-JAN-1998, up to 500 rows per component). It is a 7-part UNION covering:
RA_CUSTOMER_TRX_ALL joined to RA_CUSTOMER_TRX_LINES_ALL, lookups, tax, rules, and AR_DEFERRED_LINES_ALL where gl_date_closed < 01/01/1998.RA_CUST_TRX_LINE_GL_DIST_ALL where account_set_flag <> 'Y' and latest_rec_flag = 'Y'.AR_ADJUSTMENTS_ALL.AR_LINE_CONTS_ALL.AR_CASH_RECEIPT_HISTORY_ALL joined to AR_CASH_RECEIPTS_ALL where nvl(current_record_flag,'N') = 'Y'; excludes receipts already present in AR_ARCHIVE_DETAIL.AR_RECEIVABLE_APPLICATIONS_ALL joined to AR_CASH_RECEIPTS_ALL.AR_RECEIVABLE_APPLICATIONS_ALL joining both CM and invoice RA_CUSTOMER_TRX_ALL rows.The view exposes trx_id and related_trx_id columns used by Phases D, E, and F to drive processing.
Cursor selects customer_trx_id from RA_CUSTOMER_TRX_ALL where customer_trx_id = 110653 (commented alternative: trx_date < 01/01/1998). Intended as a proof-of-concept run before broader execution.
For each record:
posting_control_id and customer_trx_id from RA_CUSTOMER_TRX_ALL into RSI_CUST_TRX_68994 (DUP_VAL_ON_INDEX protected).posting_control_id and customer_trx_id from RA_CUST_TRX_LINE_GL_DIST_ALL into RSI_CUST_TRX_DIST_68994.posting_control_id and receivable_application_id from AR_RECEIVABLE_APPLICATIONS_ALL (via applied_customer_trx_id → cash_receipt_id subquery) into RSI_REC_APP_68994.posting_control_id and cash_receipt_history_id from AR_CASH_RECEIPT_HISTORY_ALL (same cash_receipt_id subquery) into RSI_CASH_REC_HIST_68994.RA_CUSTOMER_TRX_ALL.posting_control_id = -9999.RA_CUST_TRX_LINE_GL_DIST_ALL.posting_control_id = -9999.AR_RECEIVABLE_APPLICATIONS_ALL.posting_control_id = -9999 (via cash_receipt_id subquery).AR_CASH_RECEIPT_HISTORY_ALL.posting_control_id = -9999 (via cash_receipt_id subquery).RSI_DATAFIX_68994_ERRORS with rollback per transaction.Note: Phase B does not update AR_ADJUSTMENTS_ALL and does not set LAST_UPDATE_DATE or LAST_UPDATED_BY audit columns.
Cursor selects customer_trx_id from RA_CUSTOMER_TRX_ALL where trx_date < to_date('01/01/98','MM/DD/YY') and rownum < 1001. Processes up to 1,000 records per execution.
Logic per record is identical to Phase B: backs up and updates posting_control_id = -9999 on the same 4 tables (RA_CUSTOMER_TRX_ALL, RA_CUST_TRX_LINE_GL_DIST_ALL, AR_RECEIVABLE_APPLICATIONS_ALL, AR_CASH_RECEIPT_HISTORY_ALL). The initial cleanup block deletes from 4 backup tables (not RSI_AR_ADJUSTMENTS_68994, confirming adjustments are out of scope for Phase C). Commits per record; errors logged to RSI_DATAFIX_68994_ERRORS.
Cursor selects UNIQUE trx_id from the UNION of trx_id and related_trx_id columns from RSI_DriverView_68994_V, capturing both primary and related transactions identified by the driver view. Scripts 05, 06, and 07 contain identical logic and are intended for repeated execution as the driver view is refreshed between runs.
Per-record processing expands on Phase C:
RSI_CUST_TRX_68994, RSI_CUST_TRX_DIST_68994, RSI_AR_ADJUSTMENTS_68994, RSI_REC_APP_68994, RSI_CASH_REC_HIST_68994 (all DUP_VAL_ON_INDEX protected).RA_CUSTOMER_TRX_ALL: sets POSTING_CONTROL_ID = -9999, LAST_UPDATE_DATE = TRUNC(SYSDATE), LAST_UPDATED_BY = -9999.RA_CUST_TRX_LINE_GL_DIST_ALL: same 3-column update.AR_ADJUSTMENTS_ALL: same 3-column update (added in Phase D — not present in Phases B and C).AR_RECEIVABLE_APPLICATIONS_ALL: same 3-column update via cash_receipt_id subquery on applied_customer_trx_id.AR_CASH_RECEIPT_HISTORY_ALL: same 3-column update via cash_receipt_id subquery.RSI_DATAFIX_68994_ERRORS with rollback per transaction.LAST_UPDATE_DATE / LAST_UPDATED_BY on updated rows; Phase D onward adds full audit stamping with LAST_UPDATED_BY = -9999. Only Phases D–F include AR_ADJUSTMENTS_ALL in the update scope. Check RSI_DATAFIX_68994_ERRORS after each phase for per-transaction failures. The driver view excludes transactions already present in AR_ARCHIVE_DETAIL to avoid reprocessing already-archived receipts.
| File | Description |
|---|---|
| 01_setup_objects.sql | Creates 5 backup tables (RSI_CUST_TRX_68994, RSI_CUST_TRX_DIST_68994, RSI_REC_APP_68994, RSI_CASH_REC_HIST_68994, RSI_AR_ADJUSTMENTS_68994) with unique indexes, and error table RSI_DATAFIX_68994_ERRORS. Idempotent (ORA-955 handler). Must be run first. |
| 02_setup_driver_table.sql | Creates view RSI_DriverView_68994_V — 7-part UNION identifying AR transactions with gl_date_closed before 01-JAN-1998 eligible for archive, across invoices, distributions, adjustments, contingencies, cash receipts, receipt applications, and CM applications. Excludes already-archived receipts (AR_ARCHIVE_DETAIL). Up to 500 rows per UNION component. |
| 03_data_fix_phase_b.sql | Phase B: Hardcoded fix for customer_trx_id=110653. Backs up and sets posting_control_id=-9999 on RA_CUSTOMER_TRX_ALL, RA_CUST_TRX_LINE_GL_DIST_ALL, AR_RECEIVABLE_APPLICATIONS_ALL, AR_CASH_RECEIPT_HISTORY_ALL. No AR_ADJUSTMENTS_ALL. No audit stamping. Validation/test run. |
| 04_data_fix_phase_c.sql | Phase C: Batch fix for RA_CUSTOMER_TRX_ALL rows where trx_date < 01-JAN-1998 (up to 1,000 per run). Same 4-table backup and update scope as Phase B. No audit stamping. |
| 05_data_fix_phase_d.sql | Phase D: Full view-driven batch fix. Cursor selects distinct trx_id and related_trx_id from RSI_DriverView_68994_V. Backs up and sets posting_control_id=-9999 with LAST_UPDATE_DATE=TRUNC(SYSDATE), LAST_UPDATED_BY=-9999 on all 5 tables including AR_ADJUSTMENTS_ALL. |
| 06_data_fix_phase_e.sql | Phase E: Identical logic to Phase D. Used for subsequent view-driven batch runs. |
| 07_data_fix_phase_f.sql | Phase F: Identical logic to Phase D. Used for further subsequent view-driven batch runs. |
| Table | Action |
|---|---|
| RA_CUSTOMER_TRX_ALL | Update posting_control_id=-9999 (all phases). Phases D–F also set LAST_UPDATE_DATE=TRUNC(SYSDATE), LAST_UPDATED_BY=-9999. |
| RA_CUST_TRX_LINE_GL_DIST_ALL | Update posting_control_id=-9999 (all phases). Phases D–F also set LAST_UPDATE_DATE=TRUNC(SYSDATE), LAST_UPDATED_BY=-9999. |
| AR_RECEIVABLE_APPLICATIONS_ALL | Update posting_control_id=-9999 via cash_receipt_id subquery on applied_customer_trx_id (all phases). Phases D–F also set LAST_UPDATE_DATE=TRUNC(SYSDATE), LAST_UPDATED_BY=-9999. |
| AR_CASH_RECEIPT_HISTORY_ALL | Update posting_control_id=-9999 via cash_receipt_id subquery (all phases). Phases D–F also set LAST_UPDATE_DATE=TRUNC(SYSDATE), LAST_UPDATED_BY=-9999. |
| AR_ADJUSTMENTS_ALL | Update posting_control_id=-9999, LAST_UPDATE_DATE, LAST_UPDATED_BY=-9999 (Phases D, E, F only). |
| RSI_CUST_TRX_68994 | Backup of posting_control_id from RA_CUSTOMER_TRX_ALL before update (all phases). |
| RSI_CUST_TRX_DIST_68994 | Backup of posting_control_id from RA_CUST_TRX_LINE_GL_DIST_ALL before update (all phases). |
| RSI_REC_APP_68994 | Backup of posting_control_id from AR_RECEIVABLE_APPLICATIONS_ALL before update (all phases). |
| RSI_CASH_REC_HIST_68994 | Backup of posting_control_id from AR_CASH_RECEIPT_HISTORY_ALL before update (all phases). |
| RSI_AR_ADJUSTMENTS_68994 | Backup of posting_control_id from AR_ADJUSTMENTS_ALL before update (Phases D–F only). |
| RSI_DATAFIX_68994_ERRORS | Error log for per-transaction processing failures across all phases. |
| RSI_DriverView_68994_V | Read-only driver view; identifies eligible transactions for Phases D–F. |