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: 

DO_SUM and Sort is not working ALV_BLOCK_LIST

Former Member
0 Kudos
77

Hi Experts,

ALthough I have found many posts for the problem of DO_SUM and Sort. But I have applied all the suggestions in my program. But I am not able to find out the SUM and SORT fields . I have to DO_SUM on one field "GROSS INVOICE'. and I want to SORT some fields. Cna anybody help me in that. I am using

REUSE_ALV_BLOCK_LIST_INIT

REUSE_ALV_BLOCK_LIST_APPEND

REUSE_ALV_BLOCK_LIST_DISPLAY

Your help would be beneficial for me.

Thanks a lot in advance.

2 REPLIES 2

Former Member
0 Kudos
42

Hi,

try this for sorting.

data w_sort TYPE lvc_s_sort,

t_sort TYPE lvc_t_sort.

w_sort-spos = '1'.

w_sort-fieldname = 'CITYFROM'.( mention fieldnames)

w_sort-down = 'X'.( w_sort-up can be used for ascending sort)

APPEND w_sort TO t_sort.

CLEAR w_sort.

w_sort-spos = '2'.

w_sort-fieldname = 'CARRID'.(mention fieldnames )

w_sort-down = 'X'.

APPEND w_sort TO t_sort.

CLEAR w_sort.

CALL METHOD r_alv_grid->set_table_for_first_display

EXPORTING

i_structure_name = 'FS'

is_layout = w_lay

CHANGING

it_outtab = itab

it_fieldcatalog = t_cat

it_sort = t_sort

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Thanks

0 Kudos
42

Hi Shree Sudha,

But you are teling me about Class. I am working on REUSE_ALV_BLOCK_LIST_APPEND. This will not be helpful. Please I need more help.