In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces to you what are the three ways to achieve ABAP conditional breakpoints, the content is very detailed, interested friends can refer to, hope to be helpful to you.
On the topic of ABAP conditional breakpoints, my colleagues at Jerry once asked me that it was small but practical.
A conditional breakpoint is a breakpoint set on a line statement that is not always triggered, but only when certain conditions are met.
What is the use of conditional breakpoints?
To take a simple example, the ADD statement in line 15 below sets a breakpoint. Because it is inside an inner table loop with 1000 rows, it is normally triggered 1000 times.
Suppose we are debugging a bug, and the bug does not appear until the 999th loop, then our first 998 single-step debugging is invalid. The most efficient approach is to use the concept of conditional breakpoints to trigger and trigger only once when the code executes to the 999th loop.
The editor introduces three ways to implement ABAP conditional breakpoints.
Method one gives the ABAP breakpoint maintenance trigger condition
Click the Break/Watchpoints panel in the ABAP debugger to create a new breakpoint:
Maintain the trigger condition for this breakpoint in Free Condition Entry.
Going back to my example above, my inner table contains integers from 1 to 1000, a total of 1000 records, and my trigger condition is maintained as = 22. Obviously, this breakpoint is triggered only once in the 22nd loop.
After maintenance, we see this new breakpoint in the breakpoints panel:
Press F8 to continue debugging, the breakpoint is triggered only once, and the value at this time is 22, which coincides with the trigger condition maintained by us, and is successful.
Method 2 uses the observation point in the ABAP debugger (Watchpoint)
ABAP debugger is used in a variety of ways.
Create a Watchpoint here:
We know that in the body of the LOOP loop, the system variable sy-tabix is automatically assigned the current number of cycles. Therefore, in the trigger condition of Watchpoint, we maintain it as sy-tabix = 22, which can also be triggered in the 22nd loop.
After the Watchpoint is created, it is displayed as follows:
Press F8 to continue debugging, and sure enough, the program triggers on the 22nd loop:
And a message pops up in the debugger: Watchpoint reached
Method 3 ABAP Debugger Script
The technology of ABAP Debugger Script is widely used in SAP research institute.
Returning to the above example, we will write a simple piece of ABAP code to control the breakpoint trigger of the target ABAP code.
In the ABAP debugger, click the Script tab to create a new ABAP script:
We want to use the ABAP script to monitor the change in the value of a simple variable in the ABAP code, so use Variable Value (for Simple Variables) in the script creation wizard:
The wizard will automatically generate the ABAP script for us, which is actually a piece of ABAP code that can programmatically get the value of an ABAP variable in the context of the debugger activation.
The semantics of the following script is clear. Get the value of field symbol in the debugger and store it in the temporary variable lv_result. If the value of this variable is 22, the utility method break of the ABAP script is called to trigger the breakpoint.
Save this script through the Save As button in the image above and name it ZJERRY_TEST.
Then re-execute our test code and use Load Script to load the ABAP script you just saved:
Click Start Script to execute the script:
The breakpoint is triggered again as scheduled.
What are the three ways to achieve ABAP conditional breakpoints are shared here, I hope the above content can be of some help to you, you can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.