Skip to content

GETWA_NOT_ASSIGNED

A field-symbol was accessed but has never been assigned to a memory area.

The field-symbol was declared with FIELD-SYMBOLS but no ASSIGN statement has pointed it at actual data — or it was explicitly unassigned with UNASSIGN.

Symptom

ST22 shows:

Runtime Errors         GETWA_NOT_ASSIGNED
Exception              CX_SY_GETWA_NOT_ASSIGNED
Short text             Field symbol has not yet been assigned.

The dump line is the first statement that reads or writes through the <field_symbol>.

Cause

A field-symbol is a pointer — it holds no data of its own. It must be pointed at an existing variable or table row before it can be used. Common triggers:

  • FIELD-SYMBOLS: <fs> TYPE ... declared at the top but never reached an ASSIGN statement before being accessed.
  • A conditional ASSIGN COMPONENT succeeded only for some rows but the field-symbol was used unconditionally after the loop.
  • UNASSIGN <fs> was called and the symbol was then accessed again in the same scope.
  • A method received a field-symbol via TYPE ANY and the caller forgot to assign it first.

Reproduce

FIELD-SYMBOLS: <fs> TYPE string.

" <fs> was never assigned — dump happens here
WRITE <fs>.

Loop variant — the bug is in the rows where ASSIGN fails:

DATA lt_data TYPE STANDARD TABLE OF string.
FIELD-SYMBOLS: <line> TYPE string.

LOOP AT lt_data ASSIGNING <line>.
  " <line> is assigned in every iteration — safe here
ENDLOOP.

" Outside the loop, <line> may still be assigned to the last row
" but IS ASSIGNED is the only safe check:
IF <line> IS ASSIGNED.
  WRITE <line>.
ENDIF.

Fix

FIELD-SYMBOLS: <fs> TYPE string.
DATA lv_val TYPE string VALUE 'hello'.

ASSIGN lv_val TO <fs>.

IF <fs> IS ASSIGNED.
  WRITE <fs>.
ENDIF.
FIELD-SYMBOLS: <component> TYPE any.

ASSIGN COMPONENT 'STATUS' OF STRUCTURE ls_order TO <component>.

IF <component> IS ASSIGNED.
  IF <component> = 'E'.
    " handle error status
  ENDIF.
ENDIF.
FIELD-SYMBOLS: <line> LIKE LINE OF lt_items.

LOOP AT lt_items ASSIGNING <line> WHERE status = 'E'.
  WRITE: / <line>-matnr, <line>-menge.
ENDLOOP.

" After the loop, only access <line> if IS ASSIGNED
IF <line> IS ASSIGNED.
  " last error row is still accessible here
ENDIF.

IS ASSIGNED vs IS INITIAL

IS INITIAL on a field-symbol checks whether the pointed-at value is initial — it does not check whether the field-symbol is assigned at all. A non-assigned field-symbol with IS INITIAL still dumps. Always use IS ASSIGNED.

Prevention

  • After every ASSIGN or ASSIGN COMPONENT, immediately check IS ASSIGNED before reading the field-symbol.
  • Prefer LOOP AT ... ASSIGNING <fs> over ASSIGN inside loops — the loop handles assignment automatically per iteration.
  • For modern code, prefer DATA(lo_ref) inline declarations and object references over field-symbols where possible; they start as INITIAL and can be checked with IS BOUND.
  • Enable the Extended Program Check (SLIN) — it flags many unguarded field-symbol usages statically.

See also

  • OBJECTS_OBJREF_NOT_ASSIGNED — the equivalent dump for object references
  • CX_SY_REF_IS_INITIAL — exception class for null object references
  • Transaction ST22 — ABAP runtime error analysis
  • Transaction SLIN — extended program check

Comments