Skip to Content
0
Former Member
Dec 24, 2007 at 01:16 PM

How to subtotal in alv? Please correct the code!!!!

40 Views

hi,

I have an alv layout like following:

ZZZ 300100089 1050

ZZZ 300100089 1050

subtoal 2100

90256243 300100000 193410

90256242 300100000 173250

90256241 300100000 173250

90256240 300100000 173250

90256239 300100000 173250

90256238 300100000 173250

90256237 300100000 173250

subtotal 1232910

when the second numbers are the same,

I need to sum up as

300100089 2100

300100000 1232910

I write the coding as the following, but it did not work. I go dump in function module. Please

help and correct it!!

-


DATA I_SORT TYPE SLIS_T_SORTINFO_ALV.

DATA WA_SORT TYPE slis_sortinfo_alv.

WA_SORT-fieldname = 'H_BETRG'. " speicfy field name..

WA_SORT-UP = 'X'.

WA_SORT-SUBTOT = 'X'.

APPEND WA_SORT TO I_SORT.

CLEAR WA_SORT.

IN FM.

it_sort = i_sort

-


I do not know what is the file name I should put into the WA_SORT-fieldname, I tried "wrbtr" and some other name, but I got the same dump when I excute the program. Please help me to correct the code.

Thank you.