Skip to Content
author's profile photo Former Member
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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.