In following example, the keyword DATA is incorrectly changed to FINAL, if option "Use FINAL for immutable variables" is active:
CLASS lcl_test DEFINITION.
PUBLIC SECTION.
TYPES: BEGIN OF test_structure,
a TYPE string,
b TYPE string,
END OF test_structure.
TYPES test_table TYPE TABLE OF test_structure WITH DEFAULT KEY.
METHODS returning_table RETURNING VALUE(result) TYPE test_table.
METHODS handling_table.
ENDCLASS.
CLASS lcl_test IMPLEMENTATION.
METHOD returning_table.
result = VALUE #( ( a = 'a' b = 'b' ) ).
ENDMETHOD.
METHOD handling_table.
DATA(mutable_table) = returning_table( ). " <<<< changed to FINAL(mutable_table)
mutable_table[ 1 ]-a = 'b'.
ENDMETHOD.
ENDCLASS.
The incorrect change is reported in ADT with error message "The field "MUTABLE_TABLE" cannot be modified.".
In following example, the keyword
DATAis incorrectly changed toFINAL, if option "Use FINAL for immutable variables" is active:The incorrect change is reported in ADT with error message "The field "MUTABLE_TABLE" cannot be modified.".