Skip to content

No Corresponding FORM - If "SELECT UP TO 1 ROWS" is inside the FORM #159

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
JoachimEck opened this issue Oct 20, 2023 · 6 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@JoachimEck
Copy link

Hello,
I don't know if this is a issue, but I have an old report in which a SELECT is executed with the addition "UP TO 1 ROWS". This happens inside a FORM. When I want to run the ABAP CLeaner, I get the following error message:
image
If I comment out the addition "UP TO 1 ROWS", it works again.

@jmgrassau
Copy link
Member

Hi JoachimEck,

this sound a bit like ABAP cleaner (wrongly) expects an ENDSELECT and therefore doesn't expect the FORM block to be closed yet when the ENDFORM is parsed. Unfortunately, it is not trivial to determine whether or not ENDSELECT is required – could you post the SELECT statement used here? (Exact table and field names don't matter, but the structure of the SELECT).

Kind regards,
Jörg-Michael

@jmgrassau jmgrassau added the bug Something isn't working label Oct 20, 2023
@JoachimEck
Copy link
Author

JoachimEck commented Oct 20, 2023

Hi Jörg-Michael,
here's the SELECT-Statement:

SELECT MAX( col ) UP TO 1 ROWS
  FROM table
  INTO variable
  WHERE something EQ else
     AND something1 EQ else1 .

I have not been an ABAP developer for very long. I would have said that only one value comes back with the SELECT, so I could leave out the addition, but I have read that it can apparently also be that several values come back. The report is already old and I don't want to change the logic.

Kind regards,
Joachim

@jmgrassau
Copy link
Member

Hi Joachim,

ah, very good, now I could reproduce the issue. What confuses ABAP cleaner here is that "UP TO 1 ROWS" is in an unusual position – you'd usually have it after the "INTO" clause (see ABAP documentation for SELECT):

SELECT mainquery_clauses 
  [UNION|INTERSECT|EXCEPT ...] 
  INTO|APPENDING target 
  [UP TO ...] [OFFSET ...] 
  [abap_options]. 
  ... 
[ENDSELECT].

But nevertheless, since the ABAP compiler accepts the syntax from your example, ABAP cleaner should cope with it, too, so I shall try to fix this! In the meantime, if you move "UP TO 1 ROWS" below "INTO variable", ABAP cleaner should be fine with it, too.

Kind regards,
Jörg-Michael

@JoachimEck
Copy link
Author

Thanks a lot :)

Kind regards,
Joachim

@jmgrassau jmgrassau self-assigned this Oct 21, 2023
@jmgrassau
Copy link
Member

Hi Joachim,

this issue will be fixed in the next release!

Kind regards,
Jörg-Michael

@jmgrassau
Copy link
Member

Hi Joachim,

thanks again for this finding – this should now be fixed in version 1.8.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