REFRESH_TABLE_DISPLAY not working.
I have an ALV grid displaying purchase order information. When you double-click, it takes you to the transaction ME22N. I have enhanced ME22N's screen to include a checkbox on the screen that is tied to a custom field in the EKKO table. I have verified that the EKKO field is getting updated correctly whenever the checkbox is changed, however my ALV grid will not refresh to display the changes made. I have been putting the code directly after the CALL TRANSACTION ME22N line in the user event block. I have also tried putting it in the ALV screen's PDO module. I have gotten the internal table that I use to create the ALV grid to reflect the changes, but the actual grid display is still showing the old information. I have tried using REFRESH_TABLE_DISPLAY and I am having no luck. The ALV display does refresh if I back out to the selection screen and execute the report again. Am I forgetting to do something to the container? Do I need to free the grid first (which I have tried)? I know there are similar threads on SDN pertaining to this issue, but none of the ones I have found so far have solved my problem. I am creating the ALV using the object-oriented method. Any help would be greatly appreciated.
Here is my code for setting the ALV container.
Create ALV object if it does not already exist
IF cl_custom_container IS INITIAL.
CREATE OBJECT cl_custom_container
container_name = 'ALV_CONTAINER'.
CREATE OBJECT cl_alv_grid
i_parent = cl_custom_container.
Build the ALV field catalog
PERFORM alv_build_field_cat TABLES it_alv_field_cat.
Build the ALV sort tables
PERFORM alv_build_sort TABLES it_alv_sort.
Set the ALV layout
PERFORM alv_set_layout USING wa_alv_layout.
Set the ALV variant
PERFORM alv_set_variant USING wa_alv_variant.
Set the ALV save setting
PERFORM alv_set_save USING w_save.
Load data into the grid and display them
CALL METHOD cl_alv_grid->set_table_for_first_display
is_layout = wa_alv_layout
is_variant = wa_alv_variant
i_save = w_save
it_outtab = it_ekko
it_fieldcatalog = it_alv_field_cat
it_sort = it_alv_sort.
Create events for this object
CREATE OBJECT cl_event.
SET HANDLER cl_event->double_click FOR cl_alv_grid.
SET HANDLER cl_event->handle_top_of_list FOR cl_alv_grid.
SET HANDLER cl_event->handle_top_of_page FOR cl_alv_grid.
Table has already been created so refresh it
CALL METHOD cl_alv_grid->refresh_table_display.
ENDFORM. " alv_set_container
In this line of your code,
ELSE. * Table has already been created so refresh it PERFORM get_data. CALL METHOD cl_alv_grid->refresh_table_display. ENDIF.
Please add the following lines:
PERFORM get_data. "this is you present code. insert here beforerefreshing the ALV display DATA: lwa_ref TYPE lvc_s_stbl.. IF cl_alv_grid IS INITIAL. CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR' IMPORTING e_grid = cl_alv_grid. IF sy-subrc EQ 0. * do nothing ENDIF. ENDIF. IF NOT cl_alv_grid IS INITIAL. CALL METHOD cl_alv_grid->refresh_table_display EXPORTING is_stable = lwa_ref EXCEPTIONS finished = 1 OTHERS = 2. IF sy-subrc = 0 . "do nothing ENDIF. ENDIF.
Edited by: levis 501 on Sep 22, 2011 5:00 AM