Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Refresh in ALV.

Former Member
0 Kudos

Hi all,

there is someone that can help me.

How can i insert the refresh to update an alv output of a custom ABAP report?

Is there any FM that can do it?

Thanks a lots,

Alex.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Alex,

use this in your alv report.

DATA:

lv_ref_grid TYPE REF TO cl_gui_alv_grid.

CLEAR : gv_tcode.

*-- to ensure that only new processed data is displayed

IF lv_ref_grid IS INITIAL.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

e_grid = lv_ref_grid.

ENDIF.

IF NOT lv_ref_grid IS INITIAL.

CALL METHOD lv_ref_grid->check_changed_data.

ENDIF.

Hope this will help you.

Regards,

Vijay

5 REPLIES 5

Former Member
0 Kudos

Hi alex,

this is quite possible.

see, your refresh button responds to ALV event 'DATA_CHANGED'

you can define a subroutine for this event and do update the ALV

Former Member
0 Kudos

Hi Alex,

use this in your alv report.

DATA:

lv_ref_grid TYPE REF TO cl_gui_alv_grid.

CLEAR : gv_tcode.

*-- to ensure that only new processed data is displayed

IF lv_ref_grid IS INITIAL.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

e_grid = lv_ref_grid.

ENDIF.

IF NOT lv_ref_grid IS INITIAL.

CALL METHOD lv_ref_grid->check_changed_data.

ENDIF.

Hope this will help you.

Regards,

Vijay

0 Kudos

Hi Vijay,

i use CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' and not CALL METHOD so can i do refresh?

Regards,

Alex.

0 Kudos

hi alex,

as i said

you pass your subroutine name to IT_EVENTS --> this will hold the event name and subroutine name

so its like

data:
gs_event    TYPE slis_alv_event,            "work area for event
gt_event    TYPE slis_t_event.               "internal table for event
*---passing events to event table
    gs_event-name = 'DATA_CHANGED'.
    gs_event-form = 'SUB_DATACHANGE'. "-> ur subroutine name
    APPEND gs_event TO gt_event.

*---call function to display alv grid
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_callback_program = sy-repid
        is_layout          = gs_layout
        it_fieldcat        = gt_fcat
        i_default          = gc_x
        i_save             = gc_a
        is_variant         = ls_variant
        it_events          = gt_event "here you pass it
      TABLES
        t_outtab           = gt_disp
      EXCEPTIONS
        program_error      = 1
        OTHERS             = 2.

and you can define your subroutine to do your things

0 Kudos

Hi Alex again,

Yes you can use that.

You need to use it in at user command.

e.g.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

i_callback_pf_status_set = 'GI'

i_callback_user_command = 'USER_COMMAND'

FORM user_command USING lv_ucomm TYPE sy-ucomm ls_selfield TYPE slis_selfield.

DATA:

lv_ref_grid TYPE REF TO cl_gui_alv_grid.

CLEAR : gv_tcode.

*-- to ensure that only new processed data is displayed

IF lv_ref_grid IS INITIAL.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

e_grid = lv_ref_grid.

ENDIF.

IF NOT lv_ref_grid IS INITIAL.

CALL METHOD lv_ref_grid->check_changed_data.

ENDIF.

.

Hope this will clear your doubt.

Regards,

Vijay