DATA txt_e TYPE c LENGTH 10 VALUE '0123456789'.
TYPES c1 TYPE c LENGTH 1.
FIELD-SYMBOLS <fs_txt_e> TYPE c1.
DO 11 TIMES.
DATA(off) = sy-index - 1.
ASSIGN txt_e+off(1) TO <fs_txt_e>.
IF sy-index < 11.
ASSERT <fs_txt_e> IS ASSIGNED.
ELSE.
ASSERT <fs_txt_e> IS NOT ASSIGNED.
ENDIF.
ENDDO.
"The following example explores area limits of data objects that are assigned.
"The first ASSIGN statement assigns the area limits of the data object txt_e to a field symbol.
"In the second ASSIGN statement in a loop, the second field symbol takes over the area limits.
"This ASSIGN statement does not specify the offset.
"From a specific loop pass on, the assignment does not work anymore as a larger memory area
"is assigned. Therefore, the logical expression is then false.
FIELD-SYMBOLS: <fs_any1_e> TYPE any,
<fs_any2_e> TYPE any.
"345
ASSIGN txt_e+3(3) TO <fs_any1_e>.
DATA strtab_e TYPE string_table.
DO 10 TIMES.
ASSIGN <fs_any1_e>(sy-index) TO <fs_any2_e>.
IF <fs_any2_e> IS ASSIGNED.
APPEND |{ <fs_any2_e> } / sy-index = { sy-index }| TO strtab_e.
ELSE.
APPEND |Field symbol not assigned / sy-index = { sy-index }| TO strtab_e.
ENDIF.
ENDDO.
*strtab_e table content:
*3 / sy-index = 1
*34 / sy-index = 2
*345 / sy-index = 3
*3456 / sy-index = 4
*34567 / sy-index = 5
*345678 / sy-index = 6
*3456789 / sy-index = 7
*Field symbol not assigned / sy-index = 8
*Field symbol not assigned / sy-index = 9
*Field symbol not assigned / sy-index = 10
Serkan AKKAVAK
Computer Engineer BSc
Head of SAP & Software Department
Contact : serkurumsal@yandex.com
0 Comments