Three ways to implement conditional breakpoints in ABAP

background

Different colleagues have asked me this question: For example, the LOOP in the figure below needs to be executed 1000 times, and I am only interested in one of them, such as the 501st loop. It is definitely impossible for me to press F5 500 times and then enter the 501st debugging. Or I'm only interested in the loop where a variable in the LOOP has a specific value. How can I avoid pressing F5 repeatedly and let the breakpoint stop directly on the condition that meets my expectations?

 

There are actually three ways to do it.

Method 1 - Use the conditional breakpoint function that comes with the ABAP debugger

Suppose in the example above, I want the 15th line in the loop body to trigger a breakpoint when <data> is equal to 22.

Create a new dynamic breakpoint:

 

The condition that triggers the breakpoint is maintained here:

 

Press F8, when the value of <data> is assigned 22 in the loop body, the breakpoint is triggered:

 

Method 2 - Create a watchpoint using the following menu

 
 

This method is similar to method 1.

 
 

Method 3 - Using ABAP Debugger Script

Switch to the Script tab and create a new script:

 

Click the Script Wizard button, double-click the option Variable Value (for Simple Variable):

 

This wizard will automatically generate some script source code, which is the code in the red box in the figure below. All we need to do is manually write down lines 51 to 53 of the code. Click the button "Save As" to save this script and give it a name, eg ZJERRY_TEST.

 

Start your program again and load the script ZJERRY_TEST you just saved.

 

Then click the button below:

 

Breakpoints also stop automatically:

 

To get more original technical articles from Jerry, please follow the public account "Wang Zixi" or scan the QR code below:

 
 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326263512&siteId=291194637