So you’ve left behind your rookie days as an ABAP developer, and you think you know it all? Well, think again. In part 3 of this series, I’m going to show you a few well-hidden settings and features in the ABAP Development Workbench that might surprise you.
Hidden feature 1: advanced code completion
You’re using code completion, right? Every time you type the first few letters of an ABAP keyword, the development workbench proposes applicable statements and inserts them into your code on the press of a key. But are you using this to its fullest extent?
What is available with regards to code completion depends on your SAP application server version and the version of your SAPGui, but you shouldn’t miss out on the most useful thing: the suggestion of variable names and other non-keywords.
With this setting, the ABAP workbench will propose the names of variables that you defined before, saving you a considerable amount of time as opposed to having to type them out each time.
To enable this feature, click on the Settings button in the SE80 transaction (that’s the tiny button at the bottom right that’s overlooked very easily), go to Code Completion, and set the tick mark at Suggest Non-Keywords from the Text. Now, you’re getting ABAP code completion for variables too – an incredibly useful feature!
Hidden feature 2: insert dates easily
Got a change log in your program header, as many companys require? Don’t waste time thinking about what date it is or typing it out. Just right-click on the place you want the timestamp to be, and select More > Insert Date and Time from the context menu. Pick the format you want and you’re done. Saves a few seconds each time you have to provide the current timestamp.
Hidden feature 3: code templates
Similar to the pattern feature i discussed yesterday and on Monday, there’s a “lightweight” way to create commonly-used code fragments automatically: code templates. These are designed to help you out in these “darn, that assignment should go into an IF-clause” moments. You mark a piece of code, right-click it and select Format > Surround by Template from the context menu. Select the template you want and click it. Your code is now enclosed in an IF clause (or whatever you selected)!
As with patterns, you can also define your own templates. To do that, just select Format > Extract Template in the context menu. You can add placeholders for marked text, the cursor position and other things – just try it out to see what you can do.
Hidden feature 4: change cases
Sometimes you want to change text or a keyword to uppercase or lowercase quickly. Instead of retyping everything, the ABAP editor has some nice functionality to do that for you. Mark the text you’d like to change and right-click it. From the context menu, select Format > Change Case. There are several options, and each can be reached conveniently with a hotkey:
- Lowercase (Ctrl + L)
- Uppercase (Ctrl + U)
- Capitalize (Ctrl + J)
- Sentence Style (First letter of first word capitalized; Ctrl + T)
- Invert Case (Ctrl + K)