Posted: Sun Sep 02, 2007 3:49 am Post subject: Auto Refresh ALV List
Code:
REPORT z_alv_auto_refresh.
*>*********************************************************************
* This report displays User's info (SM04) using the FM : *
* REUSE_ALV_LIST_DISPLAY *
* The list is auto-refreshed (refresh time : 5 seconds) *
*---------------------------------------------------------------------*
TYPE-POOLS: slis. " ALV Global Types
DATA :
gt_user LIKE uinfo OCCURS 0 WITH HEADER LINE. " User info in SM04
*---------------------------------------------------------------------*
* Form F_LIRE_DATA
*---------------------------------------------------------------------*
FORM f_read_data.
REFRESH gt_user.
* Get User's info
CALL FUNCTION 'THUSRINFO'
TABLES
usr_tabl = gt_user.
* Wait in a task
PERFORM f_call_rfc_wait.
ENDFORM. " F_READ_DATA
*---------------------------------------------------------------------*
* Form F_DISPLAY_DATA
*---------------------------------------------------------------------*
FORM f_display_data.
DEFINE m_sort.
add 1 to ls_sort-spos.
ls_sort-fieldname = &1.
append ls_sort to lt_sort.
END-OF-DEFINITION.
DATA :
ls_layout TYPE slis_layout_alv,
lt_sort TYPE slis_t_sortinfo_alv,
ls_sort TYPE slis_sortinfo_alv,
lt_event_exit TYPE slis_t_event_exit,
ls_event_exit TYPE slis_event_exit.
ENDFORM. " F_DISPLAY_DATA
*---------------------------------------------------------------------*
* FORM USER_COMMAND *
*---------------------------------------------------------------------*
FORM user_command USING i_ucomm TYPE syucomm
is_selfield TYPE slis_selfield. "#EC CALLED
CASE i_ucomm.
WHEN '&NTE'.
PERFORM f_read_data.
is_selfield-refresh = 'X'.
SET USER-COMMAND '&OPT'. " Optimize columns width
ENDCASE.
ENDFORM. " USER_COMMAND
*---------------------------------------------------------------------*
* Form F_CALL_RFC_WAIT
*---------------------------------------------------------------------*
FORM f_call_rfc_wait.
DATA lv_mssg(80). "#EC NEEDED
* Wait in a task
CALL FUNCTION 'RFC_PING_AND_WAIT' STARTING NEW TASK '001'
PERFORMING f_task_end ON END OF TASK
EXPORTING
seconds = 5 " Refresh time
busy_waiting = space
EXCEPTIONS
RESOURCE_FAILURE = 1
communication_failure = 2 MESSAGE lv_mssg
system_failure = 3 MESSAGE lv_mssg
OTHERS = 4.
ENDFORM. " F_CALL_RFC_WAIT
*---------------------------------------------------------------------*
* Form F_TASK_END
*---------------------------------------------------------------------*
FORM f_task_end USING u_taskname.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.