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.
↧