2008 May 14 8:46 AM
Hello Gurus, i need to refresh my ALV after modifications in the database. Can i overwrite the refresh method ? because i have to refresh the internal table too.
The refresh button won`t work.
I will reward points.
2008 May 14 8:48 AM
Hi,
The following method call is used to refresh the data displayed within an ALV object grid:
CALL method gd_tree->REFRESH_TABLE_DISPLAY.
CALL METHOD gd_tree->set_table_for_first_display
EXPORTING
is_layout = gd_layout
CHANGING
it_fieldcatalog = gd_fieldcat
it_sort = it_sortcat
it_outtab = it_report.
CALL method gd_tree->REFRESH_TABLE_DISPLAY.
CALL METHOD cl_gui_cfw=>flush.
Regards,
Bhaskar
2008 May 14 8:51 AM
Hi,
Use below code
DATA : DATA ref1 TYPE REF TO cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref1.
CALL METHOD ref1->check_changed_data.
CALL METHOD ref1->refresh_
OR
do like this
data: o_alv type ref to CL_SALV_TABLE.
then use the method
CALL METHOD o_alv->refresh
EXPORTING
refresh_mode = if_salv_c_refresh=>soft.
Another method:
If you are using the function module ALV, you need to set the REFRESH flag in the USER_COMMAND routine. HEre is an example.
code
Call ABAP List Viewer (ALV)
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = repid
i_callback_user_command = 'HANDLE_USER_COMMAND'
it_fieldcat = ifc
tables
t_outtab = itab.
endform.
***********************************************************************
FORM handle_User_Command *
***********************************************************************
form handle_user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
case r_ucomm.
when '&IC1'.
DO Something
rs_selfield-refresh = 'X'.
endcase.
endform.
Regards,
Shiva K
2008 May 14 9:07 AM
Hello Ioan
To be honest I do not understand where your problem is. If you need to distinguish between unmodified and modified ALV list data simply use two internal tables, e.g.:
1.) Select data from DB table and fill GT_OUTTAB_PBO.
2.) Set: GT_OUTTAB_PAI = GT_OUTTAB_PBO. The PAI itab is displayed on the editable ALV list
3.) User changes values of GT_OUTTAB_PAI and pushes SAVE button.
4.) Retrieve current PAI data using method go_grid->check_changed_data.
5.) If GT_OUTTAB_PAI <> GT_OUTTAB_PBO then execute SAVE routine with DB update. Set GT_OUTTAB_PAI = GT_OUTTAB_PBO.
6.) The SAVE routine is executed at PAI of your screen followed by PBO. Then the current GT_OUTTAB_PAI data are displayed which should be identical to the records in the DB table.
Regards
Uwe
2008 May 14 12:56 PM
I have two transactions: one for displaying (using ALV) and one for editing (using ALV), a DB table.
They are running both at the same time in two different sessions. After the user alters the DB table in the edit sessions / transaction, i must refresh the display ALV in the display session so i can see the new DB table.
The problem is that if i press the refresh button i won`t refresh with the new DB table. I have tried to write something like this:
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
on_data_changed for event data_changed of cl_gui_alv_grid
importing er_data_changed.
METHODS:
toolbar_handler FOR EVENT toolbar OF cl_gui_alv_grid
importing
E_OBJECT
E_INTERACTIVE.
ENDCLASS.
......
CLASS lcl_event_receiver IMPLEMENTATION.
.....
method toolbar_handler.
SELECT * FROM zianexe into TABLE itab. " Refresh the itab with the new DB data
endmethod.
When i press the refresh button the "toolbar" event is triggered and the "toolbar_handler" method called.
Now my problem is that i have to press two times the refresh button for my ALV to be displayed with the new DB table.
I hope its clear.
Thank you for the interest.