Skip to Content
-1
Feb 19, 2018 at 05:41 PM

Sum a Group of Records in an Internal Table into a Single Record

10594 Views Last edit Feb 20, 2018 at 05:42 AM 3 rev

Hi ABAPers,

I have an internal table with records as seen below:

Description----------Quantity----------Price

1. Daily-------------------1000--------------52.75

2. Daily-------------------1500-------------52.75

3. Daily-------------------1700--------------52.75

4. Saturday--------------3000-------------55.00

5. Sunday----------------4000-------------55.00

Now I need to combine the records with description 'Daily' into a single record in the internal table, with the quantity field being a sum of the 3 records.

I've tried using this:

LOOP AT lt_tab into ls_tab.

AT NEW description.
daily_total = daily_total + ls_tab-menge
ENDAT.

But it's not giving the desired results.

Any idea on how to go about this?

Thanks.