You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use the ABAP Cleaner daily, and set the automatic adding of spaces between character literals and parentheses.
There are though some other places, where it might be very handy to add spaces around the character literals:
declarative statements (e.g. in class header - DATA, TYPES, ...)
value assignments (standalone or in VALUE #(...) statement, if you have multiple fields within the parentheses.
Code snippet:
CLASS myClass DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
PROTECTED SECTION.
PRIVATE SECTION.
METHODS: myMethod.
CONSTANTS: myconstant TYPE string VALUE'xyz'. " <<<=== declaration
ENDCLASS.
CLASS myClass IMPLEMENTATION.
METHOD mymethod.
DATA mytext TYPE string VALUE'cde'. "<<<=== declaration
DATA: somevariable TYPE string,
BEGIN OF somedata,
text TYPE string,
number TYPE i,
END OF somedata,
sometexts TYPE STANDARD TABLE OF string.
somedata = VALUE #( text ='hsdfsd' number = 10 ). " <<<=== string literal in VALUE statement
somevariable ='abc'. " <<<=== standalone string literal
ENDMETHOD.
ENDCLASS.
Thanks a lot in advance, nice work you do with the tool, I like it very much!
thanks, great idea! Actually I think the cleanup rule "Standardize spaces next to parentheses" should be renamed to "Put spaces around string literals", because most of it is really about string literals, and the option "Remove multiple spaces from empty parentheses" could easily be handled by the rule "Remove needless spaces".
Based on your examples, here are all cases that I found – they create warnings and even some red color in ADT, but are no syntax errors:
So you could say, you always want spaces around string literals, except before the three operators : , . and except in cases where introducing a space would lead to a syntax error:
thanks a lot for opening this issue! I just released version 1.10.0 with the following changes:
the option "Remove multiple spaces from empty parentheses" was moved to the cleanup rule "Remove needless spaces" (where it is activated if it was activated before)
the cleanup rule "Standardize spaces next to parentheses" was renamed to "Put spaces around string literals", because that's what it now focuses on
the following three options (highlighted in green) were added:
Adding to the existing options, this now also cares for cases like these – some of which are marked as erroneous with red text color in ADT and create ATC findings, but could nevertheless be compiled:
Activity
jmgrassau commentedon Oct 13, 2023
Hi Csopaki,
thanks, great idea! Actually I think the cleanup rule "Standardize spaces next to parentheses" should be renamed to "Put spaces around string literals", because most of it is really about string literals, and the option "Remove multiple spaces from empty parentheses" could easily be handled by the rule "Remove needless spaces".
Based on your examples, here are all cases that I found – they create warnings and even some red color in ADT, but are no syntax errors:
So you could say, you always want spaces around string literals, except before the three operators : , . and except in cases where introducing a space would lead to a syntax error:
Hope I didn't miss anything?
Kind regards,
Jörg-Michael
move handling of spaces in empty brackets to NeedlessSpacesRule (SAP#143
enhance SpaceAroundTextLiteralRule for keywords, operators etc. (SAP#143
move handling of spaces in empty brackets to NeedlessSpacesRule (#143)
enhance SpaceAroundTextLiteralRule for keywords, operators etc. (#143)
jmgrassau commentedon Nov 1, 2023
Hi Csopaki,
thanks a lot for opening this issue! I just released version 1.10.0 with the following changes:
Adding to the existing options, this now also cares for cases like these – some of which are marked as erroneous with red text color in ADT and create ATC findings, but could nevertheless be compiled:

Kind regards,
Jörg-Michael