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 integer

Former Member
0 Likes
918

In vb.net there is this codes or something like this which I forgotten already:

-


Dim a as integer

a = 0

loop

a+1

end loop

clear a

-


Is it possible to do like this code in ABAP way? If there is, please show me the codes.

Edited by: JuzMe on Jan 24, 2008 9:25 AM

3 REPLIES 3
Read only

Former Member
0 Likes
604

Hi,

There is no LOOP ... Endloop with out condition.

There is DO...ENDDO without providing condition.

DATA: A type i.

a = 0.

DO.

a = a + 1.

If a > 10.

exit. "(exit will exit from the loop).

endif.

ENDDO.

Read only

Former Member
0 Likes
604

Hi

yes you do have such a code in ABAP also...i dont know what exactly would be ur condition but you can write something like:

DATA: count TYPE i,

limit TYPE i VALUE 10.

DO.

count = count + 1.

IF count GE limit.

EXIT.

ENDIF.

ENDDO.

cheers

shivika

Read only

Former Member
0 Likes
604

Hi JuzMe

The same code is not worked in ABAP.

There is another way by using

do.... endo, loop at ITAB.....endloop.

data: count type i.

count = 20.

do

count = count + 1.

if <condition>

exit.

endif.

enddo.

In your requirement it goes infinite loop.

We have to incorporate condition within the loop to prevent infinite looping by using EXIT statement.

Reward me if useful.