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 avoid ALV going to the top of list after refresh?

gilberto_parga
Participant
0 Kudos
3,448

Hi guys.

I have a technical issue regarding an ALV with saving options. I set a column as editable checkbox and I am using not OO ALV reporting, specifically REUSE_ALV_GRID_DISPLAY. I coded the user_command form. After a checkbox is selected (or deselected), I fill some non-editable columns of the checked line with relevant data (like the current user ID and date). The process of doing that is described here: (answers from Mihaela and Susmitha are good ones) but the point is that after a change in a line of report is done, the report should be refreshed to show the new data like the actual checkbox tick and the user name or new color of line. If the ALV report is big (many lines) and a checked line is reached only using the scroll bar (scrolling down at least 1 time), after instructions CALL METHOD lr_grid->refresh_table_display or rs_selfield-refresh = 'X' the ALV is going to the top of the list. I meant, for every click on the checkbox column, I have to do a refresh in order to show the data changes on this line and the problem is when line is not in the first page of the listing, it will not be visible anymore because ALV report is going to the top (the "first page" of results) due refreshing process and user will need to scroll down again if s/he wants to see the change s/he just did. Thats annoying.  Do you know a way to avoid this behavior? Please help. Thanks!

1 ACCEPTED SOLUTION

Former Member
329

Dear Gilberto,

Please send the parameter is_stable in lr_grid->refresh_table_display.

DATA :  lx_is_stable     TYPE lvc_s_stbl.

CONSTANTS : c_x TYPE char1 VALUE 'X'.

lx_is_stable-row = c_x.

lx_is_stable-col = c_x.

                  CALL METHOD lr_grid->refresh_table_display

                    EXPORTING

                      is_stable = lx_is_stable

*                     i_soft_refresh = 'X'

                    EXCEPTIONS

                      finished  = 1

                      OTHERS    = 2.

                  IF sy-subrc <> 0.

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

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

                  ENDIF.

Regards,

Yance

2 REPLIES 2

Former Member
330

Dear Gilberto,

Please send the parameter is_stable in lr_grid->refresh_table_display.

DATA :  lx_is_stable     TYPE lvc_s_stbl.

CONSTANTS : c_x TYPE char1 VALUE 'X'.

lx_is_stable-row = c_x.

lx_is_stable-col = c_x.

                  CALL METHOD lr_grid->refresh_table_display

                    EXPORTING

                      is_stable = lx_is_stable

*                     i_soft_refresh = 'X'

                    EXCEPTIONS

                      finished  = 1

                      OTHERS    = 2.

                  IF sy-subrc <> 0.

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

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

                  ENDIF.

Regards,

Yance

Sandra_Rossi
Active Contributor
0 Kudos
329

In complement of Yance answer, if you use the callback subroutine of REUSE_ALV_GRID_DISPLAY, you'll have to set rs_selfield-row_stable = 'X' (and possibly col_stable)