New ABAP syntax instead of COLLECT

Currently, I have this coding, and it works perfectly fine:

      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_loopdata ASSIGNING FIELD-SYMBOL(<fs_collect>).
        ls_ekpo-ebeln = <fs_collect>-ebeln.
        ls_ekpo-ebelp = <fs_collect>-ebelp.
        COLLECT ls_ekpo INTO lt_ekpo.

I want to do the same with the new syntax, is it possible?
If yes, how?


  • I use this one:

    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 ) ).