Sunteți pe pagina 1din 7

Chapter 05 Debugging

Test support

SAP AG
Chapter 05 Objectives

How to activate the debugger


Using the m ost im portant debugging functions
Setting breakpoints

SAP AG
Branching to Debugging Mode
ABAP/4
developm ent

1 3

D ebugging

Pro gram RSA AA 04D Pro gram RSA A A04D

E xecute

2
ABAP/4 E ditor S election screen

Program ... U tilities ... /h


Execute
Program param eters

SAP AG

There are several different ways you can branch to debugging mode:
1. Start a program by calling the Debugging function (from the ABAP/4 Editor initial screen).
2. Set breakpoints in the program (choose Utilities -> Breakpoints -> Set) and start the program
(choose Program -> Execute).
3. If you want to test a transaction (screen debugging), enter /h in the command field, press ENTER
and choose Execute.
4. From the Object Browser, you can access debugging mode by choosing Program and Display from
the Object list box or Program objects and Edit, and then pressing the pushbutton Test/execute.
On the next screen, you can specify the execution type (e.g. Debugging).
Debugging Mode

Choose Single step Execute Continue Return Table Display list

REPORT RSAAA04D.
DATA: DIFF TYPE P,
.
.
.
COMPUTE DATE_1 = SY-DATUM.
.
.
.

Variables
DATE_1 00000000
S Y-DATUM 19950223

X R

SAP AG

When you are in debugging mode, the program lines appear in the upper half of the screen. The next
line to be processed is flagged by the character >. As usual, you can scroll through the program code
using the standard function keys.
In the lower half of the screen, you can display the contents of fields. To do this, you place the cursor
on a field and choose Choose or use the standard pickup options (press F2 or double-click).
The Most Important Debugging Functions

S ingle step E xecutes the next program line.

E xecute In contrast to Single step, executes all processing steps belonging to


a line completely.

Continue E xecutes the code up to the next breakpoint or up to the end of the
program.
Table Displays the contents of internal tables.

Breakpoint Y ou use the functions in this m enu to define breakpoints.

E ditor Branches to the ABAP/4 Editor.

Hexadecimal display Displays data in hexadecimal format.

Replace Allows you to change data when debugging.

SAP AG

Replace function:
You assign a new value to a field by entering the value in the appropriate place. Next, you select the
checkbox in the column R and press the pushbutton. The new value is then used in the debugging
session.
Setting Breakpoints

1
ABAP/4 Editor Menu Utilities ->
Breakpoints

Key word BREAK-POINT

2
Debugging mode Line selection

Menu Breakpoint

SAP AG

There are several ways you can set breakpoints for a program.
ABAP/4 Editor

1. When you have placed the cursor on a program line, save the breakpoint by choosing
Utilities -> Breakpoints -> Set. Breakpoints sets in this way are valid for the duration of one dialog
session.
2. You can also use the ABAP/4 statement BREAK-POINT to set breakpoints in the program.
Debugging mode

1. When you have placed the cursor on the desired line, you can set a breakpoint by choosing Choose,
by
going through the Breakpoint menu or by double-clicking.
2. You can use the Breakpoint at function (in the Breakpoint menu) to set breakpoints depending on
the return
code value (in the system field SY-SUBRC <>0 with events/FORM routines and key words.
3. The Fields function allows you to set breakpoints in the event of modified field contents
(watchpoint).
Lines for which you define a breakpoint are flagged by the symbol STOP. For an overview of the
breakpoints which have been set, choose Goto-> Breakpoints.
You delete breakpoints by positioning the cursor and double-clicking or by choosing Breakpoint ->
Delete all.
Chapter 05 Summary

In debugging mode, there is a wide range of options for


testing and analyzing reports and dialog programs.

SAP AG BC400 / 5 - 1

S-ar putea să vă placă și