ABAP Debugging
ABAP Debugging
ABAP Debugging
In collaboration with
Start from any point you are by typing /h in the command field (Except: SAP displays currently a popup window )
Disadvantage: The debugger will show the handling of the selection screen.
In collaboration with
1.
Enter the program name and check Program and click Display
Advantage:
2.
Put the cursor on the program name an press the execute button
In collaboration with
Navigation
trough the
coding
Creation of
watch points
Creation of
watch points
Program
Coding line
number
Navigation
trough the
coding
Switch to the
internal table
display
Next
Program
step to be
executed
Delete all
variables
from
Currently
active ABAP
Program
Include in
which the
current coding
is located
Scroll trough
the list of
variables
List of variables
for which the
content should
be analysed
Important
System
Variables
In collaboration with
Fields:
Table:
Break points:
In collaboration with
Watch Points:
Overview:
In collaboration with
In collaboration with
Setting:
There are four different ways of stepping through program code in the Debugger:
Single step:
Use this option to step through the program a statement at a time. This is particularly suitable when you want to look into subroutines and function
modules, since this method steps through them as well as the main program. After processing a subroutine or function module, the Debugger
returns to the statement in the main program that follows the call.
Execute:
This option processes a program a line at a time. All steps in the same line are processed together. If you are positioned on a line that calls a
subroutine and choose Execute, the system executes the subroutine and proceeds directly to the next line in the main program, bypassing the
statements in the subroutine.
Return:
Returns to the position at which a calling program regains control. Use this option when you are debugging a subroutine or function module and
want to return to the program that called it.
Continue
Use this option to process the program up to the next breakpoint (dynamic or static) or up to the cursor position. If there are no more breakpoints
in the program and you have not set a cursor, the system processes the remainder of the program and ends the debugging session.
In collaboration with
In the Fields display mode in the Debugger, you can display, and also change, the contents of up to eight program fields. This is the default
display mode in the Debugger.
Procedure:
Enter the field names, either directly in the input fields, or by double-clicking the field name in the source code display. The system
automatically enters the field name in the display.
In collaboration with
10
buttons to
form.
In collaboration with
11
The Debugger allows you to display and change the contents of simple or nested internal tables. The table display mode
also allows you to find out information about the table type, table key, or memory use of an internal table.
Procedure:
1.
From any display mode in the Debugger, choose Goto => Table or press
The table display mode appears.
2.
In the Internal table field, enter a table name (or double-click the name of an internal table in the source code display).
3.
Choose ENTER .
4.
In collaboration with
12
In collaboration with
13
While you are debugging a program, you might want to change the content of specific fields to influence
your program's flow. For example, suppose your debugging session reveals that a field contains a wrong value.
The Debugger allows you to replace the wrong value with a correct one. You can now see whether the program
works properly when the field values are correct.
You can change the values of all fields, database tables (with offset), and internal tables referenced in a
program. The system displays a message to notify you of any format errors.
Procedure
1.
2.
Double-click a field to place it in the field display. The field is displayed with its current value.
3.
4.
The Debugger writes the new value into the program field(s), and records the change in the system log. If you
forget to click on the pencil icon,
the system ignores the values you entered.
The Debugger records the values exactly as you enter them. You must therefore make sure that you use the
correct format (upper/lowercase, left-justified input for hexadecimal numbers).
In collaboration with
14
The Debugger allows you to manipulate the contents of an internal table during runtime. You can delete, edit,
Deleting a Row :
2.
3.
4.
Place the cursor on the line you wish to remove from the table.
5.
Choose Delete.
The line disappears from the table and the system adjusts the line numbering accordingly.
In collaboration with
15
Editing a Row
The functions Modify, Insert, and Append are field-specific in the Debugger. You can only apply them to
one field at a time. For example, if you want to edit the following line:
buzei
rblnr
rbuze
|5105603189|000001|
you first need to decide which field to change. Then, do the following:
1.
Place the cursor on the row and field you want to edit.
2.
Choose Change. The system displays one field of the chosen row in the input mode.
3.
4.
Choose ENTER .
The system updates the line and displays the new contents in the table.
In collaboration with
16
The Insert and Append functions allow you to add new lines to an internal table. Append places the new
line at the end of the table. Insert lets you position the line anywhere. To add a new row to the end of the table:
1.
Choose Append.
2.
3.
Choose ENTER .
The system adds a line to the table and fills in the first field.
4.
Enter the remaining fields of the line by following the procedure for editing a row as described above.
To insert a new line anywhere in the internal table, position the cursor on the
line directly following the
line where you want the new row to appear. Then,
choose the Insert button and proceed as you would if you wanted to
append the
line.
In collaboration with
17
As well as running a program from the beginning in the Debugger, you can also set a precise point in the program at
which the Debugger is called by setting one or more breakpoint. A breakpoint is a signal from the ABAP program to
the runtime processor to interrupt processing and start the Debugger.
As an alternative to breakpoints, you can set watch points. Watch points activate the Debugger when the contents
of a selected field change. For further information, refer to Watch points
Static
To set a static breakpoint, enter the ABAP statement BREAK-POINT directly in the program code.
Normally user-independent, they can also be made user-specific.
These are set in the ABAP Editor or the Debugger, and are displayed as stop signs. Unlike static
breakpoints, they are always user-specific, and are deleted when you end your terminal session.
Statement breakpoint
This special form of dynamic breakpoint is set in the Debugger. The Debugger interrupts the
program immediately before the specified statement is executed.
Event breakpoint
This form of dynamic breakpoint is set in the Debugger. The Debugger interrupts the program
immediately before the event, subroutine, or module pool is called.
The Debugger interrupts the program immediately before a function module is called.
The Debugger interrupts the program as soon as a system exception occurs, that is, when a
runtime error is caught by a CATCH statement.
In collaboration with
18
Dynamic breakpoints are user-specific. You should therefore use them whenever you want to interrupt a program
without affecting other users. When you log off from the R/3 System, all of your dynamic breakpoints are
automatically deleted.
Dynamic breakpoints are more flexible than static breakpoints, since you can delete or deactivate them at runtime.
This has the following advantages:
You can set them even if other developers are blocking the program that you are testing
You can set a counter (for example, only activate the breakpoint when it is reached for the fifth time)
In collaboration with
19
Dynamic Breakpoints
You can set up to 30 dynamic breakpoints without having to change the source code of your program.
You can set them either in the ABAP Editor or directly in the Debugger:
In the ABAP Editor, you can set dynamic breakpoints in either change or display mode. You can also set
breakpoints at runtime directly within the Debugger. To set a dynamic breakpoint in the ABAP Editor:
1.
Place the cursor on the line of code at which you want to set the breakpoint.
2.
You can display a list of all dynamic breakpoints in a program by choosing Utilities => Breakpoints =>
Display. The dynamic breakpoint display lets you navigate to a certain breakpoint or delete one or all breakpoints
from your program code.
1.
Place the cursor on the line where you want to set the breakpoint.
2.
The system sets a breakpoint at the line and places a small stop to the left side of the line indicating a
breakpoint. If the line already contains a breakpoint, the system deletes it.
When you finish your debugging session, your breakpoint will be deleted unless you have explicitly saved it.
In collaboration with
20
Special dynamic breakpoints are useful whenever you want to interrupt a program directly before a
particular ABAP statement, subroutine, or event, but you are not sure exactly where that statement, subroutine
or event occurs. Special dynamic breakpoints are user-specific, and can only be set in the Debugger.
1.
2.
1.
2.
Choose ENTER .
The system sets a breakpoint in all liens containing the given statement.
The system confirms the breakpoint and adds it to the breakpoint list. When you end your debugging
session, the breakpoint is deleted automatically unless you save it explicitly.
In collaboration with
21
These special dynamic breakpoints allow you to interrupt a program directly before a subroutine, event, or
module is called.
Procedure
1.
2.
1.
Enter the subroutine, module, or event before which you want to interrupt the program.
2.
Choose ENTER.
The system sets a breakpoint immediately before all calls to the subroutine, module or event.
Result
The system confirms the breakpoint and adds it to the breakpoint list. If the subroutine, module, or event does not exist in the program, the system displays a
message and does not set the breakpoint
In collaboration with
22
Procedure
1.
2.
Enter the function module before which you want to interrupt program processing.
The system sets a breakpoint each time the function module appears in the program.
3.
Choose ENTER .
If you entered a function module that exists in the system, the system confirms the breakpoint and adds it to the breakpoint list.
In collaboration with
23
Watch points
Watch points, like breakpoints, provide a signal from the program to the ABAP runtime processor to
interrupt processing at a particular point in the program. Unlike breakpoints, watch points only activate the
Debugger when the contents of a field change. Like dynamic breakpoints, watch points are user specific, that is,
they do not affect other users who are running the program at the same time
You can only set watch points in the Debugger.
Use
You can set watch points in the Debugger for specific fields. They allow you to determine when the
contents of a certain field change. The Debugger interrupts the program as soon as the field contents change.
Features
You can also specify conditions that have to be met before a watch point becomes active.
You can define watch points as either local or global. Local watch points are only active in the current
program. Global watch points are valid in the current program and in any other programs that it calls.
In collaboration with
24
Use watch points when you want to interrupt a program when the contents of a field or structure change.
You can set up to five watch points.
Watch points can be either local or global. Local watch points are only active in the current program.
Global watch points are active in the current program and any programs that it calls.
Procedure
1.
2.
3.
Enter the name of the field for which you want to set the watch point.
4.
If you want your watch point to be activated each time the field contents change, you have now entered all of the
necessary information, and can return to the Debugger by choosing ENTER . The watch point now appears in the
watch point list.
5.
If you want to specify conditions for the watch point, continue with step 5.
6.
To create a conditional watch point, choose one of the following relational operators:
In collaboration with
25
To create a conditional watch point, choose one of the following relational operators:
Operator
Meaning
= or eq
Equal
<> or ne
Not equal
< or lt
Less than
<= or le
>= or ge
> or gt
Greater than
In collaboration with
26
If you create more than one conditional watchpoint, you can link them using a logical operator:
OR:
AND:
Procedure:
Open the watch points list by choosing Goto => Watch points.
In collaboration with
27
Changing a Watchpoint
1.
2.
Click the pencil icon in the line containing the watch point that you want to change.
1.
2.
28
You cannot use Breakpoint => Delete or Breakpoint => Deactivate/ activate to deactivate or delete a watch point.
Instead, you must:
1.
2.
Click the trashcan icon in the line containing the watch point that you want to delete
In collaboration with
29
Suppose we take a example where we need to find the value of Invoice number and other
details in Report.
Program-ZRVO0006 TCode-ZVO3
In collaboration with
30
In report put the breakpoint at the place where you have written code for the field which you
want to search , here in this example like we want to search invoice number so we put
breakpoint at place where logic is written to fetch invoice data:
In collaboration with
31
In collaboration with
32
Then Choose the variant maintained in the selection screen and execute the program,you will
reach in debug mode.
In collaboration with
33
In collaboration with
34
In collaboration with
35
Thanks
In collaboration with
36