메뉴 건너뛰기

SAP 한국 커뮤니티

ALV autorefresh 입니다.

eclipse 2008.01.15 09:08 조회 수 : 4955 추천:2

http://www.geocities.com/mpioud/Abap_programs.html에서


http://www.geocities.com/mpioud/Z_ALV_AUTO_REFRESH.html 에서 발췌


 


 


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

번호 제목 글쓴이 날짜 조회 수
208 CLUSTER 테이블 찾는법~~ [4] 첼시 2008.02.28 3862
207 스마트 폼에서 워드를 기본에디터로 설정하는 방법. [8] 혀나미 2008.01.31 5505
206 ABAP_INTEGRATION_GUIDE_22 [1] file kk 2008.01.23 4004
205 ICC_INTEGRATION_GUIDE_22 [1] kk 2008.01.23 3961
204 jco_tutorial-ja_doo [2] file kk 2008.01.23 3204
» ALV autorefresh 입니다. [13] eclipse 2008.01.15 4955
202 경고음 없애는 방법 [8] 도련님 2008.01.11 4434
201 화면에 드롭다운 리스트 박스 추가 하기. ABCD [8] 버즈즈 2008.01.05 5184
200 alv 메뉴만들기.. [9] 버즈즈 2008.01.05 4793
199 ABAP TIP 정리(영문 60페이지) [31] file sapjoy 2008.01.04 4487
198 BAPI_SALESDOCU_CREATEFROMDATA1 판매오더를 이렇게 생성해도 되는군요. [4] 노름마치 2007.12.11 5534
197 BAPI_RESERVATION_CREATE1 MB21의 예약생성시 사용하세요. [2] 노름마치 2007.12.11 7698
196 BAPI_PR_CREATE 구매요청 생성시에 사용하세요. 이렇게도 쓸 수 있군요. [1] 노름마치 2007.12.11 7835
195 BAPI_PR_CREATE 구매요청 생성시에 사용하세요 [2] 노름마치 2007.12.11 23767
194 BAPI_PO_CHANGE 구매오더 변경시에 사용하세요 [7] 노름마치 2007.12.11 5567
193 BAPI_MESSAGE_GETDETAIL 작업결과에 대한 메세지는 이렇게도 보여줄수 있겠군요 [1] 노름마치 2007.12.11 4895
192 BAPI_MATERIAL_SAVEDATA 자재마스터 생성시에 사용하세요. [1] 노름마치 2007.12.11 9437
191 BAPI_MATERIAL_AVAILABILITY 가용성체크시에 사용하세요. [1] 노름마치 2007.12.11 6363
190 BAPI_INCOMINGINVOICE_CREAE 송장처리시에 사용하세요. [1] 노름마치 2007.12.11 4576
189 BAPI_GOODSMVT_CREATE 입고/출고/재고이동시에 사용하세요. [5] 노름마치 2007.12.11 15290