Skip to content

Enforcing DATA before TYPES leads to compiler-errors #516

Closed

Description

@VladGhitulescu

Hey,

ABAP Cleaner enforces that DATA declaration has to be before TYPES declaration.

That leads to compiler errors when variables defined in DATA use types defined only later in TYPES.

Could you please check this?

Thanks!

Regards,
Vlad Ghitulescu

Activity

  1. jmgrassau commented on Jun 1, 2026

    @jmgrassau
    Member

    Hi Vlad,

    could you provide a concrete example where this happens? Actually it's the other way round, i.e. the cleanup rule "Rearrange local declarations" tries to put TYPES first (then CONSTANTS, then STATICS, then DATA, then FIELD-SYMBOLS).

    There are only some special cases where that's not possible, e.g. if the component of a structure definition (TYPES: BEGIN OF) refers to a previous DATA declaration with LIKE:

      METHOD any_method.
        DATA lv_any TYPE ty_any.
    
        TYPES: BEGIN OF ty_s_other,
                 comp LIKE lv_any,
               END OF ty_s_other.
    
        ...
      ENDMETHOD.

    Kind regards,
    Jörg-Michael

  2. VladGhitulescu commented on Jun 1, 2026

    @VladGhitulescu
    Author
  3. mraht commented on Jun 1, 2026

    @mraht

    ..another example referring to the limitation mentioned:

    Image
  4. jmgrassau commented on Jun 1, 2026

    @jmgrassau
    Member

    Hi Vlad and Marius,

    ah, I see, thanks for these examples! It seems to be the combination of declaring the table type (which uses the structure definition) and defining the table (which uses the table type). Will look into it!

    Kind regards,
    Jörg-Michael

  5. self-assigned this
    on Jun 1, 2026
  6. jmgrassau commented on Jun 1, 2026

    @jmgrassau
    Member

    Hi Vlad and Marius,

    thanks again for reporting this! This bug should now be fixed with version 1.26.0, which was just released!

    Kind regards,
    Jörg-Michael

  7. VladGhitulescu commented on Jun 1, 2026

    @VladGhitulescu
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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