Skip to Content
0
Former Member
Jul 11, 2007 at 01:59 AM

help with the code

13 Views

Hi all,

i have records like in internal table itab

id amount

101 1 1.00

101 2 2.00

102 1 1.00

102 2 2.50

102 3 3.00

103 2 1.50

i want the output like like this internal table itab1

101 3.00

102 6.50

103 1.50

clear : wa_zoritem ,price.

total= 0.00

loop at itab into wa_itab.

on change of wa_itab1-id.

clear total.

total= total + wa_itab1-amount.

wa_itab1-id = wa_itab_copy-id.

wa_itab1-total= wa_itab_copy-total.

append wa_itab1 to itab1.

endon.

*MODIFY TABLE i_FINAL FROM wa_FINAL

  • TRANSPORTING COST.

*MODIFY wa_final to i_final.

wa_itab_copy = wa_itab.

clear : wa_itab.

endloop.

This works fine when i have multiple records

but this doesn't work when i have the follwwing record in itab

id amount

101 1 1.00

Thanks