메뉴 건너뛰기

SAP 한국 커뮤니티



REPORT z_alv_auto_refresh

노름마치 2007.11.05 12:40 조회 수 : 3279

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)               *
*---------------------------------------------------------------------*
* Author : Michel PIOUD                                               *
* Email : mpioud@yahoo.fr  HomePage : http://www.geocities.com/mpioud *
*>*********************************************************************
*   o__      o__      o__      o__      o__      o__      o__      o__*
*  _.>/)_   _.>/)_   _.>/)_   _.>/)_   _.>/)_   _.>/)_   _.>/)_   _.>/*
* (_) (_) (_) (_) (_) (_) (_) (_) (_) (_) (_) (_) (_) (_) (_) *
***********************************************************************
TYPE-POOLS: slis.                      " ALV Global Types


DATA :
  gt_user LIKE uinfo OCCURS 0 WITH HEADER LINE. " User info in SM04


*---------------------------------------------------------------------*
START-OF-SELECTION.


  PERFORM f_read_data.


  PERFORM f_display_data.


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


  DEFINE m_event_exit.
    clear ls_event_exit.
    ls_event_exit-ucomm = &1.
    ls_event_exit-after = 'X'.
    append ls_event_exit to lt_event_exit.
  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.


* Build Sort Table
  m_sort 'ZEIT'.


* Build Event Exit Table
  m_event_exit '&NTE'.                 " Refresh


  ls_layout-zebra = 'X'.
  ls_layout-colwidth_optimize = 'X'.


  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
            i_callback_program      = sy-cprog
            i_callback_user_command = 'USER_COMMAND'
            is_layout               = ls_layout
            i_structure_name        = 'UINFO'
            it_sort                 = lt_sort
            it_event_exit           = lt_event_exit
       TABLES
            t_outtab                = gt_user.


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.


  DATA lv_mssg(80).                                         "#EC NEEDED


* Receiving task results
  RECEIVE RESULTS FROM FUNCTION 'RFC_PING_AND_WAIT'
    EXCEPTIONS
      RESOURCE_FAILURE      = 1
      communication_failure = 2  MESSAGE lv_mssg
      system_failure        = 3  MESSAGE lv_mssg
      OTHERS                = 4.


  CHECK sy-subrc EQ 0.
  SET USER-COMMAND '&NTE'.             " Refresh


ENDFORM.                               " F_TASK_END
*************** END OF PROGRAM Z_ALV_AUTO_REFRESH *********************


 

번호 제목 글쓴이 날짜 조회 수
87 [onepaper] 참고자료 Archiving 세팅에 필요한 파일소스입니다. [7] file 원니컴 2011.03.22 13803
86 Text(Description) 빠르게 반영하기,,, 속도개선을 위주로 [5] file 노름마치 2010.12.07 13909
85 Transport Trace [4] file 소주와 막걸리 2009.11.13 12144
84 Syntax Checker [4] file 소주와 막걸리 2009.11.13 13765
83 Mass Download [5] file 소주와 막걸리 2009.11.13 17370
82 Data Browser (SE11에서 Contents 버튼 클릭시 화면) [8] ASY 2009.05.19 9048
81 4.6c 에서 Xml 파일을 읽어오는 로직 예제 입니다. [2] woong 2009.05.11 14814
80 금액을 영문으로 [4] file 쥬앙 2009.04.06 12367
79 Report SELECTION-SCREEN에서 Tab Strips 사용 하는 Sample Program [7] file 소주와 막걸리 2009.04.01 8237
78 금액을 한글로(수표)표기 [17] file STARFISH 2009.03.17 14646
77 표시 [5] file STARFISH 2009.03.17 7953
76 drop down list boxes에 관한 소스.. [10] file SAP질 중 2009.02.13 8910
75 셀(cell) 레벨의 ALV EDIT(편집) 가능 소스 [5] sapjoy 2008.09.25 17286
74 F4TOOL_F4FUNCTION_BRIDGE 이용한 POSSIBLE ENTRY 만들기. [5] bd 2008.04.22 7357
73 Selection-screen 에 화면 추가 [11] virus 2007.11.29 9941
72 dynmic Internal table을 이용한 alv [3] file sapjoy 2007.11.19 5398
71 Select-Options 의 Extension 에 제한을 주는 방법 [5] icarus 2007.11.15 10839
70 REPORT z_exec_program [4] file 노름마치 2007.11.12 4905
69 REPORT z_sql_tools [5] file 노름마치 2007.11.12 5474
68 REPORT z_dbbrowser [2] file 노름마치 2007.11.05 4575