Skip to content

Error at rule "Replace READ TABLE with table expression" #448

Closed

Description

@fmabap

Hi,

we did a mass cleaning (CLI) with the latest abap-cleaner version 1.21.4 .

The filename with errors is now shown in the error log. Thank you very much for that again.

It would be nice, if the whole filename with path would be shown there. It shows currently only the sub folders starting from the entry point (src\...) and the filename without extension (.abap). So it is not possilbe to copy and paste the filename to open it with VS Code for example.

We received during the cleaning an error.

Here is a shorten version of the coding for testing the issue:

REPORT zfm_test_cleaner.

PERFORM test.

FORM test.

  DATA lv_user_id TYPE uname.
  DATA lt_bname   TYPE STANDARD TABLE OF xubname.

  READ TABLE lt_bname WITH KEY lv_user_id TRANSPORTING NO FIELDS.
  IF sy-subrc <> 0.
    RETURN.
  ENDIF.

ENDFORM.

We receive the following error

Image

I had for this test only the rule "READ TABLE with table expression" active (restricted to ABAP 7.50).

I assume that the issue is the WITH KEY lv_user_id. If I replace it by WITH KEY table_line = lv_user_id then it works fine.

Image

Best regards
Frank

Activity

  1. jmgrassau commented on Sep 26, 2025

    @jmgrassau
    Member

    Hi Frank,

    thanks a lot for reporting this issue. This obsolete key syntax is indeed not yet considered in ABAP cleaner, will fix this to introduce "table_line =" in such a case!

    Kind regards,
    Jörg-Michael

  2. self-assigned this
    on Sep 26, 2025
  3. jmgrassau commented on Sep 26, 2025

    @jmgrassau
    Member

    Hi Frank,

    on a closer look, it is the obsolete form WITH KEY = dobj that can always be replaced by table_line = dobj: for this alternative, the documentation reads: "This statement has the same function as specifying the pseudo component table_line as a free key".

    By contrast, in my understanding this might not be true in all cases of WITH KEY dobj, and ABAP cleaner usually cannot retrieve the type information to check that. Therefore, with the bugfix, WITH KEY dobj will be kept, while WITH KEY = dobj will be replaced:

    Image

    Kind regards,
    Jörg-Michael

  4. fmabap commented on Sep 26, 2025

    @fmabap
    Author

    Hi Jörg,

    thank you very much for the explanation and the fast bug fix. It sounds plausible to me.

    Kind regards
    Frank

  5. jmgrassau commented on Sep 29, 2025

    @jmgrassau
    Member

    Hi Frank,

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

    Kind regards,
    Jörg-Michael

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