← Back to Cases
GL Journal Entry CCID Correction — Recode Journal Lines and Restate Period Balances
Case Number00172542
Oracle ModuleGeneral Ledger (GL)
EBS VersionR12
Functional AreaGL Journal Entries / GL Balances / GL Code Combinations / Intercompany Accounting
Related PatchesNone

Symptoms

Root Cause

GL journal entries were posted referencing CCIDs that correspond to account strings with incorrect segment values. The correct account code combinations (accounts 62200.000.000000.50225.194000.00000000.00000000 and 62200.000.100100.62305.194000.00000000.00000000) did not exist in GL_CODE_COMBINATIONS at the time of posting, or the journal import process selected the wrong CCIDs. The fix creates the correct CCIDs, re-codes the GL journal lines, removes erroneous intercompany lines, and restates GL_BALANCES across all affected periods. The resolution was developed iteratively across four phases as the full scope of the problem (multiple journal headers, intercompany entries, multi-period balance impact) was established.


Resolution — Script 01: Create CCID for Account A

Create GL code combination for 62200.000.000000.50225.194000.00000000.00000000

Run 01_setup_tables_a.sql. Calls FND_FLEX_EXT.GET_COMBINATION_ID with:

If the code combination does not exist, the function inserts a new row in GL_CODE_COMBINATIONS and returns the new CCID (stored as XXRSI_CCID_A / CCID 5783 in the subsequent fix scripts).


Resolution — Script 02: Create CCID for Account B

Create GL code combination for 62200.000.100100.62305.194000.00000000.00000000

Run 02_setup_tables_b.sql. Same pattern as Script 01 using segment string 62200.000.100100.62305.194000.00000000.00000000 (CCID 5788 in subsequent fix scripts).


Resolution — Script 03: Phase 1 — Diagnostic Investigation and Initial Backup

Investigate journal and balance data; create initial backup tables

Script 03_data_fix_phase_1.sql contains diagnostic SELECT statements to understand the scope of the problem, followed by backup table creation:

Creates initial backup tables:


Resolution — Script 04: Phase 2 — First Fix Attempt (Intermediate CCIDs)

Recode je_header_id=14448 to intermediate CCIDs 3726/3967 and adjust MAR-19 balances

Script 04_data_fix_phase_2.sql was the first fix attempt, targeting intermediate CCIDs. Drops and recreates the backup tables from Phase 1, then:

  1. Updates GL_JE_LINES for je_header_id = 14448: CCID 5625 → 3726; CCID 5621 → 3967.
  2. Updates GL_BALANCES for MAR-19:
  3. COMMIT.
Note: Phase 2 was superseded by Phase 3. The target CCIDs 3726 and 3967 were subsequently determined to be incorrect; the fix was revised to use the newly created CCIDs 5783 and 5788 (the FND_FLEX_EXT-generated combinations from Scripts 01 and 02).

Resolution — Script 05: Phase 3 — Revised Fix (Correct CCIDs, Single Header, Multi-Period)

Recode je_header_id=14448 to CCIDs 5783/5788; restate MAR-19 through MAY-19 balances

Script 05_data_fix_phase_3.sql corrects the Phase 2 fix by targeting the proper CCIDs (5783, 5788) and extending the balance restatement to include April and May carry-forward effects:

  1. Backup: Creates xxrsi_gl_je_line_172542A (GL_JE_LINES for je_header_id=14448, CCIDs 5625/5621) and xxrsi_gl_bal_172542A (GL_BALANCES for CCIDs 5625, 5621, 5788, 5783 in MAR-19).
  2. Update Journal Lines: For je_header_id=14448: CCID 5625 → 5783; CCID 5621 → 5788.
  3. Update MAR-19 Balances: Subtract activity from old CCIDs 5621 (-1065.67) and 5625 (-58.98) on GL_BALANCES.period_net_cr for MAR-19.
  4. Insert MAR-19 Balance Rows for New CCIDs: Inserts new GL_BALANCES rows for CCID 5788 (period_net_cr=1065.67) and CCID 5783 (period_net_cr=58.98) in MAR-19, set_of_books_id=1001, period_year=2019, period_num=3.
  5. Update APR-19 and MAY-19 Beginning Balances: Adjusts BEGIN_BALANCE_CR on GL_BALANCES:
  6. Insert Missing APR-19 / MAY-19 Balance Rows: Inserts GL_BALANCES rows for CCID 5788 in APR-19 (begin_balance_cr=1065.67, period_net_cr=0) and CCID 5783 in MAY-19 (begin_balance_cr=1065.67, period_net_cr=0).
  7. COMMIT.

Resolution — Script 06: Phase 4 — Final Comprehensive Fix (All Headers, Intercompany Cleanup)

Recode all 4 journal headers; remove intercompany lines; restate MAR-19 through JUN-19

Script 06_data_fix_phase_4.sql is the final and most comprehensive version, extending the fix to all four affected journal headers and removing erroneous intercompany entries:

  1. Backup: Creates xxrsi_gl_bal_172542B (GL_BALANCES for CCIDs 5625, 5621, 5788, 5783, 5752, 5380 in MAR-19 through JUN-19) and xxrsi_gl_je_lines_172542B (GL_JE_LINES for je_header_ids 14448, 15178, 15197, 15198).
  2. Update Journal Lines — All Headers: For je_header_ids 14448, 15178, 15197, 15198:
  3. Delete Intercompany Lines: Removes GL_JE_LINES rows for je_header_ids 14448, 15178, 15197, 15198 where CCID in (5380, 5752).
  4. Update GL_BALANCES for New CCIDs (APR-19 to JUN-19): Adds all balance columns (period_net_dr/cr, quarter_to_date_dr/cr, project_to_date_dr/cr, begin_balance_dr/cr) from the old CCID 5625 rows (sourced from the xxrsi_gl_bal_172542B backup) to the existing CCID 5783 rows, period-by-period.
  5. Zero Out Old and Deleted Intercompany CCIDs: Sets all balance columns to 0 on GL_BALANCES for CCIDs 5621, 5625, 5752 in MAR-19 through JUN-19.
  6. Adjust Intercompany CCID 5380 Balances: Reduces period_net_cr and period_net_dr on CCID 5380 for APR-19; adjusts quarter-to-date, project-to-date, and begin-balance amounts for MAY-19 and JUN-19 to reflect removal of the deleted intercompany lines.
  7. Insert Missing Balance Rows for New CCIDs: Inserts GL_BALANCES rows cloned from the backup for:
  8. COMMIT.
Note: The fix was developed iteratively across four phases. Phase 2 (Script 04) used intermediate CCIDs (3726, 3967) that were later found to be incorrect; it was superseded by Phase 3 (Script 05). Phase 3 was subsequently extended by Phase 4 (Script 06) to cover all four journal headers and handle intercompany line deletion. In a new engagement, run Scripts 01 and 02 to create the correct CCIDs, then proceed directly to Script 06 (Phase 4) as the definitive fix. Scripts 04 and 05 are retained for audit trail purposes. All amounts are hardcoded to the specific engagement values (58.98, 1065.67, 1124.65, 2249.30); adjust for different engagements.

Script Inventory

FileDescription
01_setup_tables_a.sqlCreates GL code combination for 62200.000.000000.50225.194000.00000000.00000000 via FND_FLEX_EXT.GET_COMBINATION_ID (SQLGL/GL# flexfield, chart_of_accounts_id=101). Returns CCID 5783.
02_setup_tables_b.sqlCreates GL code combination for 62200.000.100100.62305.194000.00000000.00000000 via FND_FLEX_EXT.GET_COMBINATION_ID. Returns CCID 5788.
03_data_fix_phase_1.sqlPhase 1: Diagnostic SELECT queries against GL_JE_BATCHES, GL_JE_HEADERS, GL_JE_LINES (with FND_FLEX_EXT.GET_SEGS), GL_CODE_COMBINATIONS, and GL_BALANCES to scope the problem. Creates backup tables xxrsi_gl_je_line_172542 and xxrsi_gl_bal_172542 for je_header_id=14448 in MAR-19.
04_data_fix_phase_2.sqlPhase 2 (superseded): Recodes GL_JE_LINES for je_header_id=14448 from CCIDs 5625/5621 to intermediate CCIDs 3726/3967. Adjusts GL_BALANCES period_net_cr for MAR-19 only. Superseded by Phase 3 when the correct target CCIDs were established.
05_data_fix_phase_3.sqlPhase 3 (partial fix): Recodes GL_JE_LINES for je_header_id=14448 from CCIDs 5625/5621 to 5783/5788. Inserts new GL_BALANCES rows for MAR-19; adjusts BEGIN_BALANCE_CR for APR-19 and MAY-19; inserts balance rows for APR-19/MAY-19. Superseded by Phase 4 which covers all headers.
06_data_fix_phase_4.sqlPhase 4 (definitive fix): Recodes all 4 je_header_ids (14448, 15178, 15197, 15198) from CCIDs 5621/5625 to 5788/5783. Deletes intercompany lines (CCIDs 5380, 5752). Restates GL_BALANCES for MAR-19 through JUN-19: zeros old CCID balances, inserts new CCID balance rows, adjusts intercompany CCID 5380 balances.

Key Tables Affected

TableAction
GL_CODE_COMBINATIONSInsert new code combinations for correct account strings (Scripts 01 and 02 via FND_FLEX_EXT.GET_COMBINATION_ID)
GL_JE_LINESUpdate code_combination_id from incorrect CCIDs (5621, 5625) to correct CCIDs (5788, 5783) for je_header_ids 14448, 15178, 15197, 15198; delete intercompany lines (CCIDs 5380, 5752) (Script 06)
GL_BALANCESUpdate period_net, quarter-to-date, project-to-date, and begin_balance columns for MAR-19 through JUN-19; zero out old CCID balances; insert new CCID balance rows (Scripts 04, 05, 06)
xxrsi_gl_je_line_172542Backup of GL_JE_LINES for je_header_id=14448 (Script 03)
xxrsi_gl_bal_172542Backup of GL_BALANCES for affected CCIDs in MAR-19 (Script 03)
xxrsi_gl_je_line_172542ARevised backup of GL_JE_LINES (Script 05)
xxrsi_gl_bal_172542ARevised backup of GL_BALANCES for Phase 3 affected CCIDs (Script 05)
xxrsi_gl_je_lines_172542BFinal backup of GL_JE_LINES for all 4 je_headers (Script 06)
xxrsi_gl_bal_172542BFinal backup of GL_BALANCES for all affected CCIDs in MAR-19 through JUN-19 (Script 06)