In SAP ABAP Development Tools (ADT) for Eclipse, the ABAP Cleaner is a tool that helps you automatically reformat and improve your ABAP code based on best practices. It can correct indentation, remove unused variables, and standardize syntax.
How to Use ABAP Cleaner in Eclipse (ADT)
1. Open the ABAP Object
- Open your ABAP class, report, function module, or any other ABAP code in Eclipse.
2. Run ABAP Cleaner
- Option 1: Right-click inside the editor → Select ABAP Cleaner.
- Option 2: Use the shortcut:
- Windows/Linux:
Ctrl + Shift + 2
- Mac:
⌘ + Shift + 2
3. Review and Apply Changes
- A preview window shows before-and-after comparisons of the suggested changes.
- Click Apply to format the code.
Features of ABAP Cleaner
✅ Removes Unnecessary Code – Eliminates unused variables, empty IF statements, etc.
✅ Fixes Indentation – Ensures consistent formatting for readability.
✅ Standardizes Syntax – Converts code to modern ABAP syntax (e.g., DATA(...)
instead of DATA: var TYPE ...
).
✅ Optimizes Performance – Detects redundant operations and improves efficiency.
Customizing ABAP Cleaner
You can configure ABAP Cleaner settings by navigating to: 📌 Preferences → ABAP Development → ABAP Cleaner Here, you can enable or disable specific cleanup rules according to your needs.
When to Use ABAP Cleaner?
- Before committing code to ensure it follows SAP best practices.
- To clean up legacy code when refactoring.
- To maintain consistent coding standards across the development team.
🔹 Pro Tip: Combine ABAP Cleaner with ATC Checks for best results! Would you like a deeper dive into specific cleanup rules? 🚀