Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

It seems to be 'H_BETRG' is not in the final internal table. Therefore this error is occured.

Please check whether 'H_BETRG' is available in the final internal table or not?

Thanks,

Sriram Ponna.

5 REPLIES 5

Former Member
0 Kudos

Hi,

Could you please let me know what is the dump you are getting?

Thanks,

Sriram Ponna.

0 Kudos

Hi,

The dump is as following:

What happened?

The current application program detected a situation which really

should not occur. Therefore, a termination with a short dump was

triggered on purpose by the key word MESSAGE (type X).

Error analysis

Short text of error message:

Technical information about the message:

Message classe...... "0K"

Number.............. 000

Variable 1.......... " "

Variable 2.......... " "

Variable 3.......... " "

Variable 4.......... " "

Variable 3.......... " "

Variable 4.......... " "

Trigger Location of Runtime Error

Program SAPLSLVC

Include LSLVCU10

Row 36

Module type (FUNCTION)

Module Name LVC_SORT_COMPLETE

31 LOOP AT CT_SORT INTO LS_SORT.

32

33 READ TABLE IT_FIELDCAT ASSIGNING <LS_FIELDCAT>

34 WITH KEY FIELDNAME = LS_SORT-FIELDNAME BINARY SEARCH.

35 IF SY-SUBRC NE 0.

>>>> MESSAGE X000(0K).

37 ENDIF.

38

39 LS_SORT-SELTEXT = <LS_FIELDCAT>-SELTEXT.

40

41 * Zwischensummenstufen ermitteln

42 IF NOT LS_SORT-SUBTOT IS INITIAL.

43 L_COUNT = L_COUNT + 1.

Please help, thank you!!

Former Member
0 Kudos

Hi,

you should put the fieldname of 300100000.

i think u r getting dump for some other issue.

check the line in which u r getting dump.

Regards

ANUPAM

Former Member
0 Kudos

hi

good

go through this link ,this wll give yo u complete idea about the function module SLIS_T_SORTINFO_ALV.

http://www.sap-basis-abap.com/sapalv.htm

pls go through it and do accordingly.

thanks

mrutyun^

Former Member
0 Kudos

Hi,

It seems to be 'H_BETRG' is not in the final internal table. Therefore this error is occured.

Please check whether 'H_BETRG' is available in the final internal table or not?

Thanks,

Sriram Ponna.