ABAP expressions are easy write and are usually shorter than earlier syntax they replace, but understanding code written using expressions is bit more difficult and takes time.

Debugging it seems lot more difficult as lot of things happen in a single statement.

In this post, you will learn about a ABAP debugging feature that helps in debugging ABAP expressions.

Consider below code which builds a table for display using the FOR iteration for tables.

targets = 
  VALUE #( FOR book IN bookings 
           ( carrid = book-carrid
             carrnm = carriers[ carrid = book-carrid ]-carrname          
             connid = booking-connid
             fldate = booking-fldate
             custom = customers[ id = booking-customid ]-name 
           ) 
         ).

There are couple of reads within the statement. While debugging this statement, it gets executed in one go.

Both F5 and F6 have the same effect i.e. the entire statement is executed at once and you get the target table populated.

We are used to conventional LOOP AT statement where debugging each iteration in a loop is possible.

LOOP AT bookings INTO booking.
...

ENDLOOP.

Good news is that SAP GUI New debugger has a feature that helps here. Bad news is that Eclipse debugger does not have this feature yet.

To check individual loop iteration you have to enable the Step Debugger.

How to enable the Step Debugger?

Click on the Step Size in the toolbar to enable / disable Step Debugger.

While enabling the Step Debugger, you will get a message ‘Debugger increment changed to subcondition/statement’.

Now, if you use F5 (Single Step) at the VALUE # statement, you can get the result of individual loop iteration. Here is an example of 3/7 table entries added after 3rd iterations.

To change this back, just press the button again.

Summary

The step size button can be checked easily to execute one iteration at a time.

Visit ABAP Debugger page to see more articles on debugging.

Read about more such ABAP expressions and exciting new syntaxes: ABAP Expressions (7.4+)


If you like the content, please subscribe…

Join 4,016 other subscribers

Discovering ABAP YouTube Channel