Skip to Content

Debugging loop

Did you ever had to step into loop looking for 46-th row or looking for occurrence of some value?

Instead of painful record by record stepping trough loop, why not use breakpoints/watchpoints?

While debugging one can do this:

1. Open up Breakpoints/Watchpoints tab


2. Select breakpoint:


3. Set break point condition:


4. Continue debugging (F8):


5. This is it: debugger stops at 46-th record of the loop.


6. In case one need to stop at some specific value – at the step 3 specific condition is entered:


Small but useful debugging trick, I hope it will be helpful!



You must be Logged on to comment or reply to a post.
    • Thanks Thangam.

      Those kind of tips are probably nothing new for abap expert developers but for us functional consultants who use abap occasionally, it’s good to have this kind of information available in SCN.

  • Well, there’s an easier way out. You can simply specify the “Skip” number there in the same tab and achieve the same result.

    • Thanks for your comment Kumar,

      of course “Skip” is easier way to get to exact row in the loop but if you don’t know exact sy-tabix or you want to stop at first occurrence of some value or when condition is achieved  (last example picture: ls_item-wa_item-itemtype NE ‘0TAXITEM’) you have to define condition.
      From this point of view it’s more useful to teach people how to use conditions.

  • Hi,,,

            its veryuseful one……many times i thinking about how to debugging particular record from the loop.Now cleared..its time saving also….. ➕

    • Sy-tabix can change multiple times inside a loop due to nested loop, read statements, FM calls. Watchpoint can give false alarm.

      Conditional breakpoint is more exact because it will stop at desired line number, when some additional condition is satisfied.

      • I checked watchpoints.

        Manish is right for sy-tabix in complex conditions like nested loops, read statements etc, but I believe, same risk is possible when breakpoint has been used.

        In watchpoint one can use additional/complex conditions same as in breakpoints and from that point of view it’s identically useful.

        Correct me if I’m wrong.



        • I have been using watchpoints to achieve this. For simple loops, sy-tabix works, but for complex loops I prefer adding additional condition with value check

  • Nice topic. instead of going to watchpoints screen in debugger as shown in the screenshots, directly right click on the debugging point and pickup conditional break point and write the same! you can write the complete condition. definitely it is useful when you have many entries in the internal table.

    How it is different from watch points?

    you can have multiple conditions with various operands.

    it is just smaller version of script debugging and better than watch points. if you want to go advanced, you can explore script debugging where you can write code for debugging using wizard!