Thursday, 3 August 2017

Old New ABAP Editor


If you develop now UI for SAP, you use Web IDE. If you are doing backend and ABAP, you use 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 not aware of, and that may help be more productive. In this blog, I will try to explain 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.

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 most valuable part of the page:

ABAP Editor, SAP ABAP Tutorials and Materials

Block / Column Selection

  • Alt + Shift + Left/Right/Up/Down
The editor allows you not only 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:

ABAP Editor, SAP ABAP Tutorials and Materials

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

ABAP Editor, SAP ABAP Tutorials and Materials

Null Width Selection

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

ABAP Editor, SAP ABAP Tutorials and Materials

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).

ABAP Editor, SAP ABAP Tutorials and Materials

Case Modification

  • Ctrl + L / Ctrl + U / Ctrl + K …
You can easily modify text case, without using pretty print. With stream and with block selection.

ABAP Editor, SAP ABAP Tutorials and Materials

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.

ABAP Editor, SAP ABAP Tutorials and Materials

Line duplicate

  • Ctrl + D
Sometimes it is much faster to duplicate the previous line and adjust content than typing it once more.

ABAP Editor, SAP ABAP Tutorials and Materials

Word/Line Selection

The 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 line
ABAP Editor, SAP ABAP Tutorials and Materials

Why my code highlighted differently when I paste it in 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 ABAP editor.

ABAP Editor:

ABAP Editor, SAP ABAP Tutorials and Materials

MS Outlook:
ABAP Editor, SAP ABAP Tutorials and Materials

The reason here – different highlighters that used for rendering of text in both cases. The one in ABAP editor, it is a highly sophisticated one, which works in respect of ABAP grammar available on ABAP system you work (and require fully qualified input), and the second one, is 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 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, that has been marked as an error by ABAP parser.

You would not be able to get code pasted into an email, always looking as one in ABAP editor, but you can extend syntax scheme of the keyword based parser, by simply adding missing keywords into abap_spec.xml file in 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" ...>
    <Keyword text="regex"/>
    <Keyword text="occurrence"/>
    <Keyword text="results"/>

And get them also highlighted:

ABAP Editor, SAP ABAP Tutorials and Materials

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 a bit lazy to change that consistently and create new color scheme (Dark one for example) that you can use and share with others.

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

ABAP Editor, SAP ABAP Tutorials and Materials

No comments:

Post a Comment