abap-cleaner icon indicating copy to clipboard operation
abap-cleaner copied to clipboard

Unchaining SELECT-OPTIONS

Open luis-rod-git opened this issue 5 months ago • 2 comments

Hi: (Not really a bug, just a comment)

The “Unchain into multiple statements” has unchecked, as a default, the unchaining of simple commands (CLEAR, FREE, etc.).

So far, so good. Nevertheless I recently came across a program where someone had chained the SELECT-OPTIONS command (please don’t ask, first time I have ever seen this done).

Should this really be considered a “simple command”? SELECT-OPTIONS can have many options so (maybe) it is not so “simple”.

Just a thought…

Regards, Luis

luis-rod-git avatar Jul 14 '25 14:07 luis-rod-git

Hi Luis,

you're right, of course, SELECT-OPTIONS certainly isn't simple… I think this is mainly a wording issue, it would be more precise to say: "Unchain commands where the chain colon is in a simple position right after the first keyword" and "Unchain commands where the chain colon is in a later, more complex position".

There are also 'nightmare' cases ("over-complex"), in which the chain colon is inside parentheses (then an opening parenthesis can be closed mulitple times):

  a = a * ( 1 +: b ), c ), d ).

or in a statement that opens a block:

  IF a >: b, c, d.
        do_something( ).
      ENDIF.
    ENDIF.
  ENDIF.

This is correct ABAP syntax, but ABAP cleaner refuses to even parse such statements.

Kind regards, Jörg-Michael

jmgrassau avatar Jul 15 '25 05:07 jmgrassau

"This is correct ABAP syntax, but ABAP cleaner refuses to even parse such statements"

Believe, I would also refuse to parse them too :-)

Thanks for the explanation.

Best regards, Luis

On Tue, Jul 15, 2025, 01:57 Jörg-Michael Grassau @.***> wrote:

jmgrassau left a comment (SAP/abap-cleaner#427) https://github.com/SAP/abap-cleaner/issues/427#issuecomment-3072078755

Hi Luis,

you're right, of course, SELECT-OPTIONS certainly isn't simple… I think this is mainly a wording issue, it would be more precise to say: "Unchain commands where the chain colon is in a simple position right after the first keyword" and "Unchain commands where the chain colon is in a later, more complex position".

There are also 'nightmare' cases ("over-complex"), in which the chain colon is inside parentheses (then an opening parenthesis can be closed mulitple times):

a = a * ( 1 +: b ), c ), d ).

or in a statement that opens a block:

IF a >: b, c, d. do_something( ). ENDIF. ENDIF. ENDIF.

This is correct ABAP syntax, but ABAP cleaner refuses to even parse such statements.

Kind regards, Jörg-Michael

— Reply to this email directly, view it on GitHub https://github.com/SAP/abap-cleaner/issues/427#issuecomment-3072078755, or unsubscribe https://github.com/notifications/unsubscribe-auth/BQV6YXJG3NZBV5WT6ACGJSD3ISJ2ZAVCNFSM6AAAAACBPJFNNCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTANZSGA3TQNZVGU . You are receiving this because you authored the thread.Message ID: @.***>

luis-rod-git avatar Jul 15 '25 16:07 luis-rod-git