SAP ABAP While 循环
只要给定条件为 true,WHILE 循环语句就会重复执行目标语句。
WHILE 命令的一般格式如下:
WHILE <logical expression><statement block>.ENDWHILE.
语句块可以是单个语句或语句块。
WHILE 循环执行 WHILE 和 ENDWHILE 命令所包含的语句,直到逻辑表达式变为 false。
流程图

考虑到程序的性能,最好使用 WHILE 命令。循环将继续,直到发现逻辑语句判断为 false,如果发现错误语句,则退出循环,并执行 WHILE 循环外的第一条语句。
实例
REPORT YS_SEP_15.DATA: a type i.a = 0.WHILE a <> 8.Write: / 'This is the line:', a.a = a + 1.ENDWHILE.
结果如下:
This is the line: 0This is the line: 1This is the line: 2This is the line: 3This is the line: 4This is the line: 5This is the line: 6This is the line: 7