Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
alexey_arseniev
Product and Topic Expert
Product and Topic Expert
23,405

Introduction


If you develop now UI for SAP, you use Web IDE. If you are doing backend and ABAP, you use ADT (ABAP in Eclipse). But sometimes you still need to come back to SAP GUI and ABAP Workbench and use the “New” ABAP Editor.

For that rare cases when you are doing ABAP in old fashion way 😉 I have some suggestions, which maybe someone is not aware of, and that may help be more productive. In this blog, I will try to explain the most useful functions added in ABAP Editor (from my point of view) and will try to collect links to other useful resources related to ABAP Editor for SAP GUI.

Do not expect too much in the beginning, but the list will grow upon demand.

Disclaimer


I am long time not responsible for the ABAP Editor in Workbench so I cannot add or fix something. And I am not an ABAP Workbench expert in general - I can only give details about that white area where you type your code. But for that white area, I can explain how it was designed and if the thing you want is in or is theoretically possible.

Tips & Tricks


Quick start


It was designed, that when one starts “New” ABAP editor in the ABAP workbench for the first time, he gets an introduction page, explaining new features of the editor. But I never saw this working :).

The page is located aside to ABAP Editor user settings in:
“%APPDATA%\SAP\SAP GUI\ABAP Editor\qstart.htm”
Copy => Win + R => Paste => Enter

And here is the most valuable part of the page:


 

Block / Column Selection



  • Alt + Shift + Left/Right/Up/Down


The ABAP editor allows you not only to use standard (called “stream” selection) but also allow to select a rectangular block of text, which does not start from the beginning of the line:



You can select text block using the keyboard commands (Alt + Shift + Arrows) or with a mouse, keeping the left Alt key during selection:



After selection, you can apply many of the editing functions in block mode:

  • Delete, Insert, Multi-Edit

  • Copy/paste from Clipboard

  • Case conversion

  • Indent etc.


Multi Editing




 

Null Width Selection


The degenerated version of the block selection is Null Width selection (not visualized 🙂 ), which you can use for indenting of text blocks.



 

Clipboard Ring or Multi Clipboard or Clipboard History



  • Ctrl + Shift + V


If you want to see all text pieces you have copied during your editing session, just press Ctrl + Shift + V, instead of normal Ctrl + V. Then you get a history of the clipboard items (up to 12, in chronological sequence) where you can select and paste any of the items (it also overwrites current Windows clipboard content).



 

Case Modification



  • Ctrl + L  -> lower case

  • Ctrl + U -> UPPER CASE

  • Ctrl + K -> sWAP cASE

  • Ctrl + J  -> Capitalize Text

  • Ctrl + T  -> Like in sentence


You can easily modify text cases, without using a pretty print function. It works with stream and with block selection.



 

Lines move



  • Ctrl + Alt + Up/Down


The feature is useful when you need a block of lines, but do not want to overwrite keyboard content. You can move the selected block of lines up or down. If no selection is done, the current line is moved.



 

Line duplicate



  • Ctrl + D


Sometimes it is much faster to duplicate the current line and adjust content than typing it once more.



 

Word/Line Selection


The ABAP editor supports different kinds of word/line selection:

  • Ctrl + Left/Right to select till word borders

  • Ctrl + Left Mouse Click on a word

  • Left Mouse Click on number margin to select lines




 

Incremental Search



  • Ctrl + I, Ctrl + Shift + I


In many cases when you want to do a simple text search you can achieve it without calling the Find dialog and losing your editing context. Just start Incremental Search mode by pressing Ctrl + I and start typing.



  • Press Ctrl + I to search for the next occurrence

  • Ctrl + Shift + I for the search of the previous occurrence

  • Backspace to correct your input

  • Esc to exit incremental search mode

  • See editor status bar for the current search query


 

Code Hints


Code Hints were designed as a proactive, not intrusive alternative for standard code completing list called by Ctrl + Space. It shall be very prudent to resources, but same time giving the user a way to speed up typing.

Code Hints may suggest syntactical construction, variables, and code templates (somewhen before it was also auto correction suggestions in). The editor collects all fitting suggestions, ranks them by type, usage count, input method, and shows you the best hit. Code Templates are always won against keywords and variables, keywords (syntactical constructions) win against keywords.

Suggest Non-Keywords from the Text


The mentioned option is OFF by default (for some reason), but it brings a lot of value. “Non-Keywords from the Text” means in ABAP scope – your variables. So, if you enable the feature, you get your variables suggested by code hints (code completion list will show them independently of the flag) and this may save some typing effort especially if you are using “self-explaining”, meaningful variable names ;). Especially the flag would be useful if you are forced to work on systems below SAP_BASIS 7.02, where full-blown code completion is not enabled, and this flag and code hint the only “completion” you may get :).



 

Code Hint Color


When you using Code Hints, you see that it sometimes has the light, standard background:



And sometimes it has the inverted, dark background:



Have you ever asked yourself: what does this crap mean? 😉

The secret meaning of the Code Hint background color:

  • Light: there is only one suggestion known to the editor. You can safely accept the suggestion by Tab.

  • Inverted (dark): there is more than one suggestion known to the editor and you can call a full-blown auto-completion list to see all alternatives.


ADT (ABAP in Eclipse) has also emulated implementation of Code Hints in some way, but the “secret knowledge” was lost, and the only inverted color is left 🙂 :



 

Why is my code highlighted differently when I paste it into an email?


You may wonder, why when you copy/paste your code from the editor into email (or any other editor supporting HTML formatting) syntax highlighting of the ABAP code looks different from the one you had in the ABAP editor.

ABAP Editor:


MS Outlook:


The reason here - different highlighters that are used for rendering text in both cases. The one in ABAP editor, it is a highly sophisticated one, which works in respect of ABAP grammar available on the ABAP system you work (and require fully qualified input), and the second one, is the rudimental highlighter, which works based on keywords and can highlight even invalid code, but is not in sync to actual ABAP grammar. On the example above we see that the keyword-based parser has not highlighted OCCURRENCE, REGEX RESULTS (while in time the editor was written, these keywords were not yet known J ) but has highlighted the VALUE in the second sentence, which has been marked as an error by ABAP parser.

You would not be able to get code pasted into an email, always looking like one in ABAP editor, but you can extend the syntax scheme of the keyword-based parser, by simply adding missing keywords into the abap_spec.xml file in the ABAP Editor settings directory to get missing keywords highlighted:
“%APPDATA%\SAP\SAP GUI\ABAP Editor”  -> abap_spec.xml

Add this:

<TextType id="52" name="Keywords" ...>
<Keywords>

<Keyword text="regex"/>
<Keyword text="occurrence"/>
<Keyword text="results"/>

</Keywords>
</TextType>

And get them also highlighted:



 

Display list of assigned ABAP Editor keyboard shortcuts


The easiest way to get an overview of currently assigned keyboard shortcuts in your instance of the ABAP editor is a preview of the keyboard mapping scheme file in Internet Explorer (not in Chrome, you need a browser supporting XSLT transformations).

Paste the following path in your Windows Explorer:
%APPDATA%\SAP\SAP GUI\ABAP Editor\keymap.xml

If you are lucky and your default browser is still IE, you will get something like this:



The list is searchable and contains all assigned keyboard shortcuts and command IDs and descriptions for all installed keyboard mapping schemes.
If the command is not on the list, it means, there is no shortcut assigned to it.

 

ABAP Editor Color schemes


Most of you know that it is possible to change the color of syntax elements shown in ABAP Editor. Using that “Settings” button in the status bar. But most of you are a bit lazy to change that consistently and create a new color scheme (Dark one for example) in a way that you can use and share with others.

But some guys did it. Check this GitHub repository if you want to get alternative color schemes for the ABAP editor.

https://github.com/lucattelli/ab4-themes

  



And if you have your own one – share it with the community!

 

ABAP Editor Code Templates


Probably everyone who used the ABAP Editor has also used Code Templates, speeding up typing of routine code. And definitely, there were some cases when you would like to have a new code template for some code block and have not found it among the standard SAP pre-installed ones (for example METHOD/ENDMETHOD.).

Here you can find an extended set of code templates for ABAP Editor which may help.

Feel free to suggest new code templates or request update of existing.

Let us make a world of ABAP Programming better 🙂

 

References


33 Comments
Labels in this area