Skip to content
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

Syntax error in SELECT Statement #251

Closed
JoachimEck opened this issue Feb 19, 2024 · 13 comments
Closed

Syntax error in SELECT Statement #251

JoachimEck opened this issue Feb 19, 2024 · 13 comments
Assignees
Labels
bug Something isn't working

Comments

@JoachimEck
Copy link

JoachimEck commented Feb 19, 2024

Hello ,
I just wanted to use the ABAP Cleaner in a programme again. Unfortunately I get an error after a change and the ABAP Cleaner terminates.

image
At this line the statement is:
image

SELECT aufnr, lead_aufnr, objnr, plnbez, stlbez FROM caufv INTO ( @DATA(lv_aufnr), @DATA(lv_lead), @DATA(lv_objnr), @<ls_auftrag>-matnr, @DATA(lv_stlbez) ) WHERE aufnr = @<ls_auftrag>-aufnr AND werks = @s_werks AND loekz = @space.

Perhaps it is due to the declarations within the SELECT, but the programme can be activated.
Can you tell me if it is me or the ABAP Cleaner?

Many thanks
Joachim

@JoachimEck
Copy link
Author

Hey,
if I swap the variables, it works:
image

Can you please check why it doesn't work in the other way.

Thanks,
Joachim

@jmgrassau
Copy link
Member

Hi Joachim,

thank you for reporting this! Unfortunately, I can't reproduce this error yet, maybe because it depends on a certain rule configuration. Could you please attach the profile with which this error comes up? (menu "Help / Open Profiles Folder…", then attach .cfj file with the profile name).

Can you tell me if it is me or the ABAP Cleaner?

It's definitely ABAP cleaner: If the syntax is correct, ABAP cleaner should be able to deal with it! (Well, apart from a few exceptions like macros with incomplete code blocks, or chain colons inside parentheses, but those provoke specific "unsupported" messages).

Kind regards,
Jörg-Michael

@jmgrassau jmgrassau added the bug Something isn't working label Feb 19, 2024
@JoachimEck
Copy link
Author

Hey Jörg-Michael,
thanks for the quick reply.
Here is my profile, which I use:
profile.zip

Kind regards,
Joachim

@jmgrassau
Copy link
Member

Hi Joachim,

hm, unfortunately, I still can't reproduce the issue, even with the profile. You are using the current release 1.13.1 (menu "Help / About"), right? Does the error log (menu "Help / Open Error Log") contain any more details?

Maybe this issue depends on the context, too. In that case, unfortunately, I'd have to ask for some more work on your end… Could you please:

  • copy the complete code from the ADT editor to any text editor (e.g. Notepad++)
  • in ADT, open menu "Source Code / Show Read-Only Preview With ABAP Cleaner …"
  • you can now use Ctrl+C / Ctrl+V to paste code from the text editor to ABAP cleaner multiple times, trying to reduce the code to a minimum example that triggers the error

Kind regards,
Jörg-Michael

@JoachimEck
Copy link
Author

JoachimEck commented Feb 19, 2024

Hi Jörg-Michael,

I am happy if I can help. I shrunk everything down as far as I could and the error is still there.
image

REPORT. DATA gt_auftrag TYPE STANDARD TABLE OF resb. PARAMETERS s_werks TYPE werks_d OBLIGATORY. START-OF-SELECTION. MODULE status_0100 OUTPUT. LOOP AT gt_auftrag ASSIGNING FIELD-SYMBOL(<ls_auftrag>). SELECT aufnr, lead_aufnr, objnr, plnbez, stlbez FROM caufv INTO ( @DATA(lv_aufnr), @DATA(lv_lead), @DATA(lv_objnr), @<ls_auftrag>-matnr, @DATA(lv_stlbez) ) WHERE aufnr = @<ls_auftrag>-aufnr AND werks = @s_werks AND loekz = @space. ENDSELECT. ENDLOOP. ENDMODULE.

I have tried it outside the MODULE. It works there, so that could be the reason. Is MODULE not supported?

Kind regards,
Joachim

@jmgrassau
Copy link
Member

Hi Joachim,

ah, great, now I get the error message, too! Thanks for your help, let's see what causes this issue!

Kind regards,
Jörg-Michael

@jmgrassau
Copy link
Member

Hi Joachim,

oh, this is too bad! It's the "Align SELECT lists" rule, which tries to keep the maximum line length of 100. So, an even shorter example (no context needed) would be:

    SELECT f1, f2, f3
      FROM any_dtab
      INTO ( @DATA(lv_var_1_with_long_name), @DATA(lv_var_2_with_very_long_name), @DATA(lv_var_3_with_long_name) ).
    ENDSELECT.

which is changed to

    SELECT f1, f2, f3
      FROM any_dtab
      INTO ( @DATA(lv_var_1_with_long_name), @DATA(lv_var_2_with_very_long_name), @DATA(
           lv_var_3_with_long_name) ).
    ENDSELECT.

Kind regards,
Jörg-Michael

@JoachimEck
Copy link
Author

Hi Jörg-Michael,

sorry, i dont get it yet. I've changed the MODULE to an IF-clause. The Error is still there. I understand that it is also because he has to indent in so far. In your example, I don't understand why ABAP Cleaner indents the third varible like this. If I separate the variable from the DATA in my code, I can no longer activate the programme and I get an error.

The line length from the profile is counted from the beginning of the line, isn't it?

For me to understand, is the behaviour so desired and would I need to adjust my profile or are you doing some "magic" ;)?

Kind regards
Joachim

@jmgrassau
Copy link
Member

Hi Joachim,

sorry for the confusion: My example was just demonstrating the bug: ABAP cleaner tries to limit the line length to 100 in the INTO clause (as configured in the profile), but it introduces a syntax error by breaking the line after @DATA(, rather than keeping the inline declaration together. So that is the bug which I'll have to fix, since of course, @DATA( must not be detached from the variable name.

Kind regards,
Jörg-Michael

@JoachimEck
Copy link
Author

Hi Jörg-Michael,

got it! Thanks!

Kind regards,
Joachim

@jmgrassau
Copy link
Member

Hi Joachim,

this will be fixed with the next release, so "Align SELECT lists" then keeps the inline declaration together:

image

Kind regards,
Jörg-Michael

@jmgrassau jmgrassau self-assigned this Feb 19, 2024
@JoachimEck
Copy link
Author

Hi Jörg-Michael,

that was quick!
Thanks.

Kind regards,
Joachim

@jmgrassau
Copy link
Member

Hi Joachim,

thanks again for reporting this and for your help in narrowing down the issue! This bug should now be resolved with version 1.13.2, 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