
ABAP Tools - VS Code (ABAP Cleaner)
One feature we missed in Visual Studio Code was the ABAP Cleaner. This has now been made available. Let's take a look at its installation, configuration and usage.
Table of contents
In this article, we'll take a look at the ABAP Cleaner for VS Code and what you need to work as usual and enjoy all its benefits. Thanks to Thomas Fiedler for bringing this to our attention.
Introduction
When the ABAP Cleaner was released in mid-2023, the world of ABAP developers changed. The ABAP Cleaner significantly reduces the workload associated with formatting source code and also automates several modernization tasks related to clean ABAP. Over 100 rules accessible with a single keyboard shortcut save developers a significant amount of time and provide a unified view of ABAP code for the entire team. Fewer individual formatting styles greatly simplify source code reading. With the release of ADT for VS Code, the question arose: would the ABAP Cleaner also be integrated into the editor, and more importantly, when? Since July 2nd... The plugin is now also available for VS Code.
Installation
In this section, we describe the installation steps to get the ABAP Cleaner running in your installation.
Plugin
You can find the plugin in the VS Code Extension Marketplace. To do this, switch the tool on the left side of the editor and search for "ABAP cleaner". Then, click "Install" Clicking the button will then allow you to perform the installation and integrate the plugin into the editor.
SAP Machine
In the background, the plugin will then start in a Java environment, and VS Code will connect to the service. If you are using the Eclipse version for unpacking without further installation, it's possible that no Java SDK is installed and registered on your computer. In that case, we will receive an error message.
Here you can take a look at the plugin description, which describes further installation steps and requirements. Basically, we can install our own SAP Machine here, or we can register the Java runtime that comes with the ABAP Development Tools for Eclipse. More on this in the next section.
Registration
If you have installed a Java environment or want to use the one provided, you now need to set the path to this environment so that the ABAP Cleaner can find the Java installation. You can simply adjust the environment variables for the current user. This should not require administrator privileges and should be possible for every user. Search for "environment variable", but only for the account and not the system:
For your account, you will find existing variables and may already have a "Path" variable. If this does not exist, create a new one; otherwise, add the new path. Be careful not to delete existing paths, as this will cause other applications on the computer to stop working.
Now you need the path to the installation or to "java.exe" on your system. When installing SAP Machine, look for the file in this folder. If you want to use the version included in the Eclipse bundle, you can find the path here. Generally, the path can change due to version and IDE updates. Simply check the plugins to find the correct version and installation.
...\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_21.0.11.v20260515-1531\jre\bin
In this case, we add the new path and insert it additionally (last path). As described above, the "bin" folder should be last and contain "java.exe"; then the path is correct.
Hint: After registration, you should restart your VS Code so that the server/plugin is restarted again.
Formatter
If you run the ABAP Cleaner for the first time with "CTRL + 4"; The system will then detect that there are multiple formatters, the standard Pretty Printer, and the ABAP Cleaner.
Using the "Configure..." button, we then start the configuration of the standard formatter and select the ABAP Cleaner as the new default.
If you want to adjust or control this property, you can do so in your personal editor settings. Go to the settings and you'll find a button at the top to open the local settings, such as theme, MCP server, or the default formatter.
Here you should now find a new entry so that the ABAP Cleaner is always used for the file type ".abap". If you want to adjust the settings again, you only need to change the JSON or remove the entry completely.
{
"[abap]": {
"editor.defaultFormatter": "SAPOSS.abap-cleaner"
}
}
Usage
Let's take a look at using the ABAP Cleaner in VS Code and see if there are any differences compared to the Eclipse version. We'll briefly discuss the configuration and see the tool in action.
Configuration
Pressing "CTRL + SHIFT + 4" starts the interactive mode, where we can make further settings and also integrate existing variants. The UI is completely identical to Eclipse, as the components are reused. In this example, we have already configured it in Eclipse, and the ABAP Cleaner automatically pulls it in, so there's no extra work for us.
Cleaner
For this, we use a small dummy code snippet that we also created for our YouTube series. We have a dummy structure and output that are deliberately poorly formatted to test the ABAP Cleaner.
CLASS zcl_bs_demo_ai_hello DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES: if_oo_adt_classrun.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_bs_demo_ai_hello IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
data(test) = value I_BusinessPartner(
AcademicTitle = 'Dr.'
BusinessPartnerFullName = 'John Doe'
).
out->write(
`Hello ADT!` ).
ENDMETHOD.
ENDCLASS.
We now go into the code and run the ABAP Cleaner without the UI using "CTRL + 4". The source code is formatted cleanly according to our rules. The unused variable is also noted by the ABAP Cleaner, so we know that the information comes from the ABAP Cleaner.
Conclusion
The ABAP Cleaner is now also available for VS Code. While the configuration is somewhat involved and the plugin doesn't run natively in VS Code but requires a Java Runtime, all the important functions are now available, which will make a large part of the community happy.









