abapOpenChecks icon indicating copy to clipboard operation
abapOpenChecks copied to clipboard

Check suggestion - inline FS declaration's scope in loops

Open ycohen-dev opened this issue 3 years ago • 1 comments

Given that the ABAP compiler doesn't have proper scope checks for inline field symbols defined in:

LOOP AT lt_table ASSIGNING FIELD-SYMBOLS(<ls_line>).   
...
ENDLOOP. 

Meaning that it is valid code to use <ls_line> after ENDLOOP

then I suggest a new check which will alert the user when such occurrences happen.

For example:

LOOP AT lt_table ASSIGNING FIELD-SYMBOLS(<ls_line>).   
...
ENDLOOP.

WRITE <ls_line>.

ycohen-dev avatar Mar 02 '21 08:03 ycohen-dev

good idea

accessing the compiler information in ABAP is a bit difficult, but instead I might implement this in https://abaplint.org

larshp avatar Mar 02 '21 08:03 larshp