We have a scenario in which our user can generate an ALV output from a transaction screen. After processing that ALV, the user can back out (green arrow back) to the document input screen and enter a new document number. Upon selection of the ALV display, SAP displays the ALV container/report for the 1st document. At the time of Create for first display, the internal table contains the correct values, however. Upon entry to the 2nd document, the container and the grid are initial, and are created as the module proceeds. If the user exits the transaction completely, then re-enters the transaction, the display will be correct, but we have no way to enforce this. We've tried free for the container and the grid, that just causes abends if the user selects the ALV again in the same document. Can anyone suggest how we can force SAP and the GUI to display the current table contents, rather than the prior document contents? Code:
IF gr_cstm_cntr IS not INITIAL. * call method gr_cstm_cntr->free. "doesn't work call method cl_gui_cfw=>flush. * clear: gr_cstm_cntr, "doesn't work * gr_alv_grid. endif. * if control is initial IF gr_cstm_cntr IS INITIAL. * create control object IF sy-batch NE 'X'. "allows for batch execution CREATE OBJECT gr_cstm_cntr EXPORTING container_name = 'ALV_CTRL'. ENDIF. * create grid object CREATE OBJECT gr_alv_grid EXPORTING i_parent = gr_cstm_cntr. * set layout PERFORM set_layout. * set field catalog PERFORM set_catalog. * set events PERFORM set_events. * display ALV CALL METHOD gr_alv_grid->set_table_for_first_display EXPORTING i_structure_name = 'ZCLST_EDI_EXCEPTION_ALV' is_layout = gs_layout CHANGING it_fieldcatalog = gt_fcat it_outtab = gt_alv_output. "correct content * else if control already set ELSE. * refresh display. CALL METHOD gr_alv_grid->refresh_table_display EXPORTING i_soft_refresh = ' ' EXCEPTIONS finished = 1 OTHERS = 2. ENDIF.