08-17-2007 6:10 AM
i am working on a zreport ,my problem is that in my itab if belnr is unique then it should print the amount value given against it ,but if it encounters two same belnr values then it should print the cumulative value of amount field.for e.g.
belnr amount
2500000018 205.
2500000020 800
2500000020 200
in case of belnr = 250000018 it should give 205,but in case of belnr = 2500000020 it should print 1000.
it is urgent please .points will be rewarded surely
sarabjit
08-17-2007 6:55 AM
data:
itab1 like table of itab with header line.
sort ITAB by belnr.
loop at ITAB.
itab1 = itab.
collect itab1.
endon.
endloop.
Now ITAB1 will contain the required cumulative results.
If it doesn't work then in need to see how you declared ITAB.
Reward points if useful.Get back in case of query...
Cheers!!!
08-17-2007 6:20 AM
hi,
use collect statement in loop as
loop at itab.
..............
................
..............
collect itab.
endloop.
if there are same fields with numeric values then asingle record grouping of all numeric values will be done by collect statement.
if helpful reward some points.
with regards,
Suresh Babu.
08-17-2007 6:27 AM
first declare an internal table sumilar to ur interval table.
loop on itab1.
move-corresponding itab1 to itab2.
collect itab2.
endloop.
OR
sort itab.
at new belnr.
sum.
......
reward if helpful
08-17-2007 6:51 AM
08-17-2007 6:55 AM
data:
itab1 like table of itab with header line.
sort ITAB by belnr.
loop at ITAB.
itab1 = itab.
collect itab1.
endon.
endloop.
Now ITAB1 will contain the required cumulative results.
If it doesn't work then in need to see how you declared ITAB.
Reward points if useful.Get back in case of query...
Cheers!!!
08-17-2007 6:57 AM
if u have the two fields in itab1.
data: begin of itab2 occurs 0,
belnr(10),
amount type p decimals 2.
end of itab2.
loop at itab1.
move itab1-belnr to itab2-belnr.
move itab1-amount to itab2-amount.
collect itab2.
endloop.
08-17-2007 10:25 AM