ABAP Blog Posts
cancel
Showing results for 
Search instead for 
Did you mean: 

Introduction

Most ABAP developers are familiar with the traditional Pretty Printer for code formatting. While it helps with indentation and layout, modern development often requires much more than basic formatting.

Recently, I started using ABAP Cleaner, an SAP OSS tool available for both VS Code and Eclipse ADT. After exploring its capabilities, I found it to be far more than just another formatter—it acts as a smart code clean up assistant that helps improve code readability, consistency, and maintainability.

In this blog, I will walk through its installation and some of the features that I found particularly useful.


Installation

Prerequisite

ABAP Cleaner requires Java JDK/JRE.

Download and install SapMachine OpenJDK 21 or higher:

Tip: While installing, select the option to add Java to the system PATH to avoid manual environment variable configuration.


VS Code Installation

  1. Open the Extensions Marketplace.
  2. Search for ABAP Cleaner.
  3. Install the extension published by SAP OSS.

That's all you need to get started.

ABAP cleaner in VS code

 


Eclipse ADT Installation

For Eclipse users:

  1. Navigate to Help → Install New Software.
  2. Add the update site URL:
https://eclipse.sap.github.io/abap-cleaner/updatesite/
  1. Follow the installation wizard.
  2. Restart Eclipse.

Feature 1: Format Interactively

One feature that immediately stood out to me is Format Interactively.

Shortcut:

Ctrl + Shift + 4

Instead of applying changes blindly to an entire source file, ABAP Cleaner allows developers to:

  • Select specific code sections.
  • Review proposed changes.
  • Enable or disable individual clean up rules.
  • Accept only the modifications they want.

This provides a level of control that I have not experienced with traditional formatting tools.

Before - After Code cleaner

 


Feature 2: Show Read-Only Preview

Another useful capability is Show Read-Only Preview.

Shortcut:

Ctrl + Shift + 5

Before making any change, ABAP Cleaner displays a comparison view showing:

Current Code → Cleaned Code

This resembles the review experience we commonly have when validating transport changes, pull requests, or code reviews.

Being able to see exactly what will change before applying the clean up builds confidence and helps avoid unintended modifications.


Feature 3: More Than a Formatter

What surprised me most is that ABAP Cleaner goes well beyond formatting.

Some useful capabilities include:

Detection of unused variables

Detection of unused constants

Suggestions through TODO comments

Removal of redundant code after confirmation

Clean up of an entire class within seconds

These features help reduce technical debt and keep development objects easier to understand and maintain.


Profiles and Customization

ABAP Cleaner provides multiple clean up profiles:

  • Default Profile
  • Essential Profile
  • Custom Profiles

Clean up rules are highly configurable, making it possible for individual developers or entire teams to establish and enforce consistent coding standards.

Profile config and Rules

 


My Experience

After using ABAP Cleaner for my current project, I found the tool very useful in terms of code review as well , for example, it highlights if any redundant artifact (data variable, structure, internal table) is defined and not used or read.

Instead of spending time on manual formatting and repetitive clean up activities, I can focus on business logic while the tool helps maintain coding standards automatically. You can select a particular method to be formatted or entire document (for example whole class open in the IDE ).

The interactive formatting and preview capabilities are particularly useful because they allow developers to stay in control of every change being applied and only on approving the change is applied along with TO-DO comments.


Conclusion

ABAP Cleaner is not just a replacement for the Pretty Printer. It is a practical productivity tool that helps developers:

  • Improve code readability
  • Maintain consistent coding standards
  • Remove unused code
  • Reduce technical debt
  • Adopt Clean ABAP practices more effectively

For developers working with ABAP, RAP, ABAP Cloud, SAP BTP, ADT, VS Code, or Eclipse, I believe ABAP Cleaner is definitely worth exploring.


Questions for the Community

  • Are you already using ABAP Cleaner?
  • Which clean up rule do you find most useful?
  • Have you created custom clean up profiles for your team?
  • Any tips or best practices you would recommend?

I would love to hear about your experience and learn how others are using ABAP Cleaner in their development workflow.

N.B - Content is formatted with AI

 

Labels in this area