Skip to Content
author's profile photo Former Member
Former Member

to take summation for cluster table

I want to take the sum of all KWERT(condition value) values in KONV table.

But KONV is a cluster table . So aggregate function SUM(KWERT) does not work.

So how do i take the sum of all kwert values

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 23, 2007 at 09:42 AM

    Hi,

    As KONV is a cluster table you need to do like this way

    select kwert from konv

    into table i_kwert

    where knumv = l_knumv

    and kschl = 'ZMTG'.

    loop at i_kwert.

    v_kwert = v_kwert + i_kwert.

    endloop.

    Regards,

    Omkar.

    Message was edited by:

    Omkaram Yanamala

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 23, 2007 at 09:43 AM

    logic.

    loop at it into wa.

    sum_var = sum_var + wa-KWERT.

    clear: sum

    endloop.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 23, 2007 at 09:44 AM

    Hi,

    You can use COLLECT command or you can use AT END OF and SUM combination inside the loop (when looping at internal table).

    hope this helps.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 23, 2007 at 09:47 AM

    hey, i was a bit hurry actually its AT LAST not AT END OF

    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.