Former Member

# How to calculate the values

Hi Experts,

I have doubt, i have an internal table now i want to calculate the total for every group. How to do that?

value type

-

5,439.01 ; ZMP0

509.60 ; ZMP0

4,749.26 ; ZMP0

9,053.95- ZPNL

732.70- ZPNL

66.30- ZPNL

18.10- ZS03

63.90 ; ZS03

According to the type i need a total for ZMPO, ZPNL, ZSO3 separately.

how to do that?

5,439.01 ; ZMP0

509.60 ; ZMP0

4,749.26 ; ZMP0

ZMPO total =

9,053.95- ZPNL

732.70- ZPNL

66.30- ZPNL

ZPNL total =

18.10- ZS03

63.90 ; ZS03

ZSO3 total =

Like that i need, can any one help this?

Regards,

Mohana

10|10000 characters needed characters exceeded

### Related questions

Former Member
Posted on May 27, 2008 at 02:13 PM

Hello,

Use the COLLECT.

```DATA:
wa LIKE LINE OF itab,
itab_sum LIKE itab.

SORT itab BY key.

LOOP AT itab INTO wa.
COLLECT wa INTO itab_sum.
ENDLOOP.
```

The itab_sum has the same structure like the itab where is the data to me summarized, and the wa has the line structure of the itab.

Regards.

10|10000 characters needed characters exceeded
• Former Member
Posted on May 27, 2008 at 02:16 PM

use the command COLLECT

declare a interna table aux. with same estructure of the other

sort the table by the field with text

data: i_t_aux like i_t occurs 0 with header line.

loop at i_t.

colllect i_t into i_t_aux.

endloop.