DataXstream OMS+

ABAP Tricks: CTRL is the Key for Code Hinting!

ABAP Tricks

ABAP Tricks: CTRL is the Key for Code Hinting!

If you’ve worked with other IDE’s outside of the SAP GUI/workbench, such as Visual Studio, you may be familiar with the concept of code hinting or code auto completion. Essentially, it’s like an auto-suggest feature like you’d see while writing a text message, except you can use it while you code to easily look up types, variable names, and more depending on what program you’re using to write your code.

But what does the ABAP workbench offer us in terms of on-the-fly code assistance?

Obviously we have access to Search Help with various function keys, you have the Pattern wizard, and you can always pull up SE11 or SE37 in another window to try and reference whatever you’re after. But that’s not exactly convenient, nor is it fast. Gee, wouldn’t it be nice to have a way to quickly reference a field in a structure, or tee up a fully built out method call, all by simply hitting a few keys on your keyboard in real time?

Bring in the CTRL Key!

The CTRL key in Workbench is the gateway to saving you a ton of time and hassle, and making you a much more efficient ABAP developer. Combined with other keys, you can do things such as dynamically suggest fields, structures, and types, while programming, and even build out fully-stubbed and ready-to-go function and method calls with no clicking required! Below, I’ll quickly go through some of the most useful ones:

Suggest fields / data types

In the example below, I use CTRL+SPACE key to suggest the data element I’m looking for, followed by the ENTER key to autocomplete my selection, and then use it again to show me the fields of the structure, along with their data type. All without a single click of the mouse or breaking my concentration by leaving the window!

Use CTRL + Spacebar to inline-search and suggest code completions, or look up the fields of a structure in real time!

Use CTRL + Spacebar to inline-search and suggest code completions, or look up the fields of a structure in real time!

Stub out method / function calls

Similar to the above, except this time I have a class I’ve created, and I’m trying to call one of the methods inside of it. I use CTRL+SPACE and the ENTER key to quickly access my class and find the method I want. Then, after it autocompletes the class method name, I hit CTRL+SPACE a second time, and immediately hit ENTER, and it stubs out the entire method call, complete with helpful comments pulled from the methods parameter setup!

Finding my class, the method I want, and then stubbing it out for myself in less than 5 seconds!

Finding my class, the method I want, and then stubbing it out for myself in less than 5 seconds!

So there you have it folks. You’d think this would be common knowledge and one of the first things people entering an IDE would expect to see in some form or another, but it’s staggering just how many ABAP folks (senior, even) that I’ve talked to that didn’t know about this little gem of info. If this tip changed your life, or if you know of even more neat things you can do with the GUI’s inline code hinting, leave a comment below and share the wealth!

3 Comments

  1. Avatar for Ondra
    Ondra
    December 15, 2017 at 2:23 am · Reply

    Thanks for your videos and bold shortcuts. Ctrl+Spacebar I knew ..but the second time I have not realized. AMAZING!!! (8-o) Exactly what I was searching for with keyword: typing abap pattern.

    Happy Xmas.

  2. Avatar for Michael
    Michael
    April 25, 2019 at 8:53 am · Reply

    Thanks! Some times the small things help.

  3. Avatar for Tomek
    Tomek
    September 21, 2019 at 1:32 pm · Reply

    But why it doesn’t work? What should be switch on before?

Leave a reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.