Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SUM

Former Member
0 Likes
708

Hello Gurus,

I've 12 fields in my internal table and i want sum the 6th field with respect to 1st ,5th and 9th field.

How to sum it up.Please do advice me .

Thanks in advance.

ashok...

5 REPLIES 5
Read only

former_member188827
Active Contributor
0 Likes
689

use:

data zsum type i.

loop at itab.

itab-field6 = itab-field1 + itab-field5 + itab-field9.

modify itab index sy-tabix transporting field6.

endloop.

plz reward points if dis helps

Edited by: abapuser on Dec 18, 2007 7:20 AM

Read only

Former Member
0 Likes
689

Hi Ashok,

Is it cumpulsory to sum the 6th field wtih respect to 1st, 5th and 9th? what are the fields 1st,5th and 9th?

You can easily sum by using 1st field.

Ex there is internal table itab.

1st field is matnr. 6th field is quantity (menge)

sort itab by matnr.

loop at itab.

at end of matnr.

sum.

Write: itab-matnr, itab-menge.

endat.

endloop.

Revert back if anything .....

<b>please reward if useful </b>

Regards,

sunil kairam.

Read only

former_member402443
Contributor
0 Likes
689

Hi Ashok,

You can easily sum by using 1st field.

sort itab by 1st field 5th field 9th field.

loop at itab.

at end of 1st field.

sum.

Write: itab-Ist field, itab-6th field.

endat.

endloop.

Revert back if anything .....

please reward if useful

Regards

Manoj Kumar

Read only

Former Member
0 Likes
689

Hi,

You can do as below :


Loop at itab.

itab-field6  = itab-field1 + itab-field5 + itab-field9.

modify itab.
clear itab.

endloop.

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
689

Hi,

You can do as below :


Loop at itab.

itab-field6  = itab-field1 + itab-field5 + itab-field9.

modify itab.
clear itab.

endloop.

Thanks,

Sriram Ponna.