
REPORT zreduce1.
DATA: lt_status TYPE TABLE OF crm_jsto.
SELECT * INTO TABLE lt_status FROM crm_jsto.
DATA(lo_tool) = NEW zcl_status_calc_tool( ).
lo_tool = REDUCE #( INIT o = lo_tool
local_item = VALUE zcl_status_calc_tool=>ty_status_result( )
FOR GROUPS <group_key> OF <wa> IN lt_status
GROUP BY ( obtyp = <wa>-obtyp stsma = <wa>-stsma )
ASCENDING NEXT local_item = VALUE #( obtyp = <group_key>-obtyp
stsma = <group_key>-stsma
count = REDUCE i( INIT sum = 0 FOR m IN GROUP <group_key>
NEXT sum = sum + 1 ) )
o = o->add_result( local_item ) ).
DATA(ls_result) = lo_tool->get_result( ).
report z.
DATA: lt_status TYPE zcl_status_calc_tool=>tt_raw_input.
SELECT * INTO TABLE lt_status FROM crm_jsto.
DATA(lo_tool) = NEW zcl_status_calc_tool( ).
zcl_abap_benchmark_tool=>start_timer( ).
DATA(lt_result1) = lo_tool->get_result_traditional_way( lt_status ).
zcl_abap_benchmark_tool=>stop_timer( ).
zcl_abap_benchmark_tool=>start_timer( ).
lo_tool = REDUCE #( INIT o = lo_tool
local_item = VALUE zcl_status_calc_tool=>ty_status_result( )
FOR GROUPS <group_key> OF <wa> IN lt_status
GROUP BY ( obtyp = <wa>-obtyp stsma = <wa>-stsma )
ASCENDING NEXT local_item = VALUE #( obtyp = <group_key>-obtyp
stsma = <group_key>-stsma
count = REDUCE i( INIT sum = 0 FOR m IN GROUP <group_key>
NEXT sum = sum + 1 ) )
o = o->add_result( local_item ) ).
DATA(lt_result2) = lo_tool->get_result( ).
zcl_abap_benchmark_tool=>stop_timer( ).
ASSERT lt_result1 = lt_result2.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
8 | |
6 | |
5 | |
5 | |
4 | |
4 | |
3 | |
2 | |
2 |