Loop with Index.
LOOP AT it_mara INTO wa_mara FROM lv_index.
... <processing statements>.....
ENDLOOP.
Loop from row number lv_index.

Loop with Where condition.

LOOP AT it_mara INTO wa_mara where matnr = ‘123‘.
... <processing statements>.....
ENDLOOP.
Loop in it_mara where matnr value = 123

Loop without any index or Where condition

LOOP AT it_mara INTO wa_mara.
 ... <processing statements>.....
ENDLOOP.
sy-tabix holds the the current row number being processed .
sy-index is the loop counter.

When the loop is exited with ENDLOOP, sy-tabix is reset to the value it had before the loop was entered. sy-subrc is 0 (Implying the loop was run at least once) or 4(the loop was not run at all).




Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP MM SD Consultant