Group by example
CLASS lcl_class_name DEFINITION CREATE PRIVATE FINAL. PUBLIC SECTION. CLASS-METHODS: create RETURNING VALUE(ro_obj) TYPE REF TO lcl_class_name. METHODS: run. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS lcl_class_name IMPLEMENTATION. METHOD create. ro_obj = NEW lcl_class_name( ). ENDMETHOD. METHOD run. SELECT * FROM spfli INTO TABLE @DATA(lt_spfli). DATA members LIKE lt_spfli. LOOP AT lt_spfli INTO DATA(ls_spfli) GROUP BY ( carrier = ls_spfli-carrid city_from = ls_spfli-cityfrom ) ASCENDING ASSIGNING FIELD-SYMBOL(<lfs_group>). CLEAR members. LOOP AT GROUP <...