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

collect and sum

tell me plzz diff between collect and sum ?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Mar 03, 2007 at 07:16 PM

    see SUM command works under the control operation like at end of ,at new at last.

    collect is grouping up data based on certain key fields of internal table .

    assume ur data .

    itab

    order number item number qty value

    1000 10 10 100

    1000 20 5 200

    2000 10 7 300

    2000 20 8 150

    1000 50 9 200

    Now if you want a table with just sum based on order number ,you hav two ways

    1 .Sum .

    sort itab by order item number .

    loop at itab .

    at end of order number .

    sum .

    move into another table or display.

    endat.

    endloop.

    2 .Collect

    you declare another table with ordernumber qty value.

    loop at itab.

    move-corresponding itab to another table.

    collect another table .

    endloop.

    I hope the difference is clear .

    Please reward if useful.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 03, 2007 at 07:20 PM

    collect will sum the values based on STANDARD key and place in the same field.

    example.

    sales order number worth

    23456 1000

    23456 3000

    with collect key word. record will form like this

    23456 4000.

    sum key word will sum all the numeric values and places in the same table-field.

    regards

    Message was edited by:

    santhosh reddy

    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.