Skip to content

Specifix SQL Statements in Method leads to error #134

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
bastianStr opened this issue Oct 9, 2023 · 6 comments
Closed

Specifix SQL Statements in Method leads to error #134

bastianStr opened this issue Oct 9, 2023 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@bastianStr
Copy link

I have a method with the following SQL Statement in it:

    SELECT ( SUM( netwr ) + SUM( mwsbp ) ) AS order_amount
       FROM vbap
       WHERE vbeln = '1234567890'
       INTO @DATA(l_order_amount).

When I run ABAP Cleaner on it, i get a Parse error about "ENDMETHOD found but no corresponding METHOD". If I comment the SQL Statement, it works...

@fabianlupa
Copy link

I wonder if SELECT SINGLE makes any difference / sense?

@bastianStr
Copy link
Author

I wonder if SELECT SINGLE makes any difference / sense?

SELECT SINGLE works, but then I cant SUM ;)

@fabianlupa
Copy link

I wonder if SELECT SINGLE makes any difference / sense?

SELECT SINGLE works, but then I cant SUM ;)

Have you tried? I don't think it makes a difference.

@bastianStr
Copy link
Author

bastianStr commented Oct 10, 2023

mmh, ok. You are right, it works. To be honest, I didn't expect this 😄

Ok, great. Problem half solved. At least for me.

This also works with ABAP Cleaner:

    SELECT 
      FROM vbap
      FIELDS ( SUM( netwr ) + SUM( mwsbp ) ) AS order_amount
      WHERE vbeln = '2004678933'
      INTO @DATA(l_order_amount).

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

Hi bastianStr and Fabian,

thanks a lot for reporting and discussing this! This was a bug, because ABAP cleaner wrongly assumed that this SELECT requires an ENDSELECT (and therefore expected an ENDSELECT before the ENDMETHOD).

To determine whether or not SELECT opens a loop is not trivial, and in this case, ABAP cleaner got the arithmetic expression in parentheses wrong. Will be fixed in the next release!

It's nice that there is a workaround, but of course ABAP cleaner should be able to deal with anything that is correct ABAP syntax (well, apart from chain colons inside parentheses as in any_method( iv_value = : 1 ), 2 )., those are just too horrible ;-).

Kind regards,
Jörg-Michael

@jmgrassau
Copy link
Member

Hi bastianStr,

thanks again for opening this issue! This should now be fixed with version 1.7.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

3 participants