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

Skip to content

Mutable table incorrectly changed to immutable, when passed as TABLES parameter to function module call #209

@bnichell

Description

@bnichell

In function module calls TABLES parameter, is passed using a reference1.
Thus, 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 test_method.
ENDCLASS.



CLASS lcl_test IMPLEMENTATION.
  METHOD test_method.
    DATA(lt_string) = VALUE test_table( ).       " <<<< Variable needs to stay mutable
    CALL FUNCTION 'FUNCTION_MODULE_A'
      TABLES strings = lt_string.
  ENDMETHOD.
ENDCLASS.

Footnotes

  1. https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapcall_function_parameter.htm#!ABAP_ADDITION_3@3@

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