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

Very Simple Problem related to Loop

Former Member
0 Likes
1,058

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.

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
Read only

Former Member
0 Likes
1,014

loop at itab.

write: itab-field1,itab-field2.

endloop.

Read only

Former Member
0 Likes
1,014

hi,

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

grtz

Koen

Read only

Former Member
0 Likes
1,014

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

Read only

Former Member
0 Likes
1,014

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

Read only

Former Member
0 Likes
1,014

hi do like this::

loop at itab.

write : itab-field1,

itab-field2,

itab-field3,

itab-field4

itab-field5.

endloop.

Read only

Former Member
0 Likes
1,014

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.

Read only

Former Member
0 Likes
1,014

Hi Alok,

Loop at itab.

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

clear itab.

endloop.

Regards,

Laxmi.

Read only

Former Member
0 Likes
1,014

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

Read only

Former Member
0 Likes
1,014

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