How to Assign Dynamic Fields using Filed-Symbols in ABAP/4
You can create field name in run time and assign the created name in your field-symbols by statement "ASSIGN ... TO ...".
Example
DATA: name(20),
lv_check(1).
DATA: BEGIN OF itab OCCURS 0,
fld1(4),
fld2(4),
END OF itab.
FIELD-SYMBOLS.
...
...
LOOP AT itab.
IF lv_check = ’X’.
name = ’ITAB-FLD1’.
ELSE.
name = ’ITAB-FLD2’.
ENDIF.
ASSIGN (name) TO.
...
...
ENDLOOP.
- thitima's blog
- 8226 reads
english engl
Post new comment