SAP ABAP collect 函数

 

如下代码,

复制代码

typesbegin of ty_aa,
  ebeln type eket-ebeln ,  "采购凭证
*  ebelp type eket-ebelp ,  "项目
  wemng type eket-wemng "已交货数量
  end of ty_aa.

data: gt_aa type table of ty_aa with header line,
      gs_aa type ty_aa.

data: gt_collect type table of ty_aa with header line,
      gs_collect type ty_aa.

gs_aa-ebeln '0045282828'.
gs_aa-wemng '100'.
APPEND gs_aa to gt_aa.

gs_aa-ebeln '0045282828'.
gs_aa-wemng '100'.
APPEND gs_aa to gt_aa.


gs_aa-ebeln '0045282828'.
gs_aa-wemng '100'.
APPEND gs_aa to gt_aa.

SORt gt_aa by ebeln.


CLEAR gt_collect.
  loop at gt_aa into gs_aa.
    move-corresponding gs_aa to gs_collect.
    collect gs_collect into gt_collect.
    clear gs_collect.
    clear gs_aa.
  endloop.
复制代码

效果如下:

 

posted @   轻烟随风  阅读(8)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
点击右上角即可分享
微信分享提示