目前,我有此编码,并且可以正常工作:

      TYPES: BEGIN OF tty_ekpo,
               ebeln TYPE ebeln,
               ebelp TYPE ebelp,
             END OF tty_ekpo.
      DATA: lt_ekpo TYPE TABLE OF tty_ekpo,
            ls_ekpo LIKE LINE OF lt_ekpo.
      LOOP AT gt_lopdata ASSIGNING FIELD-SYMBOL(<fs_collect>).
        ls_ekpo-ebeln = <fs_collect>-ebeln.
        ls_ekpo-ebelp = <fs_collect>-ebelp.
        COLLECT ls_ekpo INTO lt_ekpo.
      ENDLOOP.


我想对新语法做同样的事情,可以吗?
如果是,怎么办?

最佳答案

我用这个:

lt_ekpo = VALUE #( FOR GROUPS ebelnebelp OF <ls_collect> IN gt_lopdata
                   GROUP BY ( ebeln = <ls_collect>-ebeln
                              ebelp = <ls_collect>-ebelp )
                   ASCENDING WITHOUT MEMBERS ( ebelnebelp ) ).

09-27 18:32