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

Debugger1.PNG

2. Select breakpoint:

Debugger2.png

3. Set break point condition:

Debugger3.png

4. Continue debugging (F8):

Debugger4.png

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

Debugger5.png

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

Debugger6.png

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

Regards,

Mario

To report this post you need to login first.

18 Comments

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

    1. Mario Prkacin Post author

      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.

      (0) 
  1. Kumar Akshat

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

    (0) 
    1. Mario Prkacin Post author

      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.

      (0) 
  2. Nithya M

    Hi,,,

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

    (0) 
    1. Manish Kumar

      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.

      (0) 
      1. Mario Prkacin Post author

        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.

        Br,

        Mario

        (0) 
        1. Sameena Patel

          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

          (0) 
  3. Sagar Tallapragada

    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!

    (0) 
    1. Mario Prkacin Post author

      Thanks for valuable comment. Until now, I didn’t need script debugging.

      Maybe, You should consider to prepare document on topic of script debugging? 🙂

      Br,

      Mario

      (0) 

Leave a Reply