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

loop

Former Member
0 Likes
562

hi,

may i know if the loop can loop in sequence for only code that mentioned and will not repeat the code?

say there are 20 records and there are 5 records with the code mentioned. the code is unique.

loop at itab into wa_itab where code = 'Z123' or

code = 'Z234' or

code = 'Z765' or

code = 'Z999' or

code = 'Z421' .

v_value = v_value + wa_itab-value.

continue.

endloop.

thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
540

Hi,

Do like this

loop at itab into wa_itab

If wa_itab-code in ( 'Z123', 'Z234', 'Z765', 'Z999', 'Z421') .

v_value = v_value + wa_itab-value.

continue.

endif.

endloop.

Regards,

Satish

3 REPLIES 3
Read only

Former Member
0 Likes
541

Hi,

Do like this

loop at itab into wa_itab

If wa_itab-code in ( 'Z123', 'Z234', 'Z765', 'Z999', 'Z421') .

v_value = v_value + wa_itab-value.

continue.

endif.

endloop.

Regards,

Satish

Read only

Former Member
0 Likes
540

Hi,

Yeah, you can do it.

SORT itab by code.

loop at itab into wa_itab where code = 'Z123' or

code = 'Z234' or

code = 'Z765' or

code = 'Z999' or

code = 'Z421' .

v_value = v_value + wa_itab-value.

continue. (NO need of continue statement)

endloop

Read only

Former Member
0 Likes
540

sorry

Edited by: Abhishek Sarkar on Jan 30, 2008 9:27 AM