When processing a loop with the statement DO… ENDDO, what system variable contains the implicit loop counter?
A . sy-linno
B . sy-labix
C . sy-subrc
D . sy-index
Answer: D
Explanation:
When processing a loop with the statement DO… ENDDO, the system variable that contains the implicit loop counter is sy-index. The loop counter is a numeric value that indicates how many times the loop has been executed. The loop counter is initialized to 1 before the first execution of the loop and is incremented by 1 after each execution. The loop counter can be used to control the number of loop iterations or to access the loop elements by index. The loop counter can also be accessed or modified within the loop body, but this is not recommended as it may cause unexpected results or errors1.
For example, the following code snippet uses the loop counter sy-index to display the numbers from 1 to 10:
DO 10 TIMES. WRITE: / sy-index. ENDDO.
The output of this code is:
12345678910
Reference: 1: DO – ABAP Keyword Documentation
Latest C_ABAPD_2309 Dumps Valid Version with 80 Q&As
Latest And Valid Q&A | Instant Download | Once Fail, Full Refund