Programming

Exploring the ABAP Editor

ABAP coding can be done in a special tool called the ABAP Editor, which has three different modes to work within.

 

They are the Front-End Editor (used for source code mode—new), the Front-End Editor (used for plain text mode—old), and the Back-End Editor (used for line-based mode).

 

The three editors are fully compatible and interchangeable. The source code created in one editor can be viewed by all other modes.

 

The choice of the editor is based on the user-specific settings made in the ABAP Workbench. The editor can be configured within the ABAP Editor via the menu path Utilities > Settings > ABAP Editor.

 

ABAP Editor Settings Screen

 

The Front-End Editor (New) option provides the latest editor and comes with SAP GUI for Windows 7.0. The new editor is an ActiveX control and is fully integrated into the SAP NetWeaver 7.0 environment.

 

The new editor has all of the modern code editing features:

  • The left margin of the main screen of the editor displays any bookmarks and breakpoints. Breakpoints are displayed with a red stop sign, and bookmarks are displayed as a blue flag in the editor margin. You can set up to nine numbered bookmarks and an unlimited number of bookmarks that are not numbered on the editor for fast navigation within the code.
  • The editor has a line number margin next to the editor margin, where the line number is displayed.
  • The code changes are marked with a red triangle against the line number.
  • The status bar displays the current status of the code.
  • The vertical scroll tip provides information about the current scroll position within the code, current function, class, or method.
  • You can split the code editor screen horizontally by double-clicking on the splitter line on the vertical scroll bar. You can also just drag the splitter line to split the editor screen horizontally.
  • You can collapse or expand blocks of code such as IF-ENDIF or CASE-ENDCASE.
  • The status bar of the editor displays the current status of (CapsLock) and (NumLock) and the line number of the cursor position. (CapsLock) and (NumLock) can be changed by double-clicking on them. Double-clicking on the line number displays the Go to Line dialog.
  • The Front-End Editor has two types of context menu; the context menu options depend on the area selected for the context. The margin context menu is displayed by right-clicking on the left margin and has the option to set breakpoints, delete breakpoints, set bookmarks, clear bookmarks, or navigate to a bookmark (see the following figure).
ABAP Front-End Editor

 

The context menu in the editing area displays the menu options for the ABAP code. The editing area context menu has various formatting, editing, and navigation options, as shown in the figure below.

 

ABAP Editor Context Menu

 

The editor provides code hints at runtime as you type by suggesting keyword hints, block templates, and so on. You can accept the code hint by pressing the (Tab) key or insert a block template by pressing (Ctrl) + (Enter). Furthermore, the editor supports WYSIWYG export functionality and exports to HTML, PDF, and RTF formats.

  • The new ABAP Editor is a fully integrated development environment (IDE) for ABAP programming. It supports syntax highlighting, outlining language structures, real-time code hints, and auto-completion of language structures.
  • With the new code editor you can customize the highlighting for the keyword, strings, and comments. You can customize the font, color, and size for ABAP keywords and comments. Similarly, you can customize font, color, and size for strings, breakpoints, and other display items in the code editor (see the figure below).
Customizing Highlighting for ABAP
  • You can customize the display settings of your editor. The next figure shows the display customization screen. The display and the word wrap options can be switched on or off according to your preference.
ABAP Editor Customizing Display

 

  • Code completion has been added to new the ABAP Front-End edition in SAP NetWeaver 7.0 EHP 2. The tool proposes appropriate ABAP words and operands for where you are in your code. To insert the proposed text, press (Ctrl) + (Space).
  • The other feature that’s new in SAP NetWeaver 7.0 EHP 2 is that with the new code-based view in the ABAP Editor, you can toggle between the classic form-based view in Class Builder and the new code-based view. This new view allows you to see a global class’s whole code, such as a program in the ABAP Editor, and you can edit the code. When you save, the modified source code is then split among the corresponding include programs.
  • Finally, you can customize the code completion options for the editor. This option allows you to complete the available keyword from the dictionary or complete the class, method, or variable name within the scope of the visibility.

The ABAP Editor is one of the most commonly used ABAP Workbench development tools. Especially helpful are the three interchangeable modes; which one do you typically code in?

 

Editor’s note: This post has been adapted from a section of the book ABAP 7.5 Certification Guide: Development Associate Exam by Puneet Asthana and David Haslam.

Recommendation

ABAP: An Introduction
ABAP: An Introduction

Step into ABAP with this beginner's guide. First understand ABAP syntax and find out how to add data and logic to your applications. Then delve into backend programming: learn to work with the ABAP data dictionary, create database objects, and process and store data. Round out your skill set by practicing error handling, modularization, string manipulation, and more. With guided examples, step-by-step instructions, and detailed code you'll become an ABAP developer in no time!

Learn More
SAP PRESS
by SAP PRESS

SAP PRESS is the world's leading SAP publisher, with books on ABAP, SAP S/4HANA, SAP CX, intelligent technologies, SAP Business Technology Platform, and more!

Comments