09-17-2009 10:23 AM
Dear all
I have an ALV grid using REUSE_ALV_GRID_DISPLAY and I change data during execution.
How can I now force the refresh of the grid? (Can I for example force myself the use of the standard refresh button)
I tried for ex.
FORM user_comm USING l_ucomm LIKE sy-ucomm l_selfield TYPE slis_selfield.
PERFORM update_alv_tab.
endform.
FORM update_alv_tab .
DATA : e_grid TYPE REF TO cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = e_grid.
CALL METHOD e_grid->check_changed_data.
"update_alv_tab
CALL METHOD e_grid->refresh_table_display.
ENDFORM. " UPDATE_ALV_TAB
it seems to work on debug, but when i start my program normal, it closes SAP Gui with an error message!!!! not bad.
Any other ideas ?
Herbert
09-17-2009 10:28 AM
Herbert,
Try this way.
Thanks
Venkat.O
*&---------------------------------------------------------------------*
*& Form USER_COMMAND
*&---------------------------------------------------------------------*
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE SLIS_SELFIELD.
IF R_UCOMM = 'REFRESH'."Create one button on ALV toolbar with function code REFRESH
RS_SELFIELD-REFRESH = 'X'. "Set this one. It refreshes internal table data with new values
ENDIF.
ENDFORM. "USER_COMMAND
09-17-2009 10:28 AM
Herbert,
Try this way.
Thanks
Venkat.O
*&---------------------------------------------------------------------*
*& Form USER_COMMAND
*&---------------------------------------------------------------------*
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE SLIS_SELFIELD.
IF R_UCOMM = 'REFRESH'."Create one button on ALV toolbar with function code REFRESH
RS_SELFIELD-REFRESH = 'X'. "Set this one. It refreshes internal table data with new values
ENDIF.
ENDFORM. "USER_COMMAND
09-17-2009 10:33 AM
I want to do it automatically. There is already the standard Refresh Button. But I don't want the user to press it
09-17-2009 11:04 AM
Hi,
Just check the code of the standard refresh, if possible , you can copy and paste the same subroutine when you require refresh to be happened.
09-17-2009 10:28 AM
Hi,
Why dont you try like this:
FORM user_comm USING l_ucomm LIKE sy-ucomm l_selfield TYPE slis_selfield.
l_SELFIELD-REFRESH = 'X'.
endform.
Regards,
Himanshu
09-17-2009 10:32 AM
09-17-2009 10:33 AM
Hi,
Use this.
DATA:
lv_ref_grid TYPE REF TO cl_gui_alv_grid.
CLEAR : gv_tcode.
*-- to ensure that only new processed data is displayed
IF lv_ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = lv_ref_grid.
ENDIF.
IF NOT lv_ref_grid IS INITIAL.
CALL METHOD lv_ref_grid->check_changed_data.
ENDIF.
THis will solve your problem.
Regards,
Vijay
09-17-2009 10:45 AM
The big problem seems to be that it works on debug when i put a break-point on it, but it closes my SAP Gui when I do not debug !!!!!!!!!!!!! Really strange
09-17-2009 1:02 PM
Found it. I had to replace my perform which fills the internal table and now it works. No idea, why it shot me before
thank you all
10-14-2021 4:15 PM
I know this is old...
i had the same issue with updating a alv (when a user puts in new data) from within REUSE_ALV_GRID_DISPLAY fm. in the i_callback_user_command form, i put in the fm get_globals_from_slvc_fullscr with the e_grid = grid (defined in the form as type ref to cl_gui_alv_grid) and then the two call methods, grid->check_changed_data and grid->refresh_table_display. this worked like a charm.
thanks for all the help above.
03-17-2023 4:40 PM
Yes this code script is excellent when need to refresh table data and insert new one. Thanks for question and answers, this made my day today. 😃
09-18-2023 4:31 AM
Thanks Guys.Very Helpful code.Works to get changed data from ALV into user command. I had to set layout_h-sel_mode = 'D' for capture mutliple rows in REUSE_ALV_GRID_DISPLAY_LVC.