CHECK_19 - Use LINE OF
Improve this page
CODE
When eg. looping at a table and the destination variable is not defined as LINE OF the table check check will show an error.
Example:
DATA: lt_table TYPE TABLE OF usr02,
FIELD-SYMBOLS: <ls_wa> TYPE usr02.
LOOP AT lt_table ASSIGNING <ls_wa>.
...
ENDLOOP.
should be changed to
DATA: lt_table TYPE TABLE OF usr02,
FIELD-SYMBOLS: <ls_wa> LIKE LINE OF lt_table.
LOOP AT lt_table ASSIGNING <ls_wa>.
...
ENDLOOP.
as this allows to easily change the definition of lt_table without changing the definition of the work area.