ABAP short dumpObjectITAB_ILLEGAL_INDEXModuleABAP

ITAB_ILLEGAL_INDEX — ITAB_ILLEGAL_INDEX dump causes and fixes

ITAB_ILLEGAL_INDEX fires when ABAP code tries to access an internal table by row number (INDEX, table expression, LOOP AT, INSERT, DELETE, MODIFY) using an index that is zero, negative, or performed against a HASHED table, which has no linear row order and cannot be addressed by position at all. It is almost always a coding defect, not a data or Basis issue.

This page covers the ITAB_ILLEGAL_INDEX runtime error: what the dump text actually means, the recurring code patterns that trigger it in production ABAP, and the exact fields in ST22 that identify which pattern is in play. It also separates the quick reflex fixes that mask the symptom from the changes that actually remove the defect.

Published 16 Sept 2026· 1,238 words

What the dump means

ITAB_ILLEGAL_INDEX is raised by the kernel when a statement tries to read, insert, delete, or modify an internal table row by its ordinal position and that position is not valid for the table in question. There are two distinct triggers hiding behind one dump name. The first is a numeric one: the index passed is zero, negative, or otherwise outside what the runtime accepts as a row number before it even checks table length. The second is structural: the statement uses INDEX-based addressing (READ TABLE ... INDEX, LOOP AT ... FROM/TO, table expression itab[ n ], INSERT/DELETE/MODIFY ... INDEX) against a HASHED table, which is stored and retrieved by hash key, not by row position, so any index-based operation against it is illegal by definition regardless of the value supplied.

Root causes that actually produce it

  • Index-based access on a HASHED table: by far the most frequent real cause. A table was declared HASHED for lookup performance, but a routine written for a STANDARD table (READ TABLE INDEX, LOOP AT ... FROM, table expression itab[ n ]) was reused or copy-pasted without changing the access method.
  • Stored sy-tabix reused after the table changed shape: a loop captures sy-tabix, then a DELETE, SORT, or refresh inside or after that loop shifts or reorders rows, and the stored index is used later against the new table state.
  • Index derived from one internal table but applied to another: two parallel tables are supposed to stay row-aligned, but a filter, sort, or partial refresh on one desynchronizes them, and code indexes the second table using a position taken from the first.
  • Empty table accessed with a hardcoded index, typically INDEX 1, on the assumption that a prior SELECT or BAPI call always returns at least one row. When the result set is empty, the fixed index is out of range.
  • Off-by-one or negative index from manual arithmetic: counters decremented past zero, loop boundaries computed with an inclusive/exclusive mismatch, or a BINARY SEARCH sy-tabix used without checking sy-subrc first.
  • Generic or dynamic table handling: a BAdI, enhancement, or framework method receives a table parameter typed as a generic table (ANY TABLE, generic type) and applies hardcoded index logic without checking the actual table kind at runtime, which only surfaces once the caller happens to pass a HASHED instance.

What to inspect in ST22

  • Dump header, 'What happened': confirms this is index-based access rejected by the kernel and usually states whether the reason is an invalid index value or an unsupported table kind.
  • 'Information on where terminated': gives the exact program, include, and line number of the offending statement, and the ABAP statement type (READ TABLE, LOOP, INSERT, DELETE, MODIFY, or table expression).
  • Source code extract on the same screen: shows the statement in context, which usually reveals immediately whether an INDEX clause was used against a table declared HASHED nearby.
  • 'Chosen variables' / active variables section: shows the current value of the index expression and, where visible, the row count of the table at the time of the dump.
  • Active calls and events: identifies the calling transaction or background job and the business document being processed, needed to reproduce the exact data condition.
  • Follow-on: use the 'Debugging' option from ST22 to reproduce with a breakpoint at the failing line, then inspect the table's declared kind (via the ABAP Debugger's table tools or SE11/type definition) and the index value side by side.

Resolution path

If the cause is index-based access on a HASHED table, the access statement has to be rewritten to use key-based READ TABLE WITH KEY, or LOOP AT ... WHERE, or the table declaration has to change to SORTED or STANDARD if ordered/positional access is genuinely required elsewhere in the same routine. Either path is a code change requiring a transport and, in a customer-owned program, a proper change request; in an SAP-delivered program it should be raised through standard support channels rather than modified directly. If the cause is a stale sy-tabix after the table shape changed, the fix is to stop caching row positions across mutating statements and instead re-read by key, or to collect keys to act on and process them in a second pass after the loop. If the cause is an empty table with a hardcoded index, add a length check (lines( itab ) > 0) or switch to a table expression wrapped in TRY/CATCH for CX_SY_ITAB_LINE_NOT_FOUND before assuming row one exists. If two tables have drifted out of alignment, the real fix is to stop relying on positional correspondence and join or match by key instead.

The fix people try first (and why it fails)

The common first move is to wrap the offending statement in a blanket TRY...CATCH against cx_root or the generic itab exception class and swallow it, or to bolt on an IF sy-tabix <= lines( itab ) check written after the fact without understanding why the index went wrong. Both suppress the dump but leave the defect in place: on a HASHED table the check never fires because the problem is the table kind, not the value, so processing silently skips rows or writes to the wrong record, and the real defect resurfaces later as a data discrepancy that is much harder to trace than a dump with a clean stack.

Prevention

Treat table kind as part of the interface contract: any routine that receives a table parameter generically (ANY TABLE, generic type, or a type determined only at runtime) should check the table kind explicitly or restrict itself to key-based access only. Extended program check and ABAP Test Cockpit checks for table access consistency should be run on any code touching internal tables declared HASHED, since this is the single largest source of this dump. Avoid caching sy-tabix across statements that can change table content, and prefer FOR loops over manual index counters where the table might be re-sorted or filtered mid-routine.

Whose problem this is

This is an ABAP development defect, not a Basis issue; Basis involvement is limited to confirming it is not a kernel or memory-related side effect. The handover to the developer should include the program, include and line from ST22, the table name and its declared kind, the index value at the time of failure, and the business document or transaction that triggered the run so the data condition can be reproduced.

Related SAP objects

Reviewed pages this object connects to in the ERPClimb knowledge graph.

Source: ERPClimb — https://erpclimb.com/sap-abap-dumps/itab-illegal-indexERPClimb is an independent platform and is not affiliated with SAP SE. Reference pages are written and reviewed by SAP consultants for learning and troubleshooting.