New, better “Pretty Printer” for Eclipse and as standalone
To avoid errors in the Clean ABAP check from the outset, the coding should be written directly according to the Clean ABAP Guidelines. However, to focus less on formatting and more on the actual problems, the ABAP Cleaner should be used.
Automated code adaptation according to the rules of the Clean ABAP Guideline
The ABAP Cleaner automatically adapts coding to many points of the Clean ABAP Guideline. Lines are indented correctly, method calls are optimized and unused variables are marked. The ABAP Cleaner can therefore be regarded as a Pretty Printer with additional functions for Clean ABAP.
The great advantage of the ABAP Cleaner is that it is possible to fully configure which rules are to be adopted during automatic adaptation and which are not. So if a project does not want to adopt all the specifications from the Clean ABAP Guideline, certain rules can be excluded from the ABAP Cleaner.
Installation of the ABAP Cleaner for Eclipse or as a stand-alone version
The ABAP Cleaner can be integrated into the ABAP Tools for Eclipse via GitHub or installed as a stand-alone version. With the stand-alone version, it is also possible to format coding from the SE80 using copy paste. In Eclipse, however, the features are fully integrated so that copying is not necessary. However, if you first want to carefully test how the code changes with the ABAP Cleaner, you can also copy the code into the stand-alone version first. Or you can use the built-in preview in the ABAP Cleaner (Interactive ABAP Cleaner). This shows which lines are affected by changes and visualizes them in two before and after windows. Here you can also configure which rules are to be applied and which are not.
Link to GitHub: ABAP Cleaner: https://github.com/SAP/abap-cleaner
Keyboard shortcut in Eclipse with ABAP Cleaner installed:
- Clear immediately (without preview via the set standard profile) Strg. + 4
- Interactively debug (with preview): Strg. + Shift + 4
Installation in Eclipse
To use the ABAP Cleaner in Eclipse, the ADT Tools (ABAP Development Tools) must first be installed in Eclipse. Further information can be found on the following page:
https://tools.hana.ondemand.com/#abap
The ABAP Cleaner can then be installed as follows:
Open Eclipse -> Help -> Install new Software.
Interactive ABAP Cleaner with preview of the changes:
Configuration of profiles and preview of functions: Configure Button in „Cleanup Settings“
In the interactive ABAP Cleaner, the “Configure” button can be used to configure various profiles in the ABAP Cleaner. Several profiles can be created that include or exclude the rules of the ABAP Cleaner, for example depending on the project or customer system.
Procedure: Select profile -> Search and select rules on the left (illustrated by example) -> Customize options -> Save
Standalone ABAP Cleaner Software
This is a stand-alone program into which you can copy the ABAP code from the SE80 via the clipboard, for example. The code can then be optimized there and copied out again. The program can also be used if the ABAP Cleaner is not to be tested on the original Eclipse code for the time being.
Download-Link Standalone Version: https://github.com/SAP/abap-cleaner/releases
Start EXE-File
-> Copy code from SE80 and paste into abap-cleaner program
Related topics
Clean ABAP
Modern ABAP Coding
Code PAL for Clean ABAP
ATC Check for Clean ABAP and ABAP Guidelines
Clean ABAP Guideline
Git with all current specifications for ABAP
Do you have any questions?
Get in touch with us.