‎2007 Jan 21 11:11 AM
Hi,
I have an internal table with fields to be summed up. I require that the sum be grouped by field taxcode first then by field matnr. And then at the end of the report, sum everything.
Any ideas on how to do this?
Thanks in advance.
Kenny
‎2007 Jan 21 11:17 AM
‎2007 Jan 21 11:13 AM
use control break events....
like
at end of <taxcode>
sum.
endat.
at end of <matnr>
sum.
endat.
at last.
sum.
endat.
at each above stage the value will get summed.
regds,
kiran
‎2007 Jan 21 11:14 AM
Hi Kiran,
I have tried AT THE END OF, ON CHANGE, and AT NEW but I cant seem to make it work.
Please help.
Kenny
‎2007 Jan 21 11:17 AM
‎2007 Jan 21 11:19 AM
Hi Kiran,
Both matnr and taxcode are fields of an internal table. I have a loop into a workarea for sum to work.
Thanks.
Kenny
‎2007 Jan 21 11:22 AM
what i mean to say is.
the control break events depends upon the order of the fields declare in the internal table.
can u please give the fields in the order of the internal table.
regds,
kiran
‎2007 Jan 21 11:22 AM
declare the itab in such a way that the first field is tax code and next field is matnr.
then sort itab by taxcode matnr.
loop at itab.
move: itab to wa .
at end of taxcode.
SUM.
endat .
write:/ wa , itab-amount fields.
at end of matnr.
SUM
endat.
write:/ wa, itab-amount fields.
endloop.
Raja
‎2007 Jan 21 11:34 AM
Thanks to both of you.
Raja, that does the trick. Didnt realize the order of the fields.
Its working now. Thanks to both of you again.
Regards,
Kenny