GRC
HR
SCM
CRM
BI


Article

 

New ABAP Editor and Debugger Boost Developers' Productivity

by Karl Kessler | SAPinsider

April 1, 2006

by Karl Kessler, SAP AG SAPinsider - 2006 (Volume 7), April (Issue 2)
 




Karl Kessler,
SAP AG

Developers are increasingly making use of modeling in ABAP development tools — UI development tools based on the Web Dynpro programming paradigm are good examples — to build programs without having to painstakingly write them line by line. Digging into the code, though, is still the trickiest part of any application development, so it's not surprising that the bulk of a developer's time is spent with the ABAP Editor and Debugger tools. Despite a selection of model-driven programming tools, the typical ABAP developer probably spends as much as 95% of his time writing — and reworking — code using the ABAP Editor and Debugger.

Whenever your work relies so much on any one tool, the addition of any new time-saving feature will have some major impact on productivity and speed up projects significantly. Even from a more user-oriented perspective, you shouldn't underestimate the power of a user-friendly coding environment. It can make sitting down at the computer to make last-minute changes to your application to adapt to new business requirements — or even worse, to edit code you didn't design on your own — all the more bearable.1

With all their new features, the latest versions of the ABAP Editor and Debugger (available with SAP GUI 6.40 patch level 10 for SAP NetWeaver 2004s) are generating quite a buzz — but don't just take my word for it. Both the ABAP Editor and Debugger won first prize at the "SDN Jam Session" demo competition at the 2005 SAP TechEd conferences in both Vienna and Boston. To help show what the excitement is all about, this article looks at the new editing and debugging tools (see Figure 1), and highlights some time-saving features:

  • Automated and customizable syntax coloring, bookmarking, and collapsible code views to help better organize and manage even the most complex development code

  • Code templates, dynamic content, and auto-correct options that "understand" what developers are coding and help programmers avoid syntactical errors

  • More sophisticated, state-of-the-art user interfaces, including split windows and customized screens, to compare different sections of a program and speed development and debugging

Figure 1

Some Sample Views of the New ABAP Editor and Debugger Environments

click here for a larger version of this image

To get a taste of the new ABAP Editor and Debugger for yourself, simply download the latest "Sneak Preview" version of the ABAP application server (based on SAP NetWeaver 2004s), available on the SAP Developer Network (SDN) at www.sdn.sap.com/irj/sdn/downloads. This will give you some experience with Web Dynpro ABAP in conjunction with the new editor and debugger, and even allows you to share your findings in SDN forums. All the screenshots and examples in this column are taken from this demo version, so you can use this article as a reference as you explore the ABAP Editor and Debugger on your own screen.

A Brief History of the ABAP Editor

The new editor is a real breakthrough in its native ABAP support. Some of the limitations of earlier versions of the ABAP Editor can be better understood by taking a quick look back at how the ABAP Editor has evolved.

Early ABAP Editors
The first application ever developed for SAP R/3 was the ABAP Editor. After R/3 Basis was developed in the late 1980s, SAP needed a strong programming environment based on UNIX and relational database technology for its new release. Two projects were launched: one based on C programming and another developed in ABAP on the R/2 platform. Since R/2 ABAP was more or less identical to R/3 ABAP back then, it's not surprising that the ABAP-based solution was available first, and thus has become the commonly used solution. The reason was simple: Even slight changes in C always required a recompile and redeploy on the various UNIX workstations (i.e., installation of a new local GUI), whereas the ABAP-based editor was stored in database tables and therefore, due to ABAP's server-side nature, was immediately available to all developers.

A Block-Editing and Tables-Based Approach
This distribution and self-compiling feature of the ABAP Editor (and, in fact, all ABAP programs) helped to set up a rather stable environment in the early SAP R/3 days, which was key to its success. However, the ABAP-centric design also had its price: Its dialog characteristics reflected a "block mode" editing environment. Users coming from an IBM environment felt comfortable with this, since the ABAP Editor shared many features of editors that are available on an IBM host, including the "block" on the left side of the editor interface where you insert line commands to copy, move, or delete lines. Developers who were used to UNIX or Windows, however, were expecting other types of tools; Windows users, for example, expected a new line when they hit "enter," while mainframe users expected data to be transferred in block mode to the host. To address this, the ABAP Editor offered a "PC mode" that supported a Windows approach. From an implementation perspective, the ABAP Editor continued to use table controls — again, emphasizing handling of tabular data rather than code lines.

Incorporating ActiveX Controls
The next innovation was triggered with SAP GUI's support of OLE, which allowed developers to embed native ActiveX controls capable of sophisticated frontend features such as drag and drop, local search and replace, local scrolling, local printing, and support for keyboard accelerators. This innovation was also reflected in the ABAP Editor, with a control-based editor plus backend features like syntax check and Workbench navigation (including the now indispensable double-click that allows developers to jump from the code directly to the definition of a structure or field).

This ActiveX approach was a major step forward. Since it was being incorporated into a text editor-based approach, however, the ActiveX control-based editor was not aware of the ABAP syntax. Features that had become popular in Visual Basic programming, such as syntax coloring, could not be supported directly. This is where the new ABAP Editor comes into play.

What's New with the ABAP Editor

A look at the ABAP Editor's history (see sidebar above) reflects how the new editor is a real breakthrough in its native ABAP support and its new level of controls sophistication. From a technical standpoint, the new ABAP Editor, like its predecessor, relies on ActiveX controls technology. But this time, this technology knows about ABAP syntax and can better predict and support the ABAP developer's actions.2

Like previous versions of the ABAP Editor, the new editor is tightly integrated into the classic Workbench tools, meaning all the familiar server-side features — such as activation, global search, navigation to other tools, proper embedding into all major tools like class and function builder — are still fully available.

To get started with the new editor, simply switch on the "Front-End Editor (New)" preference setting (as shown on the left screen in Figure 2) and log on as usual to the ABAP Editor. You'll also be able to set yourself up to use the new debugger in the Workbench settings, under the "Debugging" tab.

Figure 2

Switching On the New ABAP Editor and Debugger Tools

The New Look of the ABAP Editor

Figure 3 reveals the new ABAP Editor. Compare this to earlier versions — the only thing that looks familiar is the actual ABAP code!

The most obvious change is all the color; automated syntax highlighting color-codes different syntactical elements. Keywords, such as DATA and CHECK, are shown in blue; string constants are green; custom code is in black; and comments are italicized — and all of these can be customized, which I'll explain in the next section.

Figure 3

New ABAP Editor Features Include Syntax Coloring, Line Numbering, Bookmarks, and Breakpoints

There are other features that developers will welcome:

  • In the leftmost column of the editor screen, developers can insert symbols, such as breakpoints, to indicate stopping points throughout the program — there was no way to display these control icons in the previous version of the editor

  • To indicate newly added or changed code, triangles appear to the right of the corresponding line numbers where code has been edited

  • Numbered bookmarks can be easily inserted and manipulated using a context menu to more flexibly navigate to important points within your program

Customization Options

The ABAP Editor's color and style assignments are certainly not fixed. If you prefer alternate colors and shading, you can customize the editor by simply clicking the customize button in the lower right corner of the main ABAP Editor window, which brings you to the Options menu. Figure 4 shows the various customization options, which include changing the color for breakpoints (in this case, setting it to dark red). Here you can also change the various types of items you can display, including errors and breakpoints. Other customization features include the ability to:

  • Set auto-correction options for frequently occurring misspellings

  • Establish rules for "pretty printing," including indentation settings

  • Format code using font, color, word-wrapping styles, etc.

Figure 4

Customizing the ABAP Editor Through the Options Menu

Split Screens for Easier Maintenance

Clicking the split bar button at the top right of the main ABAP Editor screen allows you to see two views of the same program, as shown in Figure 5. This split view helps you maintain related parts of a program within the same window — for example, you can program data definitions and the affected sections of code in parallel — instead of having to open a second SAP GUI window to do so.

Figure 5

Split View Eases Program Maintenance

Clearer Views of Even the Most Complex Programs

Another outstanding feature of the new code editor is its support for outlining syntactical structures such as CASE…ENDCASE and METHOD…ENDMETHOD (see Figure 6). With the "+" and "-" buttons, you can easily collapse and expand the body of syntactical structures within your code, and therefore better follow the inner structure of your programs by hiding details that are currently out of scope.

Figure 6

Collapsing and Expanding Code Sections for a Clearer View of Program Structure

Features to Make Development More Efficient

Code templates are a powerful means to abstract recurring syntactical patterns. With templates at hand, the system can provide hints — while you enter code — that a template is available. For example, if you type the keyword "select," the system will automatically suggest to use the code template for "select." If you simply press CTRL+ENTER, the suggested template will be inserted. (Misspellings can be corrected on the fly in the same way.)

The new ABAP Editor comes with a large selection of common, predefined template patterns (such as FORM…ENDFORM). But you can also define custom templates on your own, helping enforce customized programming guidelines and the like.

Figure 7 shows the template editor, which is integrated within the customizing dialog in the Options menu. The template mechanisms also allow you to insert dynamic fields (such as date/time) and integrate dialog input (such as the form name) to provide fully flexible templates.

Figure 7

Defining and Editing Code Templates from the Options Menu

Additional Editing Features

Other features that have been enhanced for the new ABAP Editor include:

  • Extended dialogs for find and replace

  • A clipboard that holds code fragments cut during your editing session

  • Capabilities to print and export code snippets or full programs in multiple formats (HTML, PDF, etc.) for sharing code in SDN, for example

I could go on for quite some time about additional new editing capabilities, but let's press on to look at the features of the new ABAP Debugger. As you explore the new debugger, note that the new features of the ABAP Editor are fully integrated into the debugging tool, and vice versa. Now communication between the two tools is seamless.

Exploring the Features of the New Debugger

The debugger has recently gone through significant architectural changes and includes new features that developers will see and benefit from immediately.

In the past, debugger screens were viewed as part of the screen flow of a transaction whenever some breakpoint or watchpoint condition was met. The advantage of this approach was its speed: I have never seen a debugging environment come up that fast. While other debuggers typically appear, slowly initialize the debug environment, and load a lot of symbolic information, the classic ABAP Debugger screens displayed immediately since the debugger was part of the ABAP runtime environment.

On the other hand, the debugger was limited from a user-interface perspective. The debugger's UI control was implemented inside one work process in the kernel, meaning that the debugger and the process being debugged ran in the same internal session. For the user, this meant that the classic debugger appeared in the same SAP GUI window as the application being debugged — which was often confusing. From a technical point of view, this meant that the debugger shared its context data with the application being debugged, and vice versa.3

These limitations of the classic debugger are solved by a two-process architecture in the new ABAP Debugger, where the debugger and the debugged transaction run in cleanly separated external modes using different windows that communicate with each other. All debug controls, such as "single step" and "continue until next breakpoint," are now done in separate windows, while the debugged transaction runs in its own window. When a debug condition is met (for example, when the program hits a breakpoint in the code), then the debugger window is ready for input and links back to the original program. The transaction window is blocked until program execution is resumed in the debugger and the next screen is displayed in the transaction window.4

This "new" architecture is not completely new — it was first introduced in SAP Web Application Server 6.40. But with this architecture come lots of new features for the ABAP Debugger, including advanced user interface control.

A More Sophisticated Look and Feel

Like its classic counterpart, the new debugger explicitly comes up when you enter "/h" in the command field of any application. Figure 8 shows the main window of the new debugger. Note the differences. With the new debugging architecture, the brand-new ABAP Editor control is used, bringing the latest features (such as syntax highlighting) right into your debugging environment. On the right side of the screen, you see the variables display. I picked a couple of variables from the running transaction with the traditional double-click, but you can also easily hover over the code and a transient window pops up, immediately showing the variable's value.

Figure 8

The New Look of the ABAP Debugger User Interface

Customization Options to Tailor Debugger Desktops to User Preferences

Another major difference is the way the new debugger lets the user configure desktops to his needs and switch to specialized desktops for certain debugging tasks. Each desktop is a collection of tools that you can easily customize. For example, if you want to control the flow of execution and display two internal tables simultaneously, you can open the tool dialog and select the appropriate tools. I selected the table tool twice; the result is shown in Figure 9. With the two internal tables displayed side by side, it is now fairly easy to find and correct errors.

Figure 9

Customized Desktop Comparing Two Tables in the New ABAP Debugger

Other Debugging Features

The debugger offers a variety of additional tools, including a Diff tool to compare variables or internal tables in parallel and a tool to display the inner structure of objects, as well as special features including stack display, an overview of breakpoints, the capability to set watchpoints, and more. You can also transfer the actual parameter of a function module call into the test environment for function modules.

A complete discussion of all the new features is certainly beyond the scope of this column. Again I invite you to test drive the 2004s download, available from SDN at www.sdn.sap.com/irj/sdn/downloads.

Summary

All the buzz around the new ABAP Editor and Debugger is well deserved. The new features and design of the ABAP Editor and Debugger better understand the syntactical elements of the language, greatly enhancing the productivity of your ABAP development teams. As always, the tools are integrated into the familiar environment of an ABAP Workbench. But unlike earlier versions, the tools are now integrated with each other — the new editing environment is fully reflected in the debugging environment, and vice versa. What's more, the tools also offer many new customization capabilities to personalize each user's designtime and runtime environment. This is cool, time-saving stuff for ABAP developers!


1 For example, I admit that I didn't like the early Java development tools, as they were inherently slower than typical Windows applications. But when Eclipse arrived on the scene using Windows resources more or less natively for Java development, I instantly became enthusiastic. A cool development environment makes a big difference!

2 The control implementation is independent of the ABAP syntax bindings. As a consequence, it is also used in other tools that require a different syntax, such as eCATT.

3 An ABAP-based implementation was not possible, as the debugger and the debugged transaction ran in the same internal mode, causing interference between debugger and "debuggee."

4 For more details on how the new debugger works, see "Introducing the next generation of ABAP debugging — the New ABAP Debugger" by Boris Gebhardt and Christoph Stöck in the January-February 2006 issue of SAP Professional Journal (www.sappro.com).


Karl Kessler joined SAP in 1992. He is the Product Manager of the SAP NetWeaver foundation, which includes SAP NetWeaver Application Server, Web Dynpro, ABAP Workbench, and SAP NetWeaver Developer Studio, and is responsible for all rollout activities. You can reach him via email at karl.kessler@sap.com.

An email has been sent to:






More from SAPinsider



COMMENTS

Please log in to post a comment.

No comments have been submitted on this article. Be the first to comment!


SAPinsider
FAQ