CHECK_46 - Shadowed variable
Improve this pageCODE
Returns error for shadowed variables or field-symbols. Note: does not work if a data declaration is shadowing a variable defined with TABLES.
Example:
REPORT zshadow.
DATA: foo TYPE c.
FIELD-SYMBOLS: <foo> TYPE c.
START-OF-SELECTION.
PERFORM foo.
FORM foo.
DATA: foo TYPE i. " shadowing
FIELD-SYMBOLS: <foo> TYPE c. " shadowing
WRITE: / 'sdf'.
ENDFORM.
CLASS foo DEFINITION.
PUBLIC SECTION.
DATA: foo TYPE c.
METHODS: asdf.
ENDCLASS.
CLASS foo IMPLEMENTATION.
METHOD asdf.
DATA: foo TYPE c. " shadowing
ENDMETHOD.
ENDCLASS.