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

ABAP Cleaner Menu greyed out for one system but not for another

Open AxelR8 opened this issue 1 year ago • 5 comments

First of all thank you for this great tool!

I have the ABAP Cleaner menu options under Source Code in ADT greyed out for one system 1909 SAP_ABA 75E but not for another system with a more modern release where it is working just fine. I could not find anything related to release or ABAP stack in the System Requirement section, so I wonder if there are any or whether I did something stupid that caused it to be optionally disabled.

AxelR8 avatar Jul 03 '24 19:07 AxelR8

Hi AxelR8,

basically the ABAP cleaner menus are enabled whenever the menu "Source Code / Format Block" is also enabled. I just tried a 1909 / SAP_ABA 75E / SAP_BASIS 754 system, things look fine there. If you open an editor with a CDS View definition, both "Format Block" and ABAP cleaner menus are grayed out (as they should), but if you place he cursor in an editor with ABAP code, all of those are enabled.

ABAP cleaner does have some logic that blocks cleanup rules which introduce newer syntax (such as calculation assignment operators +=, -= etc.) if the underlying ABAP release does not support this syntax; but that's only "inner" ABAP cleaner logic and not related to enabling or disabling the menu item on the UI.

Actually, not sure how exactly "Format Block" determines whether it is enabled or not – does the user for your 1909 system have development authorization etc.?

Kind regards, Jörg-Michael

jmgrassau avatar Jul 07 '24 09:07 jmgrassau

Hi @jmgrassau,

I am facing similar kind of issue in Version: 2025-09 (4.37.0) system but ABAP Cleaner menu options under Source Code in ADT greyed out as you can see in screen shot even though I'm in editing mode.

Kindly mention how should I proceed with this. I didn't faced any issues during installation.

Image

Thanks & Regards Yash

soniYashSDocs avatar Sep 25 '25 07:09 soniYashSDocs

Hi Soni,

thanks for reaching out! What kind of source editor was active (with the cursor in it) when you opened this menu? Since "Format", "Format Block" etc. is grayed out as well, this looks like you simply opened a source type that is not supported (neither by Pretty Printer nor by ABAP cleaner). What happens if you put the cursor into an ABAP class or report and open the menu then?

Kind regards, Jörg-Michael

jmgrassau avatar Sep 25 '25 07:09 jmgrassau

Hi @jmgrassau,

Thanks for the response, after checking a bit more I came to know that the ABAP cleaner is greyed out when the Modification Assistance is turned on, but it does work on ABAP classes. Thanks for letting me know.

Also does this mean its intentional that it doesn't work in modification assistant?

Thanks & Regards Yash

soniYashSDocs avatar Oct 06 '25 07:10 soniYashSDocs

Hi Yash,

yes, that's indeed intentional to avoid that ABAP cleaner changes more code than it should in such a case (i.e. code outside modification brackets).

However, to still use ABAP cleaner, you could install the stand-alone app and use the clipboard to copy ABAP code into the app and back to the code editor, as described in Cleaning code with the stand-alone ABAP cleaner app. Note, however, that some cleanup rules only work if they can "see" the entire method or even the entire class, so you might want to copy all the code into the app, but only selected parts back into the IDE.

Kind regards, Jörg-Michael

jmgrassau avatar Oct 07 '25 11:10 jmgrassau