Skip to Content
0
Former Member
May 09, 2008 at 04:25 PM

subtotal in internal table

742 Views

I have one internal table.

its fields are

vbeln

posnr

brgew

gewei

volum

voleh

defined internal table as

DATA : BEGIN OF itab5 OCCURS 0,

vbeln LIKE vbap-vbeln,

posnr LIKE vbap-posnr,

brgew LIKE vbap-brgew,

gewei LIKE vbap-gewei,

volum LIKE vbap-volum,

voleh LIKE vbap-voleh,

END OF itab5.

after some oerations on internal table i get some records in itab5

for each vbeln there may be motre than one posnr

for all posnr of one vbeln

i want subtotal of the field brgew and volum

i have coded this way

but it gets total of all vbelns

sort itab5 by vbeln .

loop at itab5.

on change of itab5-vbeln.

loop at itab5 where vbeln = itab5-vbeln.

sum.

endloop.

endon.

endloop.

pls suggest me the changes.

points will be rewarded to each.