Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Alternative Loop avoid for collect

Former Member
0 Likes
606

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

1 ACCEPTED SOLUTION
Read only

Sandra_Rossi
Active Contributor
0 Likes
495

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.

1 REPLY 1
Read only

Sandra_Rossi
Active Contributor
0 Likes
496

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.