• LOOP AT GROUP语法熟悉


    SELECT  *
      FROM EKKO
      INTO TABLE @DATA(LT_EKKO)
      UP TO 100 ROWS.
    
    SORT LT_EKKO BY LIFNR ERNAM.
    
    LOOP AT LT_EKKO INTO DATA(LS_EKKO) GROUP BY LS_EKKO-LIFNR.
    "多个分组条件
    "LOOP AT LT_EKKO INTO DATA(LS_EKKO) GROUP BY ( LIFNR = LS_EKKO-LIFNR ERNAM = LS_EKKO-ERNAM ).
      LOOP AT GROUP LS_EKKO INTO DATA(MEMBER).
    
      ENDLOOP.
    
    ENDLOOP.
    

      按LIFNR分组,LS_EKKO为每一组的第一行
    LOOP AT LT_EKKO INTO DATA(LS_EKKO) GROUP BY LS_EKKO-LIFNR.
    LOOP AT GROUP访问组成员
    LOOP AT GROUP LS_EKKO INTO DATA(MEMBER).

    SELECT  *
        FROM EKKO
        INTO TABLE @DATA(LT_EKKO)
       UP TO 100 ROWS.
    
    SORT LT_EKKO BY LIFNR ERNAM.
    
    LOOP AT LT_EKKO INTO DATA(LS_EKKO) GROUP BY ( KEY1 = LS_EKKO-LIFNR KEY2 = LS_EKKO-ERNAM ) INTO DATA(KEY).
    
      LOOP AT GROUP KEY INTO DATA(MEMBER).
    
      ENDLOOP.
    
    ENDLOOP.


    按LIFNR,ERNAM分组,LS_EKKO为空

    LOOP AT LT_EKKO INTO DATA(LS_EKKO) GROUP BY ( KEY1 = LS_EKKO-LIFNR KEY2 = LS_EKKO-ERNAM ) INTO DATA(KEY).

    LOOP AT GROUP按组的分组条件访问组成员,其中KEY可以理解为工作区,包含lifnr和ername. member里面包含有KEY工作区关键字段.
    LOOP AT GROUP KEY INTO DATA(MEMBER).

    本文转载自:https://www.jianshu.com/p/f34f59ba2c17

  • 相关阅读:
    Lua环境
    WebKit
    Net线程间通信的异步机制
    Cucumber入门1 传统流程下的使用
    Windows Server 2008中安装IIS7.0
    WebCore
    百度云计算平台Python环境试用
    认识ASP.NET MVC的5种AuthorizationFilter
    浅谈java中常见的排序
    go语言中goroutine的使用
  • 原文地址:https://www.cnblogs.com/BruceKing/p/10727612.html
Copyright © 2020-2023  润新知