Skip to content

Error when constant is used to specify variable size #350

Closed

Description

@MDagni

Did you know that you can use constants to specify the size of a char typed variable? The following code generates an error in Abap Cleaner:

report ztest.

constants c_size type i value 10.

data lv_text(c_size) type c.

lv_text = '1234567890'.

This is the error:

image

Activity

  1. jmgrassau commented on Aug 30, 2024

    @jmgrassau
    Member

    Hi Mehmet,

    thanks for reporting this bug – this case is indeed not yet considered by the cleanup rule "Make implicit type explicit"!

    Kind regards,
    Jörg-Michael

  2. self-assigned this
    on Sep 10, 2024
  3. jmgrassau commented on Sep 18, 2024

    @jmgrassau
    Member

    Hi Mehmet,

    thanks again – I thought I solved this, but I just realized there are more issues connected to this, therefore keeping it open for now!

    Kind regards,
    Jörg-Michael

  4. jmgrassau commented on Sep 29, 2024

    @jmgrassau
    Member

    Hi Mehmet,

    okay, with the next release, these issues should now be resolved:

    • "Make implicit type explicit" correctly resolves the implicit types,
    • "Rearrange local declarations" now keeps the CONSTANTS before the TYPES (because they are used there),
    • "Delete unused variables" recognizes that the constants are used and therefore cannot be commented out:

    image

    Thanks again for reporting this!

    Kind regards,
    Jörg-Michael

  5. MDagni commented on Sep 29, 2024

    @MDagni
    Author

    Thank you for solving it quickly 🙂

  6. jmgrassau commented on Sep 30, 2024

    @jmgrassau
    Member

    Hi Mehmet,

    thanks a lot – this should now be fixed in version 1.19.3, 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