Shortcuts that can make an ABAP’er life easier
Introduction
ABAP is quite different from many contemporary programming languages in several ways. Some aspects of ABAP would make us wonder why is it made this complex while some aspects are so awesome and more comfortable for a programmer than any other language can provide.
Two of those things that I find so cool are:
- Its ingenuous IDE (ABAP Editor) and
- Its cool Debugger
Eventhough the SAP IDE does not support some of the features which more prominent IDE’s like Eclipse etc have, I find it so comfortable to code in ABAP Editor compared to others. The reason is because of the below shortcuts and customizations available with it. I am listing the few which I use constantly and without which I cannot think of coding ABAP.
Most of the programmers even with a little bit of ABAP experience would have come accross the details listed here. If you have, please ignore and if you haven’t then the stage is yours..
|
Shortcut |
What it does |
|
Ctrl + D |
Duplicate any line. eg. i_vbap TYPE STANDARD TABLE OF vbap + Ctrl-D = i_vbap TYPE STANDARD TABLE OF vbap |
|
Ctrl + / |
Jump to the “command field” where we enter t-codes. This comes really handy and saves a jump from keyboard to mouse and back to keyboard just to click on the box. |
|
Ctrl + J |
Convert to Proper case where the first letter of every word becomes a capital letter. This is pretty useful when writing comments. eg. * this is a comment which will give absolutely no useful information will be changed to |
|
Ctrl + I & |
Incremental search. This is a little improved ‘Find’ (Ctrl + F) function which searches as soon as you type. Useful for impatient people. Add shift to search backwards. |
|
Ctrl + K |
Toggle between Upper case and Lower Case. |
|
Alt + Selection |
This is useful in situation where you need to select only the field names of a particular table. eg. caufv–aufnr, caufv–werks, caufv–objnr, caufv–plnbez, caufv–gamng, caufv–gasmg, caufv–gmein, caufv–plnnr, caufv–plnal, caufv–dispo, caufv–fevor, caufv–cy_seqnr , caufv–aufpl, caufv–gstrp, caufv–gltrp, caufv–gstrs, caufv–gltrs, caufv–gstri, caufv–gltri, In these values, u can select only the field names by pressing Alt key and get the clipboard filled like this. aufnr, werks, objnr, plnbez, gamng, gasmg, gmein, plnnr, plnal, dispo, fevor, cy_seqnr , aufpl, gstrp, gltrp, gstrs, gltrs, gstri, gltri, |
|
Tab & Shift tab |
Increase and Decrease Intend |
|
Ctrl + O |
Goto a particular line in the program |
|
Ctrl + Shift + S |
Save your program in Desktop in .abap format. I came know about .abap only after learning this short cut. |
|
Ctrl + Selection |
When you do a selection with **** + -> or <- hold on to Ctrl to jump every word in that direction. |
|
Ctrl + . & Ctrl + , |
Comment and Un-Comment selected lines. |
|
Ctrl+Alt+T |
Swaps current line with the Upper Line. eg. INCLUDE ZTEST_ABAP_HTTP_CLIENT_TOP. INCLUDE ZTEST_ABAP_HTTP_CLIENT_C01. becomes INCLUDE ZTEST_ABAP_HTTP_CLIENT_C01. INCLUDE ZTEST_ABAP_HTTP_CLIENT_TOP. |
| Ctrl+Shift+L/X | Deletes the whole line |
| Ctrl + ] & Ctrl + [ | Jump to previous or next paragraph.
A paragraph is created by leaving an empty line between statements. |
| Ctrl + Shift + Num8 & Ctrl + Shift + Num2 |
Move the lines up and down in the editor window while the cursor stays in the same place. This is similar to Page Up & Page Down but instead, it does not scroll an entire page but only one line. |
| Ctrl + Spacebar |
Display options to complete a command. Eg. After typing CREATE, Ctrl + Spacebar will show you the list to choose DATA or OBJECT.. When I press Tab for completion, it pops up for TR Number… The TR number that we give will be added in the comment. Variable Name Suggestions This is just a small setting but it will save you from Copy pasting or re-typing small words. Particularly useful for longer variable names. Conclusion Apart from the editor and debugger functions, the navigation and where used-list are other funtionalities which we use more often. Especially the code maintenance and support activities are comparitively less hectic just because these features. Another cool way to extend its core editor functionality for customizations could be by providing API’s even for the application programmers to code and customize the editor features. It will also add to the creativity aspect on SAP side since any third programmer could come with an awesome idea as an editor extension. As far as I have explored, I havent found any BADI or classes which can be used to perform editor functions. May be I have to look more or wait… Update: I got impressed with the response for this blog and it made me dig deeper inside the subject and came across this. Programming Shortcuts – The GEEK Style: Most of the shortcuts listed and not listed here can be seen from the SAP-GUI editor options. Again, click on the editor options button in the bottom-right corner of the SAP Editor screen, and choose… Now.. Most of the shortcuts listed above are available in the above list. We can re-assign any of the actions with any shortcuts we desire.. There are also cool actions which are not assigned to any shortcuts, Copy Append is one such shortcut which I find to be very useful, un-assigned. I am assigning a new shortcut Ctrl + Alt + C for copy append.. Now by pressing Ctrl + Alt + C, I can append contents into my clipboard. Eg. + Ctrl + Alt + C Similarly you can set shortcuts for Cut Append, Navigating to Bookmarks, Formatting Selected text etc… |








Hi Yuvaraj,
Thanks for sharing these shortcuts and other tips.
Though I consider myself an experienced ABAP developer, there were a few shortcuts I didn't know yet.
And since I'm not working as much in the new Eclipse editor as I'd like to, these will still come in handy the next couple of years.
Best regards, Fred
Hi Fred,
Thanks a lot for your kind words.
I hear people say that Eclipse is particularly useful when we want code in multiple platforms at the same time like Netweaver JAVA, mobile and ABAP. As far as application developers are considered, SAP GUI editor cannot be replaced, atleast for a couple of years.
Cool info!
However, I was wondering if you knew the shortcut to maximizing & minimizing the Editor windows & moving them over the screen. This comes in handy when you are comparing what is displayed on 2 separate windows of the SAP GUI.
Well, for comparing different parts of the same program, I would recomment the embedded splitter, the small button on the upper right corner of your editor screen,
when you are comparing two different programs, I would go for SE39.
But if you really insist on using different windows, then u can make use of the Windows short cuts,
Hope it helps,
Yuvaraj S
Hi Utkarsha,
As mentioned by Yuvaraj, Alt+ Space Combination works with all Windows applications. You can try it out even in your Windows Media Player, My Documents Folder etc.,
If you are using Windows 7 or Higher Version of Operating System,
Click on the Title Bar and simply drag it:-
Drag it to the top - Maximize the whole window (Similar to double click on the Title Bar)
Drag it to the left - Fixes your windows to the left half of your screen.
Similarly for the right side.
Thank you!
Alt + Tab toggle
I would like to contribute with 6 more shortcuts.
Ctrl + L = All text lowercase
Ctrl + U = All text uppercase
Ctrl + N = Open a new Window in SAP
Shift + F1 = Execute Pretty Printer
Ctrl + F2 = Check Sintax
Ctrl + F3 = Activate Object.
Best regards
I have not been a big fan of doing Activate, Check etc using Ctrl + Function buttons. I have always felt as if the fucntion keys belong in a diffrent island 😛 . Thats why I didnt mention any of those. Its a biased opinion though.
Thanks for the share!
Hi,
Good work.
I am adding few more to shortcuts to your list.
Ctrl+F - Search
Ctrl+G - Find next ( when the Search window is closed )
Ctrl+O - Go to line
Ctrl+L - Small letters
Ctrl+U - Uppercase letters
Ctrl+J - Camel case letters
Ctrl+K - Switch between Upper and Lower Case
Ctrl+H - Find and Replace
Ctrl+Shift+I - Increment search Backward
Ctrl+Shift+S - Save Hardcopy
Ctrl+Shift+L/X - Deletes whole line
Ctrl+Shift+V - Gives All Paste options
Ctrl+Alt+T - Swaps line with Upper case
Regards,
Mayur Priyan
Thanks for expanding the list.
You are awesome..!
Ctrl+Alt+T Swaps with the upper line (not Upper case).
and Ctrl+Shift+V does not work in SAP Netweaver 7.2
Hi,
Yup, Ctrl+Alt+T - Swaps line with Upper line* . It was a typo .. 😛
hi,
Ctrl+Shift+V very useful one
thank you
Hi Kiran,
i am glad you found it useful.
Cheers 😉
Thanks for sharing. Every time someone shares something like this I pick up one or two more tricks.
I do have one correction, though. Ctrl + J converts a selection to proper case, not camel case.
This Is Proper Case.
ThisIsCamelCase.
Judging from the responses i think you should have posted this as a WiKi so that others could have added to the list of shortcuts easily 🙂
If you have already done so, i'll then ask you to add the link to your blog for easy reference 😉
- Suhas
Thanks for ur comment
Posting it as a Wiki would have been better. Anyway I am updating the list when someone mentions any lesser known shortcut..
I am just wondering, had Yuvaraj posted it as a wiki, would it still have appeared on the front page of SCN!? I think xMoshe Naveh (Old Acct) would need to chime in here!
Regards,
Kumud
A definite Like!
I knew most of the shortcuts but the ones I did not know are awesome (ex.:Ctrl+Alt+T).
Just one thing:
For commenting code I do this:
CTRL < to comment
CTRL > to uncomment (they are usually on same key so this is with SHIFT)
Could not get yours to work.
Thanks!
Well, thanks to Mayur Priyan for Ctrl+Alt+T...
Thanks for sharing your knowledge....
Regards,
Srinivas Katreddy
Great Job Yuvraj.
Really useful info for everyone!!.
Thanks a lot,
Hi Yuvaraj,
Very useful info,
Thanks for sharing.
Best Regards ,
Satbir
Thanks for sharing!
Useful information thanks for sharing.
Hi Yuvraj,
Simple, Crisp, and Useful Information that i hope all Abapers should be aware of.
Presented very clean and attractive. Good work. Keep Going.. 🙂
Regards,
AyyamPerumal
Thanks for sharing tips ..will reduce some typing stuff
Reagrds,
Vamsi
Thank you for sharing this knowledge.
Regards,
Christian 🙂
Thanks for sharing Yuvaraj. Ctrl + '/' certainly saves one quite a bit of time.
Ctrl + SPACEBAR - Gives you a predictive drop-down list of commands for a keyword. This only works once the IDE has proposed a keyword. As an exmple, type 'in' , the IDE will propose 'INCLUDE TYPE' (or other), then hit Ctrl + SPACEBAR.
Cheers
Hi Garth,
I came across this 'Ctrl + Spacebar' shortcut, but this does not work with
SAP_BASIS 701 & SAP_ABA 701 (the version that I use)..
Any idea from which version it works?
Hi Yuvaraj,
This feature is available on version 7.02, but have used it on previous versions as well.
Cheers
Thanks for reply,
I figured it out finally. The cursor position should also be in the right place for the editor to propose.
Eg. DATA<space> and Ctrl + spacebar suggests for Begin-of or End-of.. 😎
Hello Yuvaraj,
Thanks a lot for shareing such a valuable Information with us.
Its really useful to me
Thanks,
Nilesh.
Helpful document...
I am added few short cuts
Ctrl + T - Converts first letter CAPITAL
Example:
fld1(20) TYPE c,
select and Ctrl + T
It Changes like this
Fld1(20) type c,
Ctrl + [ - Go to first line of a Paragraph
Curser will be in first line
| TYPES: BEGIN OF ty_excel,
Fld1(20) type c,
fld2(20) TYPE c,
fld3(20) TYPE c,
END OF ty_excel.
Ctrl + ] - Go to last line of a Paragraph
Curser will be in last line
TYPES: BEGIN OF ty_excel,
Fld1(20) type c,
fld2(20) TYPE c,
fld3(20) TYPE c,
| END OF ty_excel.
Alt + Selection
We can add and delete values in selected area
Select with Alt + Selection and Delete
TYPES: BEGIN OF ty_excel,
Fld1(20) type
fld2(20) TYPE
fld3(20) TYPE
END OF ty_excel.
Select with Alt + Selection and Enter values
Regards,
Ramesh.T
This ALT+select is also very useful to align typing of a list of variables, when a new one has a longer variable name.
Select with Alt + Selection
Press tab untill equally aligned
Hi ,
if we define a Structure.This feature is avalible from EHP5
1.Type 'TYPE' and press Ctrl + Space
2.Along with this without moving the cursor press Shift + Enter and give the DB table name .
3.Click on ‘Preview TYPE’ and Select the fields Required
4.Press Ok.
Here we will get Structure and fields descriptions automatically.
Ex: types : begin of ty_mara,
matnr type mara-matnr, "material number
mtart type mara-mtart, "material type
end of ty_mara.
Regards,
OmChandra
Hi Yuvaraj,
I had bookmarked your blog yesterday itself but came to know the real importance of it today 🙂 . Didn't know many of them like alt+selection. Really helpful shortcuts and actually I enjoyed a lot using them. Keep sharing such informative things.
Cheers,
PS
Hi experts,
I remembered one more shortcut to help us.
To assist in locating codes, can be a bookmark, using a combination: CTRL + ALT + (0 to 9).
To go to bookmark created, use combination CTRL + (0 to 9).
Example:
CRTL + ALT + 2 (Create a bookmark)
CTRL + 2 (Go to bookmark).
Best regards.
Hi Yuvaraj,
Thanks for sharing this valuable information. All these shortcuts come handy while coding. Special mention of the embedded splitter in ABAP editor. Thanks for sharing.
I also like the Formatting -> Enable Auto Bracket option. Very useful for short method call.
It's adds the ')' automatically anytime you type '('.
Peter
Hi All,
Keyboard shortcuts for left - hand people are need in order to have the same functionality as CTRL+C (to copy), CTRL+X (to cut) and CTRL+V (to paste).
CTRL+INS = CTRL+C
SHIFT+DEL = CTRL+X
SHIFT+INS = CTRL+V
Thanks & Regards,
Chinni
Thanks Yuvaraj (and also to everyone else who contributed more to this post). With each advance of the ABAP Editor more features are added and it is very helpful to have someone list them and show examples.
One question though, is there a way to save Code Templates globally so they are shared among all developers? Patterns are helpful but not interactive or dynamic like the code templates.
Regards
Andy
Hello Andy,
Thanks for your comments..
Thats an interesting question.
Well most of the settings that we do in ABAP editor including the Code Templates and ShortCut Keys can be shared.
All these settings are stored in Local PC as XML files.
In Windows 7, they can be accessed by the following path..
"C:\Users\<username>\AppData\Roaming\SAP\SAP GUI\ABAP Editor"
or simply start->run-> Type %Appdata%-> enter will take you to the userdata folders,
goto SAP->SAPGUI->ABAP Editor Folder from there...
This folder has XML files for all the settings that we make in the SAP GUI Editor options.
In platforms other than Windows 7, there should be a similar folder, probably in a different location..
Helpful !!
let me know the exact difference between r3 and ecc6.0 and 4.7? what makes change.
Thanks For Sharing
Hi Yuvraj,
Just come across this document. No wonder it is attracting these many likes and praises.
Very useful knowledge sharing.
Congratulations!
Jogeswara Rao K
very helpful and useful !!!
Great post Yuvraj..indeed make abaper's life easier.
Very useful information, Yuvraj. Thanks for sharing.
Thanks Yuvraj for updating about shortcut and specially for editor option . 🙂
really its very helpful yuvaraj,, appreciated for your inputs.. Thanks,,
Very Nice Document.
Regards,
Sushant
Great Post...
Keep up the good work.
Hi Ramesh,
Like I have mentioned, all the shortcuts can be seen and programmed from the 'Keyboard' menu in Editor options
Thanks for collecting and adding them separately though... 🙂
Hi Yuvaraj,
Thought of sharing few points in your blog.
In the editor we also have the option of surronding existing line(s) of code by statements such as if...else, do...endo, while...endwhile etc.
We can select the line(s) of code and then right click the mouse and then select
Format->Surround by Template
You will see lot of options as I had mentioned like if...else, do...endo, while...endwhile etc. Once you select the command you will see that the lines you have selected have been surrounded by the selected command.
This becomes useful in case where you have several lines of code already written but only want to enable it for a particular condition or something. However you can cut the selected lines of code and paste it into a notepad and then manually write your if or do condition and then paste your code back. But the shortcut which I just discussed will make sure that there are no incorrect nestings of any if... else command or do..enddo command inserted this way 🙂
Similary there a re lot of options in the Format Menu available in mouse right click.
Another point is regarding a programming shortcut rather a keyboard shortcut 🙂
Neverthless it is very useful in many scenarios.
Suppose you have several radiobuttons in your selection screen and yo need to check which of them has been selected by the user and write logic accordingly. A conventional way of acheiving this is by way of using if else statement like below:
If p_rad1 EQ 'X'.
<do something>
elseif p_rad2 EQ 'X'.
<do something>
elseif p_rad3 EQ 'X'.
<do something>
elseif p_rad4 EQ 'X'.
<do something>
endif.
Now here comes the shortcut,
Instead of writing 'N' number of if else conditions you can write the code like:
CASE 'X'.
WHEN p_rad1.
<do something>
WHEN p_rad2.
<do something>
WHEN p_rad3.
<do something>
WHEN p_rad4.
<do something>
WHEN OTHERS.
ENDCASE.
Most of you mite be aware of this. But those of you who are not aware of this, I am sharing it for you.
Yuvaraj, I hope it is some value addition to this wonderful blog of yours !!!
Thanks,
Ajay Bose
Thanks for ur contribution,
Yes, Surround by template will be useful at times.
And Case 'X' statement is cool indeed. I wouldn't call it a shortcut, but it is the right way to code for a radio button. Thanks for sharing..
Thanks a lot for sharing..
ctrl+U = Selected text in Upper case.
ctrl+T = Text start letter in capital remaining small.
Hey Yuvraj,
Great info.
Thanks for sharing
Thanks for sharing Yuvraj. This will be really useful 🙂
good article!!
Nice work brother.. 😎
Ctrl + / is the most helpful.
Now I have customized for Selection Comment (Ctrl + Shift + ,) and Selection Uncomment (Ctrl + Shift + .) and that's is too handy.
Thank you for sharing.
Regards,
Amitesh
ALT + selection was new to me.
Thanks for sharing nice information.
cool 🙂
Very useful Info.
Thanks for sharing.
Nice post, interesting and very helpful. Thank you so much for posting.
shift+F10 will show the context menu from any screen
Thanks for sharing.... 🙂
Very nice! Thanks for sharing!
yuvaraj,
nice info...very useful....
Regards,
Sampath
Nice effort. Thanks for sharing.
Srinu.
very informative. Thanks for sharing ...
Regards,
Satbir.