Skip to content

FINAL field conversion does not consider EML MODIFY statements with "SET FIELDS WITH" as write access #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
b4loghpeter opened this issue Sep 27, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@b4loghpeter
Copy link

b4loghpeter commented Sep 27, 2023

Dear Community,

The 'Use FINAL for immutable variables' formatting option does not consider some EML statements as write access. It therefore transforms the inline DATA() declarations to FINAL() which leads to syntax errors.

 get_rap_create_data(
     IMPORTING et_rap_create_root  = DATA(lt_create_root_data)      "<< Replaced with FINAL
               et_rap_create_child = DATA(lt_create_child_data) ).  "<< Replaced with FINAL

  MODIFY ENTITIES OF <CDS view>
         ENTITY <root_entity>
         CREATE FROM lt_create_root_data      "<< This is OK

         ENTITY <child_entity>
         CREATE BY \_<association>
         SET FIELDS WITH lt_create_child_data "<< Syntax error: "The field lt_create_child_data cannot be modified"

         FAILED   failed_early
         REPORTED reported_early
         MAPPED   mapped.

Can you please check whether this can be fixed?

Thanks & Regards,
Peter

@jmgrassau jmgrassau added the bug Something isn't working label Sep 30, 2023
@jmgrassau jmgrassau self-assigned this Sep 30, 2023
@jmgrassau
Copy link
Member

Hi Peter,

thanks a lot for reporting this – this particular write position was indeed not yet considered by ABAP cleaner!

The issue should be fixed with the next release. Unfortunately, with the different variants of FROM fields_tab / AUTO FILL CID WITH fields_tab / FIELDS ( comp1 comp2 ... ) WITH fields_tab / [AUTO FILL CID] SET FIELDS WITH fields_tab, it seems that it is not always possible to statically determine read-only cases. Therefore, ABAP cleaner now always assumes a write access (shown in red) to these fields tables …

image

… to avoid introducing FINAL(…) where it is wrong.

Kind regards,
Jörg-Michael

@jmgrassau
Copy link
Member

Hi Peter,

thanks again for reporting this! It should now be fixed with version 1.6.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
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants