用ABAP代码实现从1累加到100

我是研究僧i 提交于 2020-01-19 04:49:43
itab = VALUE #( FOR j = 1 WHILE j <= 100 ( j ) ).
* Reduce 后面跟类型
* A constructor expression with the reduction operator 
* REDUCE creates a result of a data type specified using type 
* from one or more iteration expressions.
* At least one variable or one field symbol must be specified. The variables or field symbols declared after 
* INIT can only be used after NEXT. 
* At least one iteration expression must then be specified using FOR and it is also possible to specify multiple 
* consecutive iteration expressions.
DATA(sum) = REDUCE i( INIT x = 0 FOR wa IN itab NEXT x = x + wa ).
WRITE: / sum.

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!