0% found this document useful (0 votes)
21 views3 pages

Refresh An ALV Output Sample

This document discusses how to refresh an ALV output after changes to the underlying data. It describes using a function called REFRESH in the GUI status to re-execute a SELECT statement and refresh the ALV list with new data.

Uploaded by

sajad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views3 pages

Refresh An ALV Output Sample

This document discusses how to refresh an ALV output after changes to the underlying data. It describes using a function called REFRESH in the GUI status to re-execute a SELECT statement and refresh the ALV list with new data.

Uploaded by

sajad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Refresh an ALV output after change of data

*&---------------------------------------------------------------------*
*& 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.

TYPE-POOLS: abap, slis.

DATA: gd_repid TYPE syst-repid,


gt_outtab TYPE STANDARD TABLE OF knb1,
gd_rows TYPE i.

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.

ENDFORM. " SELECT_DATA

*&---------------------------------------------------------------------*
*& 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.

rs_selfield-refresh = abap_true. " refresh ALV list !!!

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

You might also like