ABAP关键字组合LOOP AT GROUP BY的用法

*&---------------------------------------------------------------------*
*& Report ZGROUPBY
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZGROUPBY.

DATA flights TYPE TABLE OF spfli WITH EMPTY KEY.

START-OF-SELECTION.

SELECT * FROM  spfli
         WHERE carrid = 'LH'
         INTO TABLE @flights.

BREAK-POINT.
DATA members LIKE flights.
LOOP AT flights INTO DATA(flight)
     GROUP BY ( carrier = flight-carrid cityfr = flight-cityfrom )
              ASCENDING
              ASSIGNING FIELD-SYMBOL().
  CLEAR members.
  LOOP AT GROUP  ASSIGNING FIELD-SYMBOL().
   " Jerry 2016-12-4 20:45PM at aircraft - this BASE is a new keyword: give the expression an initial value
    members = VALUE #( BASE members (  ) ).
  ENDLOOP.
  cl_demo_output=>write( members ).
ENDLOOP.
cl_demo_output=>display( ).

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

你可能感兴趣的:(Jerry,Wang的原创SAP技术文章,ABAP,abap)