Show TOC

WatchpointsLocate this document in the navigation structure

Procedure

Short Summary

Watchpoints allow you the option of monitoring the content of individual variables.

The Debugger stops as soon as the value of the monitored variable changes.

In addition, conditions can be specified. The Debugger also checks whether such a condition is fulfilled.

Detailed Description

Creating a Watchpoint

In the toolbar of the New Debugger, you will find the pushbutton Create Watchpoint . It brings you to the dialog box Create Watchpoint.

Using this function, you can enter the variable to be monitored. All possible ABAP data structures are allowed here. ---------------------------------------------------------------------------------------------------------------------------------

Special Case: Watchpoint for Internal Table:

Setting a watchpoint for an internal table may have a negative effect on performance during program runtime and also cause an increase in memory consumption.

The reason for this is that a "clone" of the original data object is created for the watchpoint on a table (as for every other watch point as well). If the table for which the watchpoint was set has become too large, you must take into consideration that the "clone" will have the same size. With very large internal tables, this can lead to memory bottlenecks.

In some cases, therefore, it can be a good idea to have watchpoints for internal tables active only for short program durations.

Tip:

In those cases where you are only interested in changing the number

of rows in the internal table, you can alternatively

proceed as follows:

Set a watchpoint on the header of the internal table, for example,

"*ITAB[]" with the condition

does not equal current number of rows, for example, "LINES( ITAB ) <> 1000"

---------------------------------------------------------------------------------------------------------------------------------

When you create a watchpoint, the variable taken as the default value for the watchpoint is the variable on which the cursor is currently positioned (in the editor or another tool). You can only set watchpoints for variables in the current context (program).

For local variables, you can specify whether the watchpoint is to apply to the current procedure instance or to all instances of this procedure that are ever called. Particularly for recursive calls of the procedure, this difference can be of importance.

In addition, you can enter any arbitrary condition in the following box entitled "Condition". Only if the watchpoint variable changes AND the condition is fulfilled will the Debugger stop.

The condition must match the following syntax:

<Function(Variable) or Variable>

Operator

<Function(Variable) or Variable or Constant>

Here the following functions are available: (The syntax is identical to the ABAP syntax)

For internal tables (for example, internal table ITAB):

o LINES( ITAB ) – Number of table rows

For strings (for example, string S):

o STRLEN( S ) - Current length of the string

Examples of allowed conditions

  • sy-index > 5

  • sy-index = sy-tabix

    • lines( itab ) > 0

    • lines( itab ) <> sy-tabix

    • lines( itab ) < lines( itab )

    • strlen( s ) >= sy-index

Watchpoint is reached

After you have created the watchpoint, the value of the variable will be monitored.

As soon as a change is found in the content of the variable after a Debug step and any conditions set have been met, the Debugger will stop and you see the message "Watchpoint is reached (<Watchpointvariable>).

In the "Breakpoints" tool (desktop Breakpoints/Watchpoints / Tab Watchpoints), you can view this reached watchpoint in detail.

The reached watchpoint is marked with a yellow arrow.

The old and the new values of the watchpoint variable are at your disposal.

In addition, you can use the pushbutton "Compare Variables" to determine the differences between the old and the new variable.

In addition, you can maintain the watchpoint in this view – that is, change, activate, deactivate, or delete it.

Validity Area for Watchpoints

Watchpoints only apply in the current Debugger session and will be lost as soon as this session is over. Within a debugging session, watchpoints are only valid for the internal session currently being processed. If the internal session changes, all the watchpoints become invisible. They will become visible again when you reactivate the internal session. Watchoints that have been created in the new Debugger cannot be used in the classic Debugger and vice versa.