Tutorial by Examples

LOOP AT itab INTO wa. ENDLOOP. FIELD-SYMBOLS <fs> LIKE LINE OF itab. LOOP AT itab ASSIGNING <fs>. ENDLOOP. LOOP AT itab ASSIGNING FIELD-SYMBOL(<fs>). ENDLOOP. LOOP AT itab REFERENCE INTO dref. ENDLOOP. LOOP AT itab TRANSPORTING NO FIELDS. ENDLOOP. Conditional L...
ABAP also offers the conventional WHILE-Loop which runs until the given expression evaluates to false. The system field sy-index will be increased for every loop step. WHILE condition. * do something ENDWHILE
Without any addition the DO-Loop runs endless or at least until it gets explicitly exited from inside. The system field sy-index will be increased for every loop step. DO. * do something... get it? * call EXIT somewhere ENDDO. The TIMES addition offers a very convenient way to repeat code (a...
To break loops, the command EXIT can be used. DO. READ TABLE itab INDEX sy-index INTO DATA(wa). IF sy-subrc <> 0. EXIT. "Stop this loop if no element was found ENDIF. " some code ENDDO. To skip to the next loop step, the command CONTINUE can be u...

Page 1 of 1