ABAP Editor - Tips & Tricks

Tags: ABAP

There is a small icon at the bottom right corner of the ABAP Editor.

Opening the settings dialog, customization options and tools will be shown for you. There are really useful possibilities provided, beside showing you very important keyboard commands which all can make editing the source code more efficient. Let me guide you through the screens shown in the dialog.

Display

White Spaces: helpful to discover (problematic) cases, when someone use the ALT+255 in source code. You won't see the spot/point when switching the White Space option on, however you can see the space, but normally better switched off.

Word Wrap: useful when working from low resolution displays or small laptop screens (some times problem, if someone has created lines more than of length 120, please change the source code and reduce it, if you have the possibility. In lot of cases devs forget to do this, because they have a widescreen high resolution monitor and can see the whole row in one line)

Fonts and Colors

Here you can adjust the styles. I do not suggest to change the styles dramatically. If your style differs very from the standard, than your code might look hard to read by others or became ugly. 
If you face the problem, that you cannot see a difference between the display/change mode, then try to apply the color profile of your display in windows first, it can make wonder. 
Changing the size can be done without the adjustment of the default text size. Just press Ctrl and scroll with the mouse, when the prompt is in the editor area.

Code Completion

Enable Auto Completion and Suggest Non-Keywords from the Text: if you declare data, you do not need to type the variable name fully like the ABAP Keywords. How can be code completion invoked ? Use Ctrl + Space , when typing variable name, DDIC object or class/interface name. When you want to have a list of methods or attributes/types of the class to choose, invoke code completion feature after the > character, for example after lo_node->. After selecting an entry from the list displayed press Tab to insert the required entry.

Tip: When you've inserted the method name successfully, you can continue with the Completion, the system will insert you the remaining part of the method signature, the parameters automatically.
I personally do not use Auto Completion, it is disturbing/annoying for me personally, I rather push Ctrl + Space manually, but it can be good to learn which Completion possibilities are provided, when you start learn ABAP.

Code Templates

Just type the name of the template, a tooltip appears, and you can accept the code template pressing Tab.
Very good, that you can define your own code templates in ABAP Editor using Tags replaced by the system when inserting your code template.

I use some for header comments for example. This can be used by other developers working at the same customer also.

*-Description----------------------------------------------------------*
*----------------------------------------------------------------------*
*-Creation-------------------------------------------------------------*
* Author:       Attila Berencsi
* SAP Version:  EhP3 for SAP SRM 7.0
* Date:         %DateTime%
*----------------------------------------------------------------------*

Formatting

Insert Keyword In: I use Uppercase, because the standard Pretty Printer setting is: Indent, and Keyword Uppercase. This has to be used at customer side also.

Keyboard

The list provided contains very good possibilities to edit the source code more efficiently.


Some which is used by me most frequently:

  • Ctrl+Space - AutoComplete
  • Ctrl + F - Find
  • Ctrl + U - Uppercase
  • Ctrl + O - Go to line
  • Ctrl + D - Duplicate line
  • Ctrl + H - Replace
  • Ctrl + , - Comment
  • Ctrl + . - Uncomment
  • Ctrl + Down / Up Arrows - Scrolling
  • Ctrl + Left / Right Arrows - Jump word back/forward
  • Ctrl + Alt + T - Swap line with line above (Transponse)