You are on page 1of 3

Let’S Have A Practical Example Of The Use Of

Debugger Scripting Tool.


Normally watch-points are used to stop the execution of a program
whenever the value of some variable changes or is different from the set
value.

Suppose there is a scenario where an internal table should have 100


records, however because of some bug in code, some records get deleted.
According to the traditional approach you would normally have to put a
watch-point over the table and execute the code loop each time until you
manually find where the record gets deleted. However using this Debugger
script tool you can customize your watch-point, to stop only where a record
is removed from the internal table. Let’s see how.

Consider the following code for populating the internal table and displaying
the number of records it holds.

Fig 2 – Code for ITAB

However when executed it displays only 99 records as opposed to the 100


records that was expected.
Fig 3 – Output of Demo Program

To find out where the issue is, you can write a script to find the bug, instead
of executing you programs loop again & again one loop at a time.

 Execute the program in debugging mode and go to Script Tab to create a script.
 Choose a triggering mode as watch-point reached.

g 4 – Option for Triggering Script

 Now select the Edit button to add a watch-point. Choose the internal table.
(Note : A script watch-point is different from the normal debugger watch-point)

Fig 5 – Add Watch-Point in a Script

 Fetch the description of the internal table in a factory description holder.


 Extract the line count from it & compare it with the Saved_Count (holding loop
count).

Fig 6 – Script Code for Customized Watch-Point

So if both the counts are not equal, the program will stop otherwise it will
continue processing our code.
Pretty Damn Easy!
This is how a customized watch-point can be implemented through
Debugger scripting.
The debugger scripting tool is quite a new tool for most ABAP
programmers and it becomes very handy once you get the hang of it. It
requires the knowledge of Object Oriented ABAP as a prerequisite, which
in itself is something all ABAP programmers should learn. It can make the
life of an ABAP programmer that little bit easier when faced with a difficult
bug to solve, so give the tool a go. You might start to like it

 SAP ABAP

You might also like