Technical Articles
What does DO/ENDDO do?
Dear community, for the little fun in between here’s some ABAP to check:
DATA lv_count TYPE i VALUE 1.
DO lv_count TIMES.
lv_count = lv_count + 1.
WRITE / 'What am I doing?'.
ENDDO.
Simple question is: How often the loop is executed?
Possible answers:
- Once only.
- Over and over and over (never stops).
If you want to try it out quickly, you should use the transpiler by Lars Hvam. The right answer to the question above is available at help.sap.com.
Best regards, thanks for reading and stay healty
Michael
P. S.: Not tired of reading blogs? Check this one about ADT element info. Really great!
this is also interesting, how many times is the bar() method executed?
Would make it even more interesting.
yeap 😉
Looks interesting, I wish I could get this, but what is bar( ) method?
It could be any method, that doesn't really matter, the interesting part is how many times it will be executed... 🙂
Hmm. I didn't expect that result!
https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abapdo.htm
So loop once only.