‎2016 Aug 19 7:12 AM
Hi,
any alternative to avoid LOOP in this case.
loop itab to wa.
l_amount = l_amount + wa-amount.
at end <Company_code>.
wa-amount = lv_amount.
append wa to itab_amount.
atend.
endloop.
Regards
Kumar
‎2016 Aug 20 9:54 PM
I guess you're looking for a simple statement like SQL "select company_code sum(amount) from itab group by company_code", but unfortunately the new ABAP constructs in 7.40 (LOOP AT ... GROUP BY, and FOR GROUPS ... GROUP BY ...) have almost the same complexity/number of lines than your current code, so your current code is okay from my point of view.
‎2016 Aug 20 9:54 PM
I guess you're looking for a simple statement like SQL "select company_code sum(amount) from itab group by company_code", but unfortunately the new ABAP constructs in 7.40 (LOOP AT ... GROUP BY, and FOR GROUPS ... GROUP BY ...) have almost the same complexity/number of lines than your current code, so your current code is okay from my point of view.