Code: Alles auswählen.
TYPES: BEGIN OF line_type,
date TYPE d,
key(100),
numeric_field TYPE i,
END OF line_type.
DATA: result TYPE HASHED TABLE OF line_type
WITH UNIQUE KEY date key,
input TYPE TABLE OF line_type.
LOOP AT input REFERENCE INTO DATA(line).
COLLECT line->* INTO result.
ENDLOOP.
Code: Alles auswählen.
value_tab = VALUE #(
( date = sy-datum key_struc-id = 1 key_struc-key_val = 2765 val = 250 )
( date = sy-datum key_struc-id = 1 key_struc-key_val = 2765 val = 300 )
( date = sy-datum key_struc-id = 1 key_struc-key_val = 2765 val = 100 )
( date = sy-datum key_struc-id = 1 key_struc-key_val = 2722 val = 100 )
( date = sy-datum key_struc-id = 2 key_struc-key_val = 2722 val = 400 )
( date = sy-datum + 1 key_struc-id = 2 key_struc-key_val = 2722 val = 300 )
).
LOOP AT value_tab INTO DATA(values)
GROUP BY ( date = values-date id = values-key_struc-id key_val = values-key_struc-key_val )
ASCENDING
ASSIGNING FIELD-SYMBOL(<group_key>).
changed_tab = VALUE tab_ext( BASE changed_tab
( date = <group_key>-date
key_struc-id = <group_key>-id
key_struc-key_val = <group_key>-key_val
val = REDUCE #( INIT sum_val = 0
FOR line IN GROUP <group_key>
NEXT sum_val = sum_val + line-val ) ) ).
ENDLOOP.