본문 바로가기
ABAP

Pop-up ALV

by clode 2023. 2. 27.
728x90
반응형

버튼 클릭시 ALV 형식의 팝업창을 띄워본다.

DATA 선언

FORM CREATE_ORDER_POPUP .                
  DATA: BEGIN OF LT_POPUP OCCURS 0,                
          AUART LIKE TVAK-AUART,                
          BEZEI     LIKE TVAKT-BEZEI,                
        END OF LT_POPUP.                
  DATA: LT_FCAT TYPE SLIS_T_FIELDCAT_ALV,                
        LS_FCAT TYPE SLIS_FIELDCAT_ALV,                
        LT_EXCL TYPE SLIS_T_EXTAB,                
        LS_EXCL TYPE SLIS_EXTAB,                
        LV_EXIT TYPE C.                

FORM문

  CLEAR: LT_POPUP[], LT_FCAT[], GV_POPUP.

  SELECT TVAK~AUART, TVAKT~BEZEI FROM TVAK
    INNER JOIN TVAKT
    ON TVAK~AUART = TVAKT~AUART
    INTO CORRESPONDING FIELDS OF TABLE @LT_POPUP
    WHERE SPRAS EQ @SY-LANGU.

  SORT LT_POPUP BY AUART DESCENDING.

  LS_FCAT-COL_POS = 1.
  LS_FCAT-FIELDNAME =  'AUART'.
  LS_FCAT-OUTPUTLEN = 10.
  LS_FCAT-SELTEXT_M = '오더 유형'.
  APPEND LS_FCAT TO LT_FCAT.

  LS_FCAT-COL_POS = 2.
  LS_FCAT-FIELDNAME =  'BEZEI'.
  LS_FCAT-OUTPUTLEN = 30.
  LS_FCAT-SELTEXT_M = '오더 유형명'.
  APPEND LS_FCAT TO LT_FCAT.


  CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
    EXPORTING
      I_TITLE               = '오더 유형'
      I_SELECTION           = 'X'
      I_SCREEN_START_COLUMN = 1
      I_SCREEN_START_LINE   = 1
      I_SCREEN_END_COLUMN   = 62
      I_SCREEN_END_LINE     = 10
      I_TABNAME             = 'LT_POPUP'
      IT_FIELDCAT           = LT_FCAT
      IT_EXCLUDING          = LT_EXCL
    IMPORTING
      E_EXIT                = LV_EXIT
    TABLES
      T_OUTTAB              = LT_POPUP.

  IF LV_EXIT IS INITIAL.
    GV_POPUP = LT_POPUP-AUART.
  ENDIF.
ENDFORM.

조회만 할경우엔

  DATA: GO_ALV    TYPE REF TO CL_SALV_TABLE,
        GO_FUNLST TYPE REF TO CL_SALV_FUNCTIONS_LIST.
  DATA: CXROOT TYPE REF TO CX_ROOT,
        EXCMSG TYPE STRING.

  TRY.
      CL_SALV_TABLE=>FACTORY(
      IMPORTING
      R_SALV_TABLE = GO_ALV
      CHANGING
      T_TABLE = LT_POPUP[] ).
    CATCH CX_ROOT INTO CXROOT.
      EXCMSG = CXROOT->GET_TEXT( ).
      MESSAGE E000(OO) WITH EXCMSG.
  ENDTRY.
  GO_FUNLST = GO_ALV->GET_FUNCTIONS( ).
  GO_FUNLST->SET_ALL( 'X' ).
  IF GO_ALV IS BOUND.
    GO_ALV->SET_SCREEN_POPUP(
    START_COLUMN = 10
    END_COLUMN = 110
    START_LINE = 5
    END_LINE = 15 ).
    GO_ALV->DISPLAY( ).
  ENDIF.

외에도
CALL FUNCTION 'POPUP_GET_VALUES'
CALL FUNCTION 'POPUP_GET_VALUES_DB_CHECKED ' "유효성 체크

다양한 팝업펑션이 존재하므로 구글링 해볼것.

참고
https://blog.daum.net/rightvoice/198
https://itpe.me/tag/alv/page/2/

728x90
반응형

'ABAP' 카테고리의 다른 글

MESSAGE  (0) 2023.03.01
ALV Refresh시 Layout 재설정 (SET_FRONTEND_LAYOUT)  (0) 2023.03.01
ALV Standard Add/Delete row Button  (0) 2023.02.24
View Event  (0) 2023.02.24
Parameter List box  (0) 2023.02.24

댓글