Refresh An ALV Output Sample
Refresh An ALV Output Sample
*&---------------------------------------------------------------------*
*& Report ZUS_SDN_FM_ALV_REFRESH
*&
*&---------------------------------------------------------------------*
*& Thread: How to refresh an ALV output after change of data?
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread"
modifiedtitle="true" __default_attr="814065"></a>
*&---------------------------------------------------------------------*
REPORT zus_sdn_fm_alv_refresh.
START-OF-SELECTION.
gd_rows = 1.
PERFORM select_data.
gd_repid = syst-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gd_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
i_structure_name = 'KNB1'
TABLES
t_outtab = gt_outtab
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
END-OF-SELECTION.
*&---------------------------------------------------------------------*
*& Form SELECT_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM select_data .
REFRESH: gt_outtab.
SELECT * FROM knb1 INTO TABLE gt_outtab UP TO gd_rows ROWS.
*&---------------------------------------------------------------------*
*& Form user_command
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->R_UCOMM text
* -->RS_SELFIELD text
*----------------------------------------------------------------------*
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
" Function REFRESH in GUI-status
WHEN 'REFR'.
ADD 1 TO gd_rows.
PERFORM select_data.
WHEN OTHERS.
RETURN.
ENDCASE.
ENDFORM. "user_command
*&---------------------------------------------------------------------*
*& Form set_pf_status
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->RT_EXTAB text
*----------------------------------------------------------------------*
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'TAB_LIS4'. " copied from SAPLSETB
ENDFORM. "set_pf_status