Skip to Content
0
Former Member
Nov 22, 2007 at 11:33 PM

FM ALV Refresh - Set Cursor not working

1069 Views

Hi All..

I have a problem with my ALV refresh in that when I come back to my ALV Grid it is doing the refresh but keeps going back to the first row of my ALV Grid rather than the edited record. I have tried this code but it is not working.. please help:

STEP 1: Get the scroll position with FM... put into E_GRID_SCROLL

CASE L_UCOMM.

WHEN OTHERS.

CALL FUNCTION 'REUSE_ALV_GRID_LAYOUT_INFO_GET'

IMPORTING

ES_GRID_SCROLL = E_GRID_SCROLL

EXCEPTIONS

NO_INFOS = 1

PROGRAM_ERROR = 2

OTHERS = 3.

Step 2: Call transaction and update record that has been changed

Call ZDOC2.

*make changes in ZDOC2.

*My refresh table is set to execute when I come back to my report

PERFORM REFRESH_TABLE.

MODIFY Itab...

Step 3: Set the scroll position from E_GRID_SCROLL...

CALL FUNCTION 'REUSE_ALV_GRID_LAYOUT_INFO_SET'

EXPORTING

IS_GRID_SCROLL = E_GRID_SCROLL.

Step 4: Set flags for refresh

LS_SELFIELD-REFRESH = 'X'.

LS_SELFIELD-ROW_STABLE = 'X'.

Step 5: Output List Viewer

PERFORM OUTPUT_ALV.

This still doesn't work!!! I get no errors and E_GRID_SCROLL is populated with the row index... I get SY-SUBRC = 0 after each FM. Yet my ALV still resets to first record each time I go back. What am I missing?