메뉴 건너뛰기

SAP 한국 커뮤니티

alv 메뉴만들기..

버즈즈 2008.01.05 03:44 조회 수 : 4793 추천:1

* Global data declaration
INCLUDE VSD11TOP.


* Initialization fieldcatalog
INITIALIZATION.
  G_REPID = SY-REPID.
  PERFORM FIELDCAT_INIT USING GT_FIELDCAT[].


* Data selection
START-OF-SELECTION.
  PERFORM SELECT_DATA TABLES GT_OUTTAB.


* Display list
END-OF-SELECTION.


* Set options: Save variants userspecific or general
* A = U & X, U = userspecific, X = general user
  G_SAVE = 'A'.
  PERFORM VARIANT_INIT.
  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
            I_CALLBACK_PROGRAM       = G_REPID
            I_CALLBACK_PF_STATUS_SET = G_STATUS
            I_CALLBACK_USER_COMMAND  = G_USER_COMMAND
            I_SAVE                   = G_SAVE
            IS_VARIANT               = G_VARIANT
            IT_FIELDCAT              = GT_FIELDCAT[]
       TABLES
            T_OUTTAB                 = GT_OUTTAB.


*-----------------------------------------------------------------------
*    FORM PF_STATUS_SET
*-----------------------------------------------------------------------
FORM STANDARD_02 USING  EXTAB TYPE SLIS_T_EXTAB.
  SET PF-STATUS 'STANDA02' EXCLUDING EXTAB.
ENDFORM.


*-----------------------------------------------------------------------
*    FORMS
*-----------------------------------------------------------------------


* Initialization fieldcatalog


FORM FIELDCAT_INIT
      USING RT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
  DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.


  CLEAR LS_FIELDCAT.
  LS_FIELDCAT-TABNAME       = G_TABNAME.
  LS_FIELDCAT-FIELDNAME     = 'CARRID'.
  LS_FIELDCAT-KEY           = 'X'.     "sets key field
  APPEND LS_FIELDCAT TO  RT_FIELDCAT.


  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
            I_PROGRAM_NAME         = G_REPID
            I_INTERNAL_TABNAME     = G_TABNAME
            I_STRUCTURE_NAME       = 'SIMLISTRUC'
            I_CLIENT_NEVER_DISPLAY = 'X'
       CHANGING
            CT_FIELDCAT            = RT_FIELDCAT.
ENDFORM.                               "fieldcat_init



* Data selection
FORM SELECT_DATA
      TABLES RT_OUTTAB LIKE GT_OUTTAB[].
  SELECT DISTINCT SCARR~CARRID SCARR~CARRNAME
                  SPFLI~CONNID SPFLI~CITYFROM
                  SPFLI~AIRPFROM SPFLI~CITYTO
                  SPFLI~AIRPTO SPFLI~DEPTIME
                  SPFLI~ARRTIME SPFLI~DISTANCE
                  SPFLI~DISTID
         INTO    (RT_OUTTAB-CARRID, RT_OUTTAB-CARRNAME,
                  RT_OUTTAB-CONNID, RT_OUTTAB-CITYFROM,
                  RT_OUTTAB-AIRPFROM, RT_OUTTAB-CITYTO,
                  RT_OUTTAB-AIRPTO, RT_OUTTAB-DEPTIME,
                  RT_OUTTAB-ARRTIME, RT_OUTTAB-DISTANCE,
                  RT_OUTTAB-DISTID)
                  FROM SCARR INNER JOIN SPFLI
                  ON SCARR~CARRID = SPFLI~CARRID
                  WHERE SCARR~CARRID BETWEEN 'AA' AND 'LH'.
    APPEND RT_OUTTAB.
  ENDSELECT.
ENDFORM.
*---------------------------------------------------------------------*
*       FORM USER_COMMAND                                             *
*---------------------------------------------------------------------*
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
                  RS_SELFIELD TYPE SLIS_SELFIELD.
  DATA: L_TA TYPE SY-TCODE VALUE 'SLIS_DUMMY'.
*
  CASE R_UCOMM.
    WHEN  'WAHL'.                      "menubutton
      READ TABLE GT_OUTTAB INDEX RS_SELFIELD-TABINDEX. "cursorposit.
      IF SY-SUBRC = 0.
        SUBMIT SLIS_DUMMY WITH P_CARRID EQ GT_OUTTAB-CARRID
                          WITH P_CONNID EQ GT_OUTTAB-CONNID.
      ENDIF.
      CLEAR R_UCOMM.
    WHEN '&IC1'.                       "doubleclick
      READ TABLE GT_OUTTAB INTO GT_OUTTAB INDEX RS_SELFIELD-TABINDEX.
      IF SY-SUBRC = 0.
        SUBMIT SLIS_DUMMY WITH P_CARRID EQ GT_OUTTAB-CARRID
                          WITH P_CONNID EQ GT_OUTTAB-CONNID.
      ENDIF.
      CLEAR R_UCOMM.
  ENDCASE.
ENDFORM.
*&---------------------------------------------------------------------*
*&      Form  VARIANT_INIT
*&---------------------------------------------------------------------*
FORM VARIANT_INIT.
  CLEAR G_VARIANT.
  G_VARIANT-REPORT = G_REPID.
ENDFORM.                               " VARIANT_INIT

번호 제목 글쓴이 날짜 조회 수
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
203 ALV autorefresh 입니다. [13] eclipse 2008.01.15 4955
202 경고음 없애는 방법 [8] 도련님 2008.01.11 4434
201 화면에 드롭다운 리스트 박스 추가 하기. ABCD [8] 버즈즈 2008.01.05 5184
» 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