09-07-2009 1:32 PM
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.
09-07-2009 2:00 PM
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
09-07-2009 2:00 PM
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
09-07-2009 2:00 PM
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
09-07-2009 2:29 PM
Hi Vijay,
i use CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' and not CALL METHOD so can i do refresh?
Regards,
Alex.
09-07-2009 2:36 PM
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
09-07-2009 2:36 PM
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