cancel
Showing results for 
Search instead for 
Did you mean: 

ALV set_first_visible_row not working after sort / totals

Former Member
0 Kudos

I am using ALV to display data from a dynamic node that I have created. I have added code for sorting a few columns, and then added totals for the numeric columns. In changing the configuration settings for the ALV I am using lo_value->if_salv_wd_table_settings~set_first_visible_row( 1 ) to try and display the initial grid starting with the 1st row. My problem is that the ALV grid always displays showing the last rows with the final total row. I tried moving set_first_row_visible around (after the totaling) but got the same result. The code will work if I just add sorting with no totals, but as soon as I add code to total the numeric columns I end up at the last row on initial display. Does anyone have a suggestion on what I can do to initially show my ALV grid starting at row #1 with totals?

Thanks,

Jeff M

Accepted Solutions (1)

Accepted Solutions (1)

gill367
Active Contributor
0 Kudos

hello ,


lo_value->if_salv_wd_field_settings~SET_AGGR_BEFORE_ITEMS( abap_true ).

this you can use to show the totals before the data. i.e. above the first row itself.

and if you dont want this and want to display total at the end only then it is not feasible with the

IF_SALV_WD_TABLE_SETTINGS~SET_FIRST_VISIBLE_ROW() function

you need to do some work around like putting the code to get the total for th field in wddomodifyview method and

then getting the first visible row by using IF_SALV_WD_TABLE_SETTINGS~gET_FIRST_VISIBLE_ROW() and then

display the total (or we can say get the total ) only when you have reachen at the end.

but then you need to remove the total once the user is scrolling up.

so it is kind of complicated.

so better will be to use the first case of diplaying the totals above the data.

thanks

sarbjeet singh

Answers (0)