Skip to Content
Author's profile photo Olga Dolinskaja

News in ABAP Debugger Breakpoints and Watchpoints , Statement Debugging

SAP NetWeaver 7.0 EHP2 brings an expanded set of breakpoint and watchpoint capabilities as well as a new higher-resolution statement debugging capability (of course in the New ABAP Debugger!).

This blog shows how to use these new features:

  • The new types of breakpoint (on ABAP command, on Web Dynpro entities, on method of a class, on Simple Transformations…)
  • The new types of watchpoints (on internal table, on ABAP objects and object attributes…)
  • The new conditional breakpoints and watchpoints

This blog also explains the new statement debugging in ABAP – how you can separately debug multiple ABAP statements or expressions in one line.

If you are interested in a live demonstration of the new features in ABAP breakpoints and watchpoints, just take a look at this short video:

 

 

 

1.  New Breakpoint Types

If you are in the New ABAP Debugger and press the Breakpoint button,  you will find a whole series of new tabs in the breakpoint popup. Each of these tabs introduces a special new breakpoint type, which you can choose accordingly to your special needs, when setting a breakpoint in your code. Let’s take a closer look at some of them.

 

ABAP Command Breakpoints

With the ABAP Cmnds tab, you can set a breakpoint on any of a variety of ABAP statements, shown to you in the F4 Help. The possibilities include setting a breakpoint at CALL FUNCTION, CALL FUNCTION DESTINATION, CALL FUNCTION IN REMOTE TASK, CALL FUNCTION IN UPDATE TASK, …. Many people didn’t know that there are also different DELETE variants: DELETE ITAB (delete from an internal table) is different from DELETE DBTAB (delete from a database table).

 

 

Method Breakpoints

With the Method tab, you can set a breakpoint at the invocation of a method of a class.

 

 

Simple Transformation and Web Dynpro Breakpoints

On the ST Template tab, you can set a row breakpoint at the call to a Simple Transformation template.

With the Web Dynpro tab you can set a breakpoint on Web Dynpro entities. When entering components, controllers and methods, the name of the generated class is determined and the breakpoint is set there. You can also tell the debugger to stop at each ABAP stack and screen change (Misc tab) or set a breakpoint on a message (Message tab).

 

 

 

2.  Conditional Breakpoints

Imagine you need to debug an ABAP application in which an internal table is gradually filled  with a large number of data records. Somewhere during the execution an error takes place and an incorrect data record gets inserted into the table. To analyze this behavior you can tell the debugger to stop as soon as this incorrect data record gets inserted into the table. You can do this by setting a breakpoint and adding a condition to it.

To add a condition to a breakpoint, click on your breakpoint with a right mouse button and choose Create Condition from the context menu. An additional popup is displayed, in which you can enter the test condition. You can use variables in the condition, as well as debugger symbols and functions. Use the F1 Help on the Breakpoint Condition popup to see the possible condition operands and syntax.

 

 

3.  New Features in Watchpoints

Now it is possible to set a watchpoint for an internal table (this wasn’t possible in the classic debugger).  Just press Watchpoint button and enter the internal table name in the Create Watchpoint popup. The debugger stops when the internal table is changed. You can further refine the watchpoint by specifying a condition (for example stop only if internal table contains more then 200 rows). Enter a condition in the Free Condition Entry field.  Use the F1 help to learn which functions you can use in your conditions. The debugger will stop only if the internal table has changed and your specified condition is fulfilled.

In addition, the Break./Watchpoints tab shows which watchpoint has a hit, and you can for example view and compare a variables in its current (after stopping at a watchpoint) and previous state.

 

 

A further new feature is the ability to set watchpoints on objects. Just enter the object name in the Create Watchpoint popup. In this way you can monitor the object during execution of your program.  The debugger will stop as soon as the object changes. You can also set a watchpoint at object attribute (choose Watchpoint at Object Attribute  radio button)  and select any desired types of instance and static attributes.  The debugger then stops if an attribute has changed. Afterwards you can take a look at this attribute change on the Break./Watchpoints tab  by selecting your watchpoint there and clicking on its details magnifier (in our example the ‘Expander’ attribute has changed from ‘X’ to a ‘space’).

 

 

4.  Statement Debugging

Now imagine you are stepping through your code in the  debugger and execute a long IF… statement, consisting of many different subcondtions. You expect a positive result, but unfortunately the IF… statement delivers you the negative answer. To analyze this behavior you need to understand which subcondition of this long IF…statement failed.

You can  easily evaluate the conditions in the IF by changing the step size in the debugger. By pressing the Step Size button you activate the statement debugging, and the debugger will execute the subconditions of for example your long IF… statement separately one after another. You can then analyze return values of single subconditions on the Auto tab of the variable fast display window. By pressing the Step Size button again you return to a normal line stepping in the debugger.

 

Assigned Tags

      36 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Wilbert Sison
      Wilbert Sison
      This is cool! I quite like the conditional breakpointing capability.  In our version, I noticed that the debugger is capable of Dynpro break-points which I found rather nasty in earlier versions. Not sure that improvement was earlier than EHP2 but it's nice to know SAP's putting an investment on good old developer tools.
      Author's profile photo Martin Maruskin
      Martin Maruskin
      HI Olga,

      thanks for keeping us up to the with the newest development in new debugger area. Do be honest I do not think that new debugger even on releases like 7.0 is matured enough. E.g. I encountering a bug while trying to search for values in internal table. Simply search doesn't work 🙂
      Anyway I try to find a way I would I report this to SAP officially.

      Rgds, Martin

      Author's profile photo Sandra Rossi
      Sandra Rossi
      Hi Olga, hi everyone,

      I see that we have finally the list of possible ABAP commands, could someone be gentle enough to paste the list from EHP2 so that we can use them in older releases (I just discovered thanks to Olga that on my 7.0 system, "INSERT ITAB" allows to stop at each insert on itab, and "INSERT DBTAB" is for database, there are "MODIFY DBTAB", "DELETE ITAB", etc. nice! but not "DELETE DBTAB" by the way...)

      Thank you community for your help! 🙂
      Sandra

      Author's profile photo Sandra Rossi
      Sandra Rossi
      Author's profile photo Rajesh Paruchuru
      Rajesh Paruchuru
      It would be nice if the new debugger supports
      the feature of linking the watch points with 'AND' condition...(classical debugger has this capability)is this already supported? and I thought the watch point on an internal table was already introduced in previous releases.

      -Rajesh.

      Author's profile photo Olga Dolinskaja
      Olga Dolinskaja
      Blog Post Author
      Hi Rajesh,
      you can define free conditions for watchpoints in the "Free Condition Entry" field (see the blog part about watchpoints for a picture).

      Best regards,
      Olga.

      Author's profile photo Former Member
      Former Member
      Actually, earlier debugger of SAP was having some limitations but in this new ABAP debugger many of them removed and it's really nice while using it. Only one limitation I realised while using it as after opening some sessions of same client, it will go to classic debugger mode automatically and will not allow you to switch to new debugger mode until you close some unnecessary sessions. Eventhough, it's really nice.
      Author's profile photo Olga Dolinskaja
      Olga Dolinskaja
      Blog Post Author
      Hi Ravin,
      yes, the standard limitations for the maximum number of open sessions per user (6 sessions) are still valid. The new debugger requires always its own session.

      Best regards,
      Olga.

      Author's profile photo Sandra Rossi
      Sandra Rossi
      6 was the limit before 7.0, but 16 is now possible provided that you change the default limit of 6 in profile parameter rdisp/max_alt_modes

      BTW, I'll ask in the forum if someone can paste the possible names for "breakpoint at".
      Sandra

      Author's profile photo Naveen Inuganti
      Naveen Inuganti
      I am first in queue, waiting for message search with message number. Great features. Thanks SAP.
      Author's profile photo Aditya Niyogi
      Aditya Niyogi
      These are some nice features, however I am still unclear weather the breakpoint for screen debugging has been introduced or not.

      I still see the same message while trying to debug screens.

      Thanks,
      Aditya

      Author's profile photo Olga Dolinskaja
      Olga Dolinskaja
      Blog Post Author
      Hi Aditya,
      yes, you can set a breakpoint for screen debugging on the "Srce Code" tab in the "Screen" section (enter screen number, line).

      Regards,
      Olga.

      Author's profile photo Madhu Vadlamani
      Madhu Vadlamani
      it is good one to see features in new debug.We are having EHP4. But i did find the features what you show.Is there components need to be installed.

      Regards,
      Madhu.

      Author's profile photo Olga Dolinskaja
      Olga Dolinskaja
      Blog Post Author
      Hi Madhu,
      from application perspective, you need to apply EHP5 (Business Suite Innovations 2010). EHP5 is technically based on SAP NetWeaver 7.0 EhP2.

      Best Regards,
      Olga.

      Author's profile photo Madhu Vadlamani
      Madhu Vadlamani
      Hi Olga,
      Thank you. So i can not see these features in EHP4.

      Regards,
      Madhu.

      Author's profile photo Former Member
      Former Member
      These are really nice features introduces to make our life easier.
      I am also waiting for "Debug as you code" functionality...Any updates when this will be introduced?

      Thanks,

      Regards,
      Mohaiyuddin

      Author's profile photo Olga Dolinskaja
      Olga Dolinskaja
      Blog Post Author
      Hi Mohaiyuddin,
      do you mean the capability to change your source code on the fly in the editor while you are debugging and and let debugger automatically debug the changed code? If it is so, then this capability is not planned.

      Best Regards,
      Olga.

      Author's profile photo Former Member
      Former Member
      Yes Olga.

      I am talking about same functionality..I was hearing from some time that this would be available in future.

      Thanks,

      Regards,
      Mohaiyuddin

      Author's profile photo Former Member
      Former Member
      It is nice to see the new feature. I have been waiting for one option where we can upload data into internal table during debugging. Currently we can save internal table record to local file. Any idea of implementing this feature...

      Cheers,
      Yellappa.

      Author's profile photo Olga Dolinskaja
      Olga Dolinskaja
      Blog Post Author
      Hi Yellappa,

      you can upload data into internal tables in the debugger with NetWeaver 7.0 EHP2. It is available for all customers.

      You may want to check the NetWeaver 7.0 EHP2 Trial Version, which is available on the SDN ABAP page for free download:

      http://www.sdn.sap.com/irj/sdn/abap?rid=/library/uuid/80db43c2-9ee5-2d10-de8e-8547de363868

      Best regards,
      Olga.

      Author's profile photo Jim Wells
      Jim Wells
      I really believe SAP has answered every one of my debugger dreams, and the explanation is clear and concise. A fantastic job by both the people making the debugger and the documentor!
      Author's profile photo Former Member
      Former Member
      Very informative. Debugging is becoming very easy day by day.
      Author's profile photo Former Member
      Former Member
      Hi Olga,

      thanks for this interesting news which i really would like to use. We use a SAP Netweaver 7.02 EhP4 but i can't see all the TABs you describe. Do i have to activate them or do you know the reason why i can't see them?

      Thanks for any help
      Günter

      Author's profile photo Olga Dolinskaja
      Olga Dolinskaja
      Blog Post Author
      Hi Günter,
      you need to apply Business Suite Innovations 2010 EHP5. If you use Business Suite EHP4 you will not be able to see these fetaures. Only EHP5 is based on NetWeaver 7.0 EhP2.

      Best Regards,
      Olga.

      Author's profile photo Ray Mannion
      Ray Mannion
      Thank you for the excellent article!
      Is there a way currently to set a watchpoint when the value in a single field within an internal table is changed?

      Frequently, I'll be debugging a sales order and want to know when XVBAP[6]-NETWR is changed, but the debugger doesn't permit this?

      It let's me watchpoint the entire internal table XVBAP[] but not a specific value?

      Author's profile photo Olga Dolinskaja
      Olga Dolinskaja
      Blog Post Author
      Hi Ray,

      yes, you can set a watchpoint only on the entire internal table.

      Best regards,
      Olga.

      Author's profile photo Former Member
      Former Member

      Hi,

      This is a very useful post. Thanks for it.

      It seems that there were some major improvements in the debugging area.

      I think that there is one useful feature that is still missing: It would have been nice to be able to create watchpoints for internal tables with a free condition for the last added record: Many times we need to track after addition of specific record (according specific criteria). As described in your video demonstration, currently this can be done, but it is little more complicated as you first need to analyze the whole internal table, afterwards use the lines() option in the free condition and then restart the program.

      Please consider it in future releases.

      Best regards,

      Shai

      Author's profile photo Sapeksh Gupta
      Sapeksh Gupta

      Hi Olga,

      Excellent article.

      However, I want to know if its somehow possible to put a watchpoint on STATICS variables. In one of my codes, I am noticing that the value of a static variable (in an FM which is called inside a loop ) is getting changed to an unpredicted value for a particular record. For rest of the records, its working fine.

      I tried putting a WP on it but its not stopping anywhere and the value is still getting changed.

      Could you please suggest me anything in this regard ?

      Thanks & Regards,

      Sapeksh

      Author's profile photo sumit sharma
      sumit sharma

      Hello Olga,

      Thanks for explaining in such a  beautiful way. I tried the Step-size thing which you have shared,but didn't work out. Can you please provide more simpler ways of understanding of step-size with an example.

       

      Thanks

      Sumit

      Author's profile photo Olga Dolinskaja
      Olga Dolinskaja
      Blog Post Author

      Hi Sumit,

      this ABAP debugger feature is very simple. Just write an ABAP program with a simple IF statement of your choice with some sub-conditions. Start the debugger, press the  "Step size" button and step through your program with the debugger single step (F5). Each sub-condition will be executed separately. Without pressing the "Step size" button the whole IF will be executed at one step.

      Regards,

      Olga.

      Author's profile photo sumit sharma
      sumit sharma

      Hi Olga,

      As suggested by you I have written a piece of code

      DATA : A type i VALUE '1',
      B type i VALUE '2',
      C type i VALUE '3',
      D type i VALUE '9'.

       

      IF ( D GT 5 OR A LT 4 ) AND ( C LE 3 OR B GT 2 ).

      write:/03 'Successful'.

      ENDIF.

      Whenever at Debugger mode i am pressing the "Step-Size"  and then F5 then I am not able to see the results in Auto Tab. I don't know whether I am doing wrong or in the code. Please help!!!

      Thanks & Regards

      Sumit

       

       

      Author's profile photo Olga Dolinskaja
      Olga Dolinskaja
      Blog Post Author

      Hi Sumit,

      with this program you should be able to execute each subcondition separately in the debugger and see that statement debugging works. You see nothing in the Auto tab, because it displays only the last return values of methods. If you use methods in subconditions (as in my example above) you will see every return value in the Auto tab.

      Regards,

      Olga.

      Author's profile photo sumit sharma
      sumit sharma

      Hello Olga,

      Thanks you for the advise. As suggested by you it was working fine. But  one more thing i observed is even without pressing the Step-size ,values of the methods are appearing in Auto Tab and with pressing the Step-size it appears.If it is so then what does Step-size button does.

      Correct me if i am wrong.

       

      Thanks & Regards

      sumit

      Author's profile photo Olga Dolinskaja
      Olga Dolinskaja
      Blog Post Author

      Hi Sumit,

      Step-size button and Auto tab are two different things. Step-size is for statement debugging and Auto tab for displaying return values of methods. If you have methods as sub-conditions within statement debugging, then you can see their return values on the Auto tab.

      Regards,

      Olga.

      Author's profile photo sumit sharma
      sumit sharma

      Hello Olga,

      Thanks for the reply. I got the Step-size and Auto tab clearly. Can we use Step-size in other scenarios without using methods, So that we can get the clear understanding of Step-size.

       

      Thanks & Regards

      Sumit

       

      Author's profile photo Olga Dolinskaja
      Olga Dolinskaja
      Blog Post Author

      Hi Sumit,

      please read again the chapter 4 “statement debugging” carefully. Step-size button activates statement debugging. It has nothing do with methods. You can use methods in subconditions or not: it is up to you.

      Regards,

      Olga.