Skip to content

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

Closed

Description

@JoachimEck

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.

Activity

  1. jmgrassau commented on Oct 20, 2023

    @jmgrassau
    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

  2. JoachimEck commented on Oct 20, 2023

    @JoachimEck
    Author

    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

  3. jmgrassau commented on Oct 20, 2023

    @jmgrassau
    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

  4. JoachimEck commented on Oct 20, 2023

    @JoachimEck
    Author

    Thanks a lot :)

    Kind regards,
    Joachim

  5. self-assigned this
    on Oct 21, 2023
  6. jmgrassau commented on Oct 21, 2023

    @jmgrassau
    Member

    Hi Joachim,

    this issue will be fixed in the next release!

    Kind regards,
    Jörg-Michael

  7. jmgrassau commented on Oct 23, 2023

    @jmgrassau
    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

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