you can do this in 2 ways........
loop at it into wa.
at end of <field>.
sum.
here, you have to use sy-tabix to count processing of loop....
when you got the sum...
1001 5
->1001 3
1002 3 -> internal table data....you have to sort internal table first....
1002 2
1002 6.
1st time loop is processing,
sy-tabix value = 1.
2nd time loop is processing.
sy-tabix value = 2.
when control checks that <field value> [arrow sign in internal table] changes in next processing
then it sums 5 +3 = 8. on that time sy-tabix value = 2.
use a local variable to store the sum amount...... suppose abc the variable. avg = abc / sy-tabix.
or you have to use slis_t_sortinfo_alv.