SAP ABAP Syntax for DO part three

This in continuation with syntax for data part two.

Variant 2

DO n TIMES.

Addition


... VARYING f FROM f1 NEXT f2 (similar to variant 1)

Effect

Repeats the processing enclosed by the DO and ENDDO statements n times. If n changes within the loop, this has no effect on loop passes.

Example


DATA COUNT TYPE I.
DO 10 TIMES.
ADD SY-INDEX TO COUNT.
ENDDO.

The field COUNT now contains 55 (1+2+...+10).

Performance
 
The run time required to pass once through an empty DO loop is about 11 msn (standardized microseconds). For 100 loop passes, about 230 msn would be needed.
If possible, use a
WHILE loop instead of a DO / EXIT construction because this improves the performance slightly and is clearer.

No comments :

Post a Comment