제가 처음 ALV를 접했을 때,
LAYOUT에 CUSTOM 박스 그려넣고,
CREATE custom container해서..만드는 방식으로 배웠고, 쭉 그렇게 써왔습니다.
그런데 DIALOG container를 선언 후 사용하면,
layout에 박스를 그리지 않아도 되고, create object하지 않아도 자동설정(?)이 된다고......
맞는건가요?
그렇다면 layout설정 및 fieldcat설정같은 나머지부분은 custom쓸때와 똑같이 하는건가요?
slis에서 예제문 찾으려고 해도...뒤죽박죽 찾아서 그런지 여간 나오질 않네요;;
거진 custom이구. ㅠ
간략한 사용설명 좀 부탁드립니다.
댓글 5
-
activeman
2008.04.11 01:54
-
할일없는무급개발자
2008.04.11 02:34
* -------------------선언
* ALV CONTROL
* -------------------
CLASS LCL_EVENT_RECEIVER DEFINITION DEFERRED.
DATA:
G_GRID TYPE REF TO CL_GUI_ALV_GRID,
* g_custom_9010 TYPE REF TO cl_gui_custom_container.
DIALOGBOX_CONTAINER TYPE REF TO CL_GUI_DIALOGBOX_CONTAINER,
EVENT_RECEIVER TYPE REF TO LCL_EVENT_RECEIVER.
DATA : L_INDEX TYPE I,
L_REPID LIKE SY-REPID.
DATA: L_POS TYPE I VALUE 0.
** 클래스 이용 ALV.
DATA: LS_VARIANT LIKE DISVARIANT,
LS_LAYOUTCAT TYPE LVC_S_LAYO,
LS_FIELDCAT TYPE LVC_S_FCAT,
LT_FIELDCAT TYPE LVC_T_FCAT,
LS_SORTCAT TYPE LVC_S_SORT,
LT_SORTCAT TYPE LVC_T_SORT,
LS_PRINTCAT TYPE LVC_S_PRNT.
****************************************************************
* LOCAL CLASSES: Definition
****************************************************************
CLASS LCL_EVENT_RECEIVER DEFINITION.
PUBLIC SECTION.
METHODS:
HANDLE_CLOSE
FOR EVENT CLOSE OF CL_GUI_DIALOGBOX_CONTAINER
IMPORTING SENDER.
PRIVATE SECTION.
DATA: DIALOGBOX_STATUS TYPE C. "'X': does exist, SPACE: does not ex.
ENDCLASS. "lcl_event_receiver DEFINITION
****************************************************************
* LOCAL CLASSES: Implementation
****************************************************************
CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
METHOD HANDLE_CLOSE.
CALL METHOD SENDER->SET_VISIBLE
EXPORTING
VISIBLE = SPACE.
ENDMETHOD. "handle_close
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
-
할일없는무급개발자
2008.04.11 02:35
*이벤트?
CREATE OBJECT DIALOGBOX_CONTAINER
EXPORTING
TOP = 150
LEFT = 150
LIFETIME = CNTL_LIFETIME_DYNPRO
CAPTION = '세부사항'
WIDTH = 590
HEIGHT = 200.
CREATE OBJECT G_GRID
EXPORTING I_PARENT = DIALOGBOX_CONTAINER.
* BUILD VARIANT.
PERFORM ALV_BUILD_VARI. "ALV VARI.
* BUILD FIELDCAT.
PERFORM ALV_BUILD_FIELDCAT. "ALV FIELDCAT.
* BUILD SORTCAT.
PERFORM ALV_BUILD_SORTCAT. "ALV SORT CATLG.
* LAYOUT MAKE.
PERFORM ALV_LAYOUT_MAKE. "ALV LAYOUT MAKE.
* PRINT SETTING
PERFORM ALV_PRINT_SETTING. "ALV PRINT SETTING.
*..... Show table on ALV Control
CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'WA_CLICK'
IS_VARIANT = LS_VARIANT
I_SAVE = 'A'
I_DEFAULT = 'X'
IS_LAYOUT = LS_LAYOUTCAT
* is_print = LS_PRINTCAT
CHANGING
IT_FIELDCATALOG = LT_FIELDCAT
IT_SORT = LT_SORTCAT
IT_OUTTAB = GT_CLICK[].
* --> Create Object to receive events and link them to handler methods.
CREATE OBJECT EVENT_RECEIVER.
SET HANDLER EVENT_RECEIVER->HANDLE_CLOSE FOR DIALOGBOX_CONTAINER.
CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
EXPORTING
CONTROL = G_GRID.
*&---------------------------------------------------------------------*
*& Form ALV_BUILD_VARI
*&---------------------------------------------------------------------*
FORM ALV_BUILD_VARI .
LS_VARIANT-REPORT = SY-REPID.
LS_VARIANT-HANDLE = SPACE.
LS_VARIANT-LOG_GROUP = SPACE.
LS_VARIANT-USERNAME = SPACE.
LS_VARIANT-VARIANT = SPACE.
LS_VARIANT-TEXT = SPACE.
LS_VARIANT-DEPENDVARS = SPACE.
ENDFORM. " ALV_BUILD_VARI
*&---------------------------------------------------------------------*
*& Form ALV_BUILD_FIELDCAT
*&---------------------------------------------------------------------*
FORM ALV_BUILD_FIELDCAT .
REFRESH: LT_FIELDCAT.
CLEAR: L_POS.
"금액
PERFORM CAT_INFO_ALV USING:
'필드이름' '필드텍스트' '싸이즈'.
ENDFORM. " ALV_BUILD_FIELDCAT
*&---------------------------------------------------------------------*
*& Form ALV_BUILD_SORTCAT
*&---------------------------------------------------------------------*
FORM ALV_BUILD_SORTCAT .
REFRESH: LT_SORTCAT.
CLEAR LS_SORTCAT.
LS_SORTCAT-SPOS = '1'.
LS_SORTCAT-FIELDNAME = ' '.
LS_SORTCAT-GROUP = SPACE.
LS_SORTCAT-UP = 'X'.
LS_SORTCAT-DOWN = SPACE.
* LS_SORTCAT-subtot = space.
APPEND LS_SORTCAT TO LT_SORTCAT.
CLEAR LS_SORTCAT.
LS_SORTCAT-SPOS = '2'.
LS_SORTCAT-FIELDNAME = ' '.
LS_SORTCAT-GROUP = SPACE.
LS_SORTCAT-UP = 'X'.
LS_SORTCAT-DOWN = SPACE.
* LS_SORTCAT-subtot = space.
APPEND LS_SORTCAT TO LT_SORTCAT.
ENDFORM. " ALV_BUILD_SORTCAT
*&---------------------------------------------------------------------*
*& Form ALV_LAYOUT_MAKE
*&---------------------------------------------------------------------*
FORM ALV_LAYOUT_MAKE .
* ... ALV-Control: Allgemeine Anzeigeoptionen
LS_LAYOUTCAT-STYLEFNAME = SPACE.
* LS_LAYOUTCAT-CWIDTH_OPT = 'X'.
LS_LAYOUTCAT-ZEBRA = SPACE.
LS_LAYOUTCAT-SMALLTITLE = 'X'.
LS_LAYOUTCAT-GRAPHICS = SPACE.
LS_LAYOUTCAT-FRONTEND = 'X'.
LS_LAYOUTCAT-TEMPLATE = SPACE.
* ... ALV-Control: Gridcustomizing
LS_LAYOUTCAT-NO_COLEXPD = SPACE.
LS_LAYOUTCAT-NO_HGRIDLN = SPACE.
LS_LAYOUTCAT-NO_VGRIDLN = SPACE.
LS_LAYOUTCAT-NO_ROWMARK = SPACE.
LS_LAYOUTCAT-NO_HEADERS = SPACE.
LS_LAYOUTCAT-NO_MERGING = SPACE.
LS_LAYOUTCAT-GRID_TITLE = SPACE.
LS_LAYOUTCAT-NO_TOOLBAR = SPACE.
LS_LAYOUTCAT-SEL_MODE = 'D'.
* LS_LAYOUTCAT-box_fname = 'BOX'.
LS_LAYOUTCAT-SGL_CLK_HD = SPACE.
* ... ALV-Control: Summenoptionen
LS_LAYOUTCAT-TOTALS_BEF = SPACE.
LS_LAYOUTCAT-NO_TOTLINE = SPACE.
LS_LAYOUTCAT-NUMC_TOTAL = SPACE.
LS_LAYOUTCAT-NO_UTSPLIT = SPACE.
* ... ALV-Control: Exceptions
* LS_LAYOUTCAT-excp_group = gs_test-excp_group.
* LS_LAYOUTCAT-excp_fname = 'LIGHTS'.
* LS_LAYOUTCAT-excp_rolln = space.
* LS_LAYOUTCAT-excp_conds = gs_test-excp_condense.
* LS_LAYOUTCAT-excp_led = gs_test-excp_led.
* ... ALV-Control: Steuerung Interaktion
LS_LAYOUTCAT-DETAILINIT = SPACE.
LS_LAYOUTCAT-DETAILTITL = SPACE.
LS_LAYOUTCAT-KEYHOT = SPACE.
LS_LAYOUTCAT-NO_KEYFIX = SPACE.
LS_LAYOUTCAT-NO_AUTHOR = SPACE.
CLEAR LS_LAYOUTCAT-S_DRAGDROP.
* ... ALV-Control: Farben
LS_LAYOUTCAT-INFO_FNAME = 'LINE_COLOR'.
* LS_LAYOUTCAT-ctab_fname = 'CELLCOLOR'. "COLOR_CELL
LS_LAYOUTCAT-CTAB_FNAME = SPACE. "space.
* ... ALV-Control: Eingabef?igkeit
LS_LAYOUTCAT-EDIT = SPACE.
LS_LAYOUTCAT-EDIT_MODE = 'A'.
LS_LAYOUTCAT-NO_ROWINS = SPACE.
LS_LAYOUTCAT-NO_ROWMOVE = SPACE.
* ... ALV-Control: Web-Optionen
LS_LAYOUTCAT-WEBLOOK = SPACE.
LS_LAYOUTCAT-WEBSTYLE = SPACE.
LS_LAYOUTCAT-WEBROWS = SPACE.
LS_LAYOUTCAT-WEBXWIDTH = SPACE.
LS_LAYOUTCAT-WEBXHEIGHT = SPACE.
ENDFORM. " ALV_LAYOUT_MAKE
*&---------------------------------------------------------------------*
*& Form ALV_PRINT_SETTING
*&---------------------------------------------------------------------*
FORM ALV_PRINT_SETTING .
LS_PRINTCAT-GRPCHGEDIT = 'X'.
ENDFORM. " ALV_PRINT_SETTING
*&---------------------------------------------------------------------*
*& Form CAT_INFO_ALV1_1100
*&---------------------------------------------------------------------*
FORM CAT_INFO_ALV USING P_FIELDNAME
P_DDTEXT
P_OUTPUTLEN.
L_POS = L_POS + 1.
CLEAR: LS_FIELDCAT.
LS_FIELDCAT-COL_POS = L_POS.
* --> DATA TABLE & FIELD
LS_FIELDCAT-TABNAME = 'ITAB이름'.
LS_FIELDCAT-FIELDNAME = P_FIELDNAME.
LS_FIELDCAT-COLTEXT = P_DDTEXT.
LS_FIELDCAT-OUTPUTLEN = P_OUTPUTLEN.
* 각종조건
APPEND LS_FIELDCAT TO LT_FIELDCAT.
ENDFORM. " CAT_INFO_ALV1_1100
-
할일없는무급개발자
2008.04.11 02:36
예제 프로그램 BCALV_GRID_02
-
다급
2008.04.14 17:58
감사합니다..^^
예제가 있네요..
se80->environment->examples->controls examples에서 container controls의 맨끝에 있네요..
즐밥하세요..