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

Looping and using Do Varying

Former Member
0 Likes
1,057

Hi,

I got a program which is using a Loop at IT PA0167 and building few tables based on conditions and also using Do 20 times varying statement as well couple of times. When the Program is run with complete data it takes around 20000 records in the IT PA0167 and looping for those and using Do varying is taking lot of time.

What I can think is that I can split IT PA0167 into different sets of employees and then execute, not sure how effective that will be.

Any Idea on how to resolve this ?

Thanks

Manoj

6 REPLIES 6
Read only

Former Member
0 Likes
836

Hi Manoj, Try replacing the Do varying with the actual workarea, like if you are summing up in the Do varying, try replacing with actual variable sum like WA-FLD1 + WA-FLD2...WA_FLD20 or Check if the Assign Increment variant improves the performance.


DO.
  inc = sy-index  - 1.
  ASSIGN WA_DATA-FLD1 INCREMENT inc TO <EACH_FLD> RANGE WA_DATA.
  IF sy-subrc = 0.
* ...Logic based on <EACH_FLD>    
  ELSE.
    EXIT.
  ENDIF.
ENDDO.

Read only

0 Likes
836

Hi Suman,

Tried out but nothing changed much..

thanks anyways..

Manoj

Read only

Former Member
0 Likes
836

It's unlikely that you have to DO 20 TIMES VARYING... for each record in PA0167. Most or all of the fields will be empty. You should determine when you have processed all of the fields and then EXIT or CONTINUE.

Rob

Read only

0 Likes
836

Hi Rob,

I am already using Exit in case of blank records.

Thanks

Manoj

Read only

0 Likes
836

Use EXIT in case of blank fields, not records.

Rob

Read only

0 Likes
836

I mean the same Rob.. I am using Exit for blank field only.. that was a casual statement..