Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

ABAP Debugger New

Download as pdf
Download as pdf
You are on page 1of 6

This article appeared in the Apr May Jun 2006 issue of SAP Insider and appears here with

■ ■

permission from the publisher, Wellesley Information Services (WIS), www.WISpubs.com.

Regular Feature
New ABAP Editor
and Debugger Boost Under
Developers’ Productivity Development

Developers are increasingly making With all their new features, the
use of modeling in ABAP development latest versions of the ABAP Editor
tools — UI development tools based on and Debugger (available with SAP GUI
the Web Dynpro programming paradigm 6.40 patch level 10 for SAP NetWeaver
are good examples — to build programs 2004s) are generating quite a buzz —
without having to painstakingly write but don’t just take my word for it. Both
them line by line. Digging into the code, the ABAP Editor and Debugger won
though, is still the trickiest part of any first prize at the “SDN Jam Session”
application development, so it’s not demo competition at the 2005 SAP
surprising that the bulk of a developer’s TechEd conferences in both Vienna and Karl Kessler, SAP AG
time is spent with the ABAP Editor and Boston. To help show what the excitement
Debugger tools. Despite a selection of is all about, this article looks at the
model-driven programming tools, the new editing and debugging tools (see
typical ABAP developer probably spends Figure 1), and highlights some time- and manage even the most complex
as much as 95% of his time writing — saving features: development code
and reworking — code using the ABAP

Automated and customizable syntax ■
Code templates, dynamic content,
Editor and Debugger.
coloring, bookmarking, and collapsible and auto-correct options that “under-
Whenever your work relies so much code views to help better organize stand” what developers are coding
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

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 Figure 1 Some Sample Views of the New ABAP Editor and Debugger
enthusiastic. A cool development environment makes Environments
a big difference!

Subscribe today. Visit www.SAPinsider.com.


and help programmers avoid experience with Web Dynpro ABAP in of controls sophistication. From a tech-
syntactical errors conjunction with the new editor and nical standpoint, the new ABAP Editor,
debugger, and even allows you to share like its predecessor, relies on ActiveX

More sophisticated, state-of-the-art your findings in SDN forums. All the controls technology. But this time, this
user interfaces, including split windows screenshots and examples in this column technology knows about ABAP syntax
and customized screens, to compare are taken from this demo version, so you and can better predict and support the
different sections of a program and can use this article as a reference as you ABAP developer’s actions.2
speed development and debugging explore the ABAP Editor and Debugger
on your own screen. Like previous versions of the ABAP
To get a taste of the new ABAP Editor, the new editor is tightly inte-
Editor and Debugger for yourself, simply grated into the classic Workbench tools,
download the latest “Sneak Preview” What’s New with the meaning all the familiar server-side
version of the ABAP application server ABAP Editor features — such as activation, global
(based on SAP NetWeaver 2004s), A look at the ABAP Editor’s history
available on the SAP Developer Network (see sidebar below) reflects how the 2
The control implementation is independent of the
ABAP syntax bindings. As a consequence, it is also
(SDN) at www.sdn.sap.com/irj/sdn/ new editor is a real breakthrough in its used in other tools that require a different syntax,
downloads. This will give you some native ABAP support and its new level such as eCATT.

A Brief History of the ABAP Editor


The new editor is a real breakthrough in its native ABAP available on an IBM host, including the “block” on the left
support. Some of the limitations of earlier versions of the side of the editor interface where you insert line commands
ABAP Editor can be better understood by taking a quick to copy, move, or delete lines. Developers who were used to
look back at how the ABAP Editor has evolved. UNIX or Windows, however, were expecting other types of
tools; Windows users, for example, expected a new line
Early ABAP Editors when they hit “enter,” while mainframe users expected data
The first application ever developed for SAP R/3 was the to be transferred in block mode to the host. To address this,
ABAP Editor. After R/3 Basis was developed in the late the ABAP Editor offered a “PC mode” that supported a
1980s, SAP needed a strong programming environment Windows approach. From an implementation perspective,
based on UNIX and relational database technology for its the ABAP Editor continued to use table controls — again,
new release. Two projects were launched: one based on C emphasizing handling of tabular data rather than code lines.
programming and another developed in ABAP on the R/2
platform. Since R/2 ABAP was more or less identical to Incorporating ActiveX Controls
R/3 ABAP back then, it’s not surprising that the ABAP- The next innovation was triggered with SAP GUI’s support
based solution was available first, and thus has become the of OLE, which allowed developers to embed native ActiveX
commonly used solution. The reason was simple: Even slight controls capable of sophisticated frontend features such as
changes in C always required a recompile and redeploy on drag and drop, local search and replace, local scrolling,
the various UNIX workstations (i.e., installation of a new local printing, and support for keyboard accelerators. This
local GUI), whereas the ABAP-based editor was stored in innovation was also reflected in the ABAP Editor, with a
database tables and therefore, due to ABAP’s server-side control-based editor plus backend features like syntax
nature, was immediately available to all developers. check and Workbench navigation (including the now indis-
pensable double-click that allows developers to jump from
A Block-Editing and Tables-Based Approach
the code directly to the definition of a structure or field).
This distribution and self-compiling feature of the ABAP
Editor (and, in fact, all ABAP programs) helped to set up This ActiveX approach was a major step forward. Since
a rather stable environment in the early SAP R/3 days, it was being incorporated into a text editor-based approach,
which was key to its success. However, the ABAP-centric however, the ActiveX control-based editor was not aware of
design also had its price: Its dialog characteristics reflected the ABAP syntax. Features that had become popular in
a “block mode” editing environment. Users coming from Visual Basic programming, such as syntax coloring, could
an IBM environment felt comfortable with this, since the not be supported directly. This is where the new ABAP
ABAP Editor shared many features of editors that are Editor comes into play.

Subscribe today. Visit www.SAPinsider.com.


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.

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 Figure 2 Switching On the New ABAP Editor and Debugger Tools
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.

There are other features that devel-


opers will welcome:

In the leftmost column of the editor
screen, developers can insert symbols, Click to access
the Options menu
such as breakpoints, to indicate stop-
and customize
ping points throughout the program — your settings
there was no way to display these
control icons in the previous version
of the editor
Figure 3 New ABAP Editor Features Include Syntax Coloring, Line

To indicate newly added or changed Numbering, Bookmarks, and Breakpoints
code, triangles appear to the right of
the corresponding line numbers where
you prefer alternate colors and shading, display, including errors and breakpoints.
code has been edited
you can customize the editor by simply Other customization features include

Numbered bookmarks can be easily clicking the customize button in the the ability to:
inserted and manipulated using a lower right corner of the main ABAP
context menu to more flexibly Editor window, which brings you to the

Set auto-correction options for
navigate to important points within Options menu. Figure 4 on the next page frequently occurring misspellings
your program shows the various customization options, ■
Establish rules for “pretty printing,”
which include changing the color for including indentation settings
Customization Options breakpoints (in this case, setting it to
The ABAP Editor’s color and style dark red). Here you can also change ■
Format code using font, color, word-
assignments are certainly not fixed. If the various types of items you can wrapping styles, etc.

Subscribe today. Visit www.SAPinsider.com.


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 defini-
tions and the affected sections of code in
parallel — instead of having to open a
second SAP GUI window to do so.

Clearer Views of Even the Most


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

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
Figure 5 Split View Eases Program Maintenance
use the code template for “select.” If
you simply press CTRL+ENTER, the
suggested template will be inserted. dynamic fields (such as date/time) and I could go on for quite some time
(Misspellings can be corrected on the integrate dialog input (such as the form about additional new editing capabilities,
fly in the same way.) name) to provide fully flexible templates. but let’s press on to look at the features
of the new ABAP Debugger. As you
The new ABAP Editor comes with a Additional Editing Features explore the new debugger, note that the
large selection of common, predefined Other features that have been enhanced new features of the ABAP Editor are
template patterns (such as FORM… for the new ABAP Editor include: fully integrated into the debugging tool,
ENDFORM). But you can also define and vice versa. Now communication
custom templates on your own, helping

Extended dialogs for find and replace
between the two tools is seamless.
enforce customized programming guide- ■
A clipboard that holds code fragments
lines and the like. cut during your editing session
Exploring the Features of
Figure 7 shows the template editor, ■
Capabilities to print and export code the New Debugger
which is integrated within the customizing snippets or full programs in multiple The debugger has recently gone
dialog in the Options menu. The template formats (HTML, PDF, etc.) for through significant architectural
mechanisms also allow you to insert sharing code in SDN, for example changes and includes new features

Subscribe today. Visit www.SAPinsider.com.


point of view, this meant that the debugger
shared its context data with the applica-
tion 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
Figure 6 Collapsing and Expanding Code Sections for a Clearer View of hits a breakpoint in the code), then the
Program Structure 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 on the next page
Figure 7 Defining and Editing Code Templates from the Options Menu
shows the main window of the new
debugger. Note the differences. With the
that developers will see and benefit immediately since the debugger was part new debugging architecture, the brand-new
from immediately. of the ABAP runtime environment. ABAP Editor control is used, bringing
the latest features (such as syntax high-
In the past, debugger screens were On the other hand, the debugger was lighting) right into your debugging envi-
viewed as part of the screen flow of a limited from a user-interface perspective. ronment. On the right side of the screen,
transaction whenever some breakpoint The debugger’s UI control was imple- you see the variables display. I picked a
or watchpoint condition was met. The mented inside one work process in the
advantage of this approach was its kernel, meaning that the debugger and 3
An ABAP-based implementation was not possible, as
speed: I have never seen a debugging the process being debugged ran in the the debugger and the debugged transaction ran in the
same internal mode, causing interference between
environment come up that fast. While same internal session. For the user, this debugger and “debuggee.”
other debuggers typically appear, slowly meant that the classic debugger appeared 4
For more details on how the new debugger works, see
initialize the debug environment, and in the same SAP GUI window as the “Introducing the next generation of ABAP debugging
— the New ABAP Debugger” by Boris Gebhardt and
load a lot of symbolic information, the application being debugged — which Christoph Stöck in the January-February 2006 issue
classic ABAP Debugger screens displayed was often confusing. From a technical of SAP Professional Journal (www.sappro.com).

Subscribe today. Visit www.SAPinsider.com.


couple of variables from the running specialized desktops for certain debug- Other Debugging Features
transaction with the traditional double- ging tasks. Each desktop is a collection The debugger offers a variety of addi-
click, but you can also easily hover over of tools that you can easily customize. tional tools, including a Diff tool to
the code and a transient window pops up, For example, if you want to control compare variables or internal tables in
immediately showing the variable’s value. the flow of execution and display two parallel and a tool to display the inner
internal tables simultaneously, you can structure of objects, as well as special
Customization Options to Tailor open the tool dialog and select the features including stack display, an
Debugger Desktops to User appropriate tools. I selected the table tool overview of breakpoints, the capability to
Preferences twice; the result is shown in Figure 9. set watchpoints, and more. You can also
Another major difference is the way the With the two internal tables displayed transfer the actual parameter of a func-
new debugger lets the user configure side by side, it is now fairly easy to find tion module call into the test environ-
desktops to his needs and switch to and correct errors. ment 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
Variables display
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 develop-
ment teams. As always, the tools
Figure 8 The New Look of the ABAP Debugger User Interface
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!

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
Figure 9 Customized Desktop Comparing Two Tables in the New at karl.kessler@sap.com.
ABAP Debugger

Subscribe today. Visit www.SAPinsider.com.

You might also like