2023 Jan 03 7:00 AM
Hi Experts,
I have below internal table.
I need to get Date wise, Category wise total duration.
Thanks
2023 Jan 03 8:11 AM
Hello pramod.pathirana
pramod.pathiranaHave a look at control level processing when working with internal tables:
Processing Table Entries in Loops
Dominik Tylczynski
2023 Jan 03 8:47 AM
It could be something close to this:
itab_with_sum = VALUE #(
FOR GROUPS <group> OF <line> IN source_itab
GROUP BY ( category = <line>-category )
( category = <group>-category
sum_duration = REDUCE #(
INIT sum = VALUE decfloat16( ) IN
FOR <line> IN GROUP <group>
NEXT sum = sum + <line>-duration ) ) ).
or if you have HANA (simpler but should be slower):
SELECT category, SUM( duration ) AS sum_duration
FROM @source_itab
GROUP BY category
INTO TABLE @DATA(itab_with_sum).
2023 Jan 03 3:09 PM