Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 407
András Avatar asked Jan 25 '26 03:01

András


1 Answers

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 ) ).
like image 100
József Szikszai Avatar answered Jan 27 '26 20:01

József Szikszai



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!