Refresh Table Display Moves Cursor to First Line

Guest post by Rajiv

If you are making some changes in the ALV Output and refresh the ALV display using the method “REFRESH_TABLE_DISPLAY” the chances are it will go to the first line, unless you call the refresh table display with the parameters. Use the below code to make the ALV stick to the current row eventhough you refresh it.

 DATA ls_stable TYPE lvc_s_stbl.
 ls_stable-row = 'X'.
 ls_stable-col = 'X'.
 CALL METHOD gr_alvgrid->refresh_table_display
        is_stable = ls_stable
        finished  = 1
        OTHERS    = 2.
 IF sy-subrc <> 0.