Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Debugging FOR iterations - SAP ABAP 7.4

ishwarya_doss
Participant
4,869

Hi All,

I'm trying to debug FOR iterations. I saw a blog where STEP SIZE in debugger mode is used for that. But i couldn't exactly see the results of every iterations using that.

Could you pls guide on how to debug the iterations? TIA

1 ACCEPTED SOLUTION
Read only

michael_piesche
Active Contributor
0 Likes
3,510

I think there is a misunderstanding. You are wanting to dig deeper into the system/kernel operations of an ABAP statement, whereas the STEP SIZE is actually used to skip the current breakpoint n times whereas n is defined by the number you set in STEP SIZE for the breakpoint.

Can you share the blog you are referring too?

The only thing I notice when debugging for example the following statement, is that it 'stops' twice, and if you set the STEP SIZE to 2, it will only stop once. Why it stops twice I am not sure yet, because I actually cant see a real added value, because the created table is already filled with the first step and only the first variable is initialized in the second step (see Demo-Report DEMO_TABLE_COMPRH_JOIN):

DATA(itab4) = VALUE itab3(
      FOR wa1 IN itab1 INDEX INTO idx
      FOR wa2 IN itab2 WHERE ( key = wa1-key )
        ( key   = wa1-key
          col11 = wa1-col1
          col12 = wa1-col2
          col21 = wa2-col1
          col22 = wa2-col2 ) ).<br>

So maybe for much larger, much complexer FOR iterations and possibly combined with FOR GROUP or UNTIL/DO WHILE or LET or NEXT or COND, WHEN, THEN, ELSE, this might actually be useful and stop more than once (havnt seen an example yet), and yes, in that case, setting a STEP SIZE could then help you to debug quicker through the statement.

Hi All,

I'm trying to debug FOR iterations. I saw a blog where STEP SIZE in debugger mode is used for that. But i couldn't exactly see the results of every iterations using that.

Could you pls guide on how to debug the iterations? TIA

6 REPLIES 6
Read only

michael_piesche
Active Contributor
0 Likes
3,511

I think there is a misunderstanding. You are wanting to dig deeper into the system/kernel operations of an ABAP statement, whereas the STEP SIZE is actually used to skip the current breakpoint n times whereas n is defined by the number you set in STEP SIZE for the breakpoint.

Can you share the blog you are referring too?

The only thing I notice when debugging for example the following statement, is that it 'stops' twice, and if you set the STEP SIZE to 2, it will only stop once. Why it stops twice I am not sure yet, because I actually cant see a real added value, because the created table is already filled with the first step and only the first variable is initialized in the second step (see Demo-Report DEMO_TABLE_COMPRH_JOIN):

DATA(itab4) = VALUE itab3(
      FOR wa1 IN itab1 INDEX INTO idx
      FOR wa2 IN itab2 WHERE ( key = wa1-key )
        ( key   = wa1-key
          col11 = wa1-col1
          col12 = wa1-col2
          col21 = wa2-col1
          col22 = wa2-col2 ) ).<br>

So maybe for much larger, much complexer FOR iterations and possibly combined with FOR GROUP or UNTIL/DO WHILE or LET or NEXT or COND, WHEN, THEN, ELSE, this might actually be useful and stop more than once (havnt seen an example yet), and yes, in that case, setting a STEP SIZE could then help you to debug quicker through the statement.

Read only

Sandra_Rossi
Active Contributor
3,510

STEP SIZE works very well with the below code, I see the values of <c>, <p>, <f> at every iteration (provided that you filled tables with SAPBC_DATA_GENERATOR). I don't understand your issue.

TYPES sflview_tab TYPE STANDARD TABLE OF sflview WITH EMPTY KEY.
select * from scarr into table @DATA(scarr).
select * from spfli into table @DATA(spfli).
select * from sflight into table @DATA(sflight).
DATA(itab) = VALUE sflview_tab(
                FOR <c> IN scarr
                FOR <p> IN spfli WHERE ( carrid = <c>-carrid )
                FOR <f> IN sflight WHERE ( carrid = <p>-carrid AND connid = <p>-connid )
                ( fldate  = <f>-fldate
                  deptime = <p>-deptime
                  carrid  = <c>-carrid ) ).
Read only

ishwarya_doss
Participant
0 Likes
3,510

Thanks for your response. But I'm still confused about when to use STEP SIZE. And sorry, I have no clues about SAPBC_DATA_GENERATOR.

As usual i had filled the table in for iteration and trying to populate itab with some conditions.For Example, if scarr has 10 records and spfli has 2 record matching the condition and sflight with 1 record, how should i use STEP SIZE and what should be expected from using it?

Read only

Sandra_Rossi
Active Contributor
3,510

In the debugger, click the button "Step size" to get from mode "normal step size" to "little step size", then click F5 to debug step by step. Click again "Step size" to get back to mode "normal step size".

Read only

michael_piesche
Active Contributor
0 Likes
3,510

anabaperlife, please follow up on your open question.

  • comment answers or your question if there are still open issues.
  • otherwise mark an answer as accepted if it helped you solve your problem
  • or post an answer of yourself and accept it if you found another useful solution yourself
  • or redirect your question to another question that is related and was useful to solve your problem
  • in the end, close your question
Read only

ishwarya_doss
Participant
3,510

Thanks, Sandra. It worked!