Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Mutable table incorrectly changed to immutable, when accessed via table expression #112

@bnichell

Description

@bnichell

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.".

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions