Application Development 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: 

Very Simple Problem related to Loop

Former Member
0 Kudos

I have one internal table containing 5 records, I wish to display these 5 records but my code repeats the first record only 5 times, then second record 5 times and so on.. how to correct it, please advice.

Regards,

Alok.

9 REPLIES 9

Former Member
0 Kudos

loop at itab.

write: itab-field1,itab-field2.

endloop.

Former Member
0 Kudos

hi,

do you have a nested loop in which you read/write your data?

grtz

Koen

Former Member
0 Kudos

hi Alok,

do this way.. probably u might not have used the clear statement at proper place ...

loop at itab.
write : itab-matnr.
clear itab.
endloop.

Regards,

Santosh

Former Member
0 Kudos

It should be simple

LOOP AT ITAB.

WRITE 😕 ITAB-FIELD1.

ENDLOOP.

Give your code here to identify the issue.

Regards,

Ravi

Note : Please mark all the helpful answers

Former Member
0 Kudos

hi do like this::

loop at itab.

write : itab-field1,

itab-field2,

itab-field3,

itab-field4

itab-field5.

endloop.

Former Member
0 Kudos

Hi Alok,

Can you please give your code you are using.

I think you are using an extra loop statement with write

statement.

Only a select statement loop is enough and give write statement inside the select statement only.

Regards,

Amit.

Please reward if helpful.

Former Member
0 Kudos

Hi Alok,

Loop at itab.

write: itab-f1, itab-f2,itab-f3.

clear itab.

endloop.

Regards,

Laxmi.

Former Member
0 Kudos

hi alok,

before selecting the data.

clear and refresh that internal table once.

then,

loop at itab.

write:/itab-field1,itab-field2.

clear itab.

endloop

Former Member
0 Kudos

hi,

TABLES SFLIGHT.

DATA BEGIN OF ITAB OCCURS 0.

INCLUDE STRUCTURE SFLIGHT.

DATA END OF ITAB.

SELECT * FROM SFLIGHT INTO TABLE ITAB.

LOOP AT ITAB.

WRITE:/ ITAB-CARRID,

ITAB-CONNID,

ITAB-FLDATE.

ENDLOOP.

try for it,

best of luck,

regards,

kcc