2023 Jun 16 10:35 AM
So, I'm using reduce to get the number of record that satisfy a condition inside a loop.
Will it perform better if the table is declared as sorted using a logic similar to that of parallel cursor or does it actually just check linearly?
The code is as follow.
DATA(sum) = REDUCE i( INIT x = 0 FOR wa IN lt_iloa WHERE ( tplnr = ls_ifl_list-tplnr ) NEXT x = x + 1 ).
2023 Jun 16 1:33 PM
Hi Matteo,
Yes, it will take the advantage of access by key on tplnr and will not run entire internal table. So the difference of execution can be huge and with a constant result time benefit from indexed access.
Regards, Fernando Da Rós
2023 Jun 16 1:33 PM
Hi Matteo,
Yes, it will take the advantage of access by key on tplnr and will not run entire internal table. So the difference of execution can be huge and with a constant result time benefit from indexed access.
Regards, Fernando Da Rós
2023 Jun 16 2:19 PM
2023 Jun 16 2:51 PM
matteo_pascon as documented in ABAP documentation FOR, cond > "As with LOOP AT itab, the following is possible for each expression FOR ... IN itab" > LOOP AT itab, cond :
2023 Jun 16 4:38 PM