ABAP provides keywords that can be used to run some codes again and again on the basis of a condition called ABAP Loop. Let see them one by one.
Do-END DO Statements
These are called unconditional loop because we don’t provide any condition for loop but provide fixed number of times for the loop to run. If you want to execute certain codes for fixed number of times, then this is the best loop to use.
WHILE-END WHILE Statements
These are called conditional loop because we provide condition for loop to run. Loop runs and execute the codes till the condition is true.
In below figure, we can see the difference between Do and While loop statements.
FOR LOOP Statements
For statements are the most used statements in any language. ABAP also provides the same Looping method. Syntax is: FOR i = … [THEN expression] UNTIL|WHILE condition
You can read more about it here
Nested means using one loop under another loop. It will be clearer with example.
Loop Control Statements
If you want to break the normal flow of an ABAP loop, then you need loop control statements. ABAP provide three loop control statements i.e. CONTINUE, CHECK, EXIT.
This statement will pass the current loop unconditionally. It needs IF statements to apply condition. As soon this statement is read by the compiler, it skips the current loop and goes to next iteration, this will be clearer with an example.
This statement will pass the current loop conditionally. If the CHECK condition is true then it executes the rest of the statements otherwise it skips the current loop and goes to next iteration, this will be clearer with an example.
This statement will end all the iterations as soon this statement is read by the compiler. It also needs IF statements to apply condition. After EXIT statement the program control goes to the statement just after the LOOP statements.