*&---------------------------------------------------------------------*
*& Include YABAP18_TEMP_C01
*&---------------------------------------------------------------------*
*----------------------------------------------------------------------*
* LOCAL CLASSES: Definition
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
* Alv Defines
*----------------------------------------------------------------------*
** Container & Grid.
CLASS : LCL_APP_EVENT DEFINITION DEFERRED.
DATA : G_DOCKING_CONTAINER_100 TYPE REF TO CL_GUI_DOCKING_CONTAINER,
G_GRID_100 TYPE REF TO CL_GUI_ALV_GRID,
G_SPLIT TYPE REF TO CL_GUI_EASY_SPLITTER_CONTAINER, "Splitter
G_TOP_CONTAINER TYPE REF TO CL_GUI_CONTAINER, "Top Container
G_BOTTOM_CONTAINER TYPE REF TO CL_GUI_CONTAINER, "Bottom Container
G_DOCUMENT TYPE REF TO CL_DD_DOCUMENT, "Document
G_EVENT_ALL TYPE REF TO LCL_APP_EVENT.
** Alv Parameter
DATA : GS_VARIANT_100 TYPE DISVARIANT VALUE SY-REPID,
GS_LAYOUT_100 TYPE LVC_S_LAYO,
GT_FCAT_100 TYPE LVC_T_FCAT,
GT_SORT_100 TYPE LVC_T_SORT,
GT_TOOLBAR_EXCLUDING_100 TYPE UI_FUNCTIONS,
GS_STBL TYPE LVC_S_STBL VALUE 'XX'.
DATA: G_CUSTOM_CONTAINER_200 TYPE REF TO CL_GUI_CUSTOM_CONTAINER ,
G_GRID_200 TYPE REF TO CL_GUI_ALV_GRID,
GS_LAYOUT_200 TYPE LVC_S_LAYO,
GS_VARIANT_200 TYPE DISVARIANT,
GT_FCAT_200 TYPE LVC_T_FCAT,
GT_SORT_200 TYPE LVC_T_SORT.
* GT_TOOLBAR_EXCLUDING_200 TYPE UI_FUNCTIONS,
DATA : GV_UCOMM TYPE SY-UCOMM, "SY-UCOMM
GV_STATUSA TYPE SMP_DYNTXT.
*-- about ALV Line
DATA : GT_ROW_NO TYPE LVC_T_ROID,
GS_ROW_NO TYPE LVC_S_ROID.
DATA : GT_ROW_NO_200 TYPE LVC_T_ROID,
GS_ROW_NO_200 TYPE LVC_S_ROID.
DATA: GV_REPID LIKE SY-CPROG.
*-- 색깔넣기
DATA: GT_ALV_COLOR TYPE LVC_T_SCOL,
GS_ALV_COLOR TYPE LVC_S_SCOL.
*----------------------------------------------------------------------*
* Contants 'Prefix all constants with CO_'
*----------------------------------------------------------------------*
CONSTANTS : CO_STYLE TYPE SDYDO_ATTRIBUTE VALUE 'ALV_GRID',
CO_JUST_C TYPE CHAR1 VALUE 'C'.
*----------------------------------------------------------------------*
* Field Symbols
*----------------------------------------------------------------------*
FIELD-SYMBOLS <GFS_FCAT> TYPE LVC_S_FCAT.
*----------------------------------------------------------------------*
* Define Macro
*----------------------------------------------------------------------*
** Fieldcatalog Text Macro
DEFINE TEXT.
<GFS_FCAT>-SCRTEXT_L = &1.
<GFS_FCAT>-SCRTEXT_M = &1.
<GFS_FCAT>-SCRTEXT_S = &1.
<GFS_FCAT>-REPTEXT = &1.
END-OF-DEFINITION.
*----------------------------------------------------------------------*
* CLASS LCL_APP_EVENT DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS LCL_APP_EVENT DEFINITION.
PUBLIC SECTION.
DATA: G_OBJECT_TEXT TYPE CHAR30.
METHODS: CONSTRUCTOR
IMPORTING E_OBJECT_TEXT TYPE C.
METHODS: HANDLE_TOOLBAR
FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
IMPORTING E_OBJECT
E_INTERACTIVE.
METHODS: HANDLE_USER_COMMAND
FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID
IMPORTING E_UCOMM.
METHODS: HANDLE_DATA_CHANGED
FOR EVENT DATA_CHANGED OF CL_GUI_ALV_GRID
IMPORTING ER_DATA_CHANGED E_UCOMM.
METHODS HANDLE_HOTSPOT_CLICK
FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW_ID E_COLUMN_ID.
METHODS: HANDLE_DOUBLE_CLICK
FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW
E_COLUMN.
METHODS HANDLE_ON_F4
FOR EVENT ONF4 OF CL_GUI_ALV_GRID
IMPORTING SENDER
E_FIELDNAME
E_FIELDVALUE
ES_ROW_NO
ER_EVENT_DATA
ET_BAD_CELLS
E_DISPLAY.
ENDCLASS. "LCL_APP_EVENT
*----------------------------------------------------------------------*
* CLASS LCL_APP_EVENT IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS LCL_APP_EVENT IMPLEMENTATION.
METHOD CONSTRUCTOR.
CALL METHOD SUPER->CONSTRUCTOR.
G_OBJECT_TEXT = E_OBJECT_TEXT.
ENDMETHOD. "constructor
METHOD HANDLE_TOOLBAR.
PERFORM ALV_TOOLBAR USING G_OBJECT_TEXT
E_OBJECT
E_INTERACTIVE.
ENDMETHOD. "handle_toolbar
METHOD HANDLE_USER_COMMAND.
PERFORM ALV_USER_COMMAND USING G_OBJECT_TEXT
E_UCOMM.
ENDMETHOD. "HANDLE_USER_COMMAND
METHOD HANDLE_DATA_CHANGED.
PERFORM DATA_CHANGE USING G_OBJECT_TEXT
ER_DATA_CHANGED.
ENDMETHOD. "DATA_CHANGE
METHOD HANDLE_HOTSPOT_CLICK.
PERFORM HOTSPOT_CLICK USING E_ROW_ID E_COLUMN_ID.
ENDMETHOD. "HANDLE_HOTSPOT_CLICK
METHOD HANDLE_DOUBLE_CLICK.
PERFORM HANDLE_DOUBLE_CLICK USING E_ROW
E_COLUMN.
ENDMETHOD. "HANDLE_DOUBLE_CLICK
METHOD HANDLE_ON_F4.
PERFORM ON_F4 USING SENDER
E_FIELDNAME
E_FIELDVALUE
ES_ROW_NO
ER_EVENT_DATA
ET_BAD_CELLS
E_DISPLAY.
ENDMETHOD. "HANDLE_ON_F4
ENDCLASS. "LCL_APP_EVENT
*&---------------------------------------------------------------------*
*& Form ALV_USER_COMMAND
*&---------------------------------------------------------------------*
FORM ALV_USER_COMMAND USING P_GRID_NAME
E_UCOMM LIKE SY-UCOMM.
CASE P_GRID_NAME.
WHEN 'G_GRID_100'.
PERFORM ALV_USER_CMD_0 USING E_UCOMM.
ENDCASE.
ENDFORM. " ALV_USER_COMMAND
*&---------------------------------------------------------------------*
*& Form ALV_USER_CMD_0
*&---------------------------------------------------------------------*
FORM ALV_USER_CMD_0 USING E_UCOMM LIKE SY-UCOMM.
CASE E_UCOMM.
WHEN 'TOT_CNT'.
PERFORM ALV_USER_CMD_FILTER USING G_GRID_100 GT_FCAT_100[] '' ''.
* WHEN 'SELA'.
* PERFORM ALV_SET_SEL_ROW_ALL USING G_GRID_100 GT_OUTTAB[] 'X'.
*
* WHEN 'SELD'.
* PERFORM ALV_SET_SEL_ROW_ALL USING G_GRID_100 GT_OUTTAB[] ' '.
WHEN 'INSE'.
PERFORM ALV_USER_CMD_0_INSE USING G_GRID_100 GT_FCAT_100[].
ENDCASE.
ENDFORM. " ALV_USER_CMD_0
*&---------------------------------------------------------------------*
*& Form ALV_USER_CMD_FILTER
*&---------------------------------------------------------------------*
FORM ALV_USER_CMD_FILTER USING PO_GRID TYPE REF TO CL_GUI_ALV_GRID
PT_FCAT TYPE LVC_T_FCAT
P_FNAME
P_VAL. "EQ_INITIAL, NE_INITIAL
DATA: LT_FILTER TYPE LVC_T_FILT WITH HEADER LINE.
CALL METHOD PO_GRID->GET_FILTER_CRITERIA
IMPORTING
ET_FILTER = LT_FILTER[].
IF P_FNAME IS INITIAL.
CLEAR LT_FILTER[].
ELSE.
DELETE LT_FILTER WHERE FIELDNAME = P_FNAME.
ENDIF.
IF P_FNAME IS NOT INITIAL.
CASE P_VAL.
WHEN 'EQ_INITIAL'.
CLEAR: LT_FILTER.
LT_FILTER-FIELDNAME = P_FNAME.
LT_FILTER-SIGN = 'I'.
LT_FILTER-OPTION = 'EQ'.
APPEND LT_FILTER.
WHEN 'NE_INITIAL'.
CLEAR: LT_FILTER.
LT_FILTER-FIELDNAME = P_FNAME.
LT_FILTER-SIGN = 'I'.
LT_FILTER-OPTION = 'NE'.
APPEND LT_FILTER.
WHEN OTHERS.
CLEAR: LT_FILTER.
LT_FILTER-FIELDNAME = P_FNAME.
LT_FILTER-SIGN = 'I'.
LT_FILTER-OPTION = 'EQ'.
LT_FILTER-LOW = P_VAL.
APPEND LT_FILTER.
ENDCASE.
ENDIF.
CALL METHOD PO_GRID->SET_FILTER_CRITERIA
EXPORTING
IT_FILTER = LT_FILTER[]
EXCEPTIONS
NO_FIELDCATALOG_AVAILABLE = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
PERFORM ALV_REFRESH USING PO_GRID PT_FCAT[] 'A'.
ENDFORM. " ALV_USER_CMD_FILTER
*&---------------------------------------------------------------------*
*& Form ALV_USER_CMD_0_INSE
*&---------------------------------------------------------------------*
FORM ALV_USER_CMD_0_INSE USING PO_GRID TYPE REF TO CL_GUI_ALV_GRID
PT_FCAT TYPE LVC_T_FCAT.
DATA: L_ROW TYPE I,
L_COL(30).
PERFORM ALV_GET_CURSOR USING PO_GRID
CHANGING L_ROW L_COL.
L_ROW = L_ROW + 1.
CLEAR: GT_OUTTAB.
*
* GT_M-RCOMP = PM_RCOMP.
* GT_M-INSGB = 'X'.
*
INSERT GT_OUTTAB INDEX L_ROW.
*
* G_MODI_0100 = 'X'.
*
* PERFORM ALV_CELL_EDIT_0100 TABLES PT_FCAT GT_M.
PERFORM ALV_REFRESH USING PO_GRID PT_FCAT[] 'F'.
ENDFORM. " ALV_USER_CMD_0_INSE
*&---------------------------------------------------------------------*
*& Form ALV_GET_CURSOR
*&---------------------------------------------------------------------*
FORM ALV_GET_CURSOR USING PO_GRID TYPE REF TO CL_GUI_ALV_GRID
CHANGING P_ROW_ID "LVC_S_ROW-INDEX
P_COL_NM. "LVC_S_COL-FIELDNAME
DATA: L_ROW TYPE I,
L_VALUE(255),
L_COL TYPE I,
LS_ROW TYPE LVC_S_ROW,
LS_COL TYPE LVC_S_COL,
LS_ROW_NO TYPE LVC_S_ROID.
CLEAR: P_ROW_ID, P_COL_NM.
CALL METHOD PO_GRID->GET_CURRENT_CELL
IMPORTING
E_ROW = L_ROW
E_VALUE = L_VALUE
E_COL = L_COL
ES_ROW_ID = LS_ROW
ES_COL_ID = LS_COL
ES_ROW_NO = LS_ROW_NO.
IF LS_ROW-ROWTYPE IS INITIAL.
P_ROW_ID = LS_ROW-INDEX.
ENDIF.
P_COL_NM = LS_COL-FIELDNAME.
ENDFORM. " ALV_GET_CURSOR
*&---------------------------------------------------------------------*
*& Form ALV_SET_SEL_ROW_ALL
*&---------------------------------------------------------------------*
FORM ALV_SET_SEL_ROW_ALL USING PO_GRID TYPE REF TO CL_GUI_ALV_GRID
PT_M TYPE STANDARD TABLE
P_SEL_ALL.
DATA: LT_ROW TYPE LVC_T_ROW WITH HEADER LINE.
FIELD-SYMBOLS: <FS_WA> TYPE ANY.
IF P_SEL_ALL = 'X'.
LOOP AT PT_M ASSIGNING <FS_WA>.
LT_ROW-INDEX = SY-TABIX.
APPEND LT_ROW.
ENDLOOP.
ENDIF.
CALL METHOD PO_GRID->SET_SELECTED_ROWS
EXPORTING
IT_INDEX_ROWS = LT_ROW[].
* IT_ROW_NO =
* IS_KEEP_OTHER_SELECTIONS = 'X'.
ENDFORM. " ALV_SET_SEL_ROW_ALL
*&---------------------------------------------------------------------*
*& Form ALV_SET_SEL_ROW
*&---------------------------------------------------------------------*
FORM ALV_SET_SEL_ROW USING PO_GRID TYPE REF TO CL_GUI_ALV_GRID
P_ROW.
DATA: LT_ROW TYPE LVC_T_ROW WITH HEADER LINE.
LT_ROW-INDEX = P_ROW.
APPEND LT_ROW.
CALL METHOD PO_GRID->SET_SELECTED_ROWS
EXPORTING
IT_INDEX_ROWS = LT_ROW[].
* IT_ROW_NO =
* IS_KEEP_OTHER_SELECTIONS = 'X'.
ENDFORM. " ALV_SET_SEL_ROW
*&---------------------------------------------------------------------*
*& Form ALV_TOOLBAR
*&---------------------------------------------------------------------*
* ALV 툴바에 버튼 추가하고자 할 경우
*----------------------------------------------------------------------*
FORM ALV_TOOLBAR USING P_GRID_NAME
E_OBJECT TYPE REF TO CL_ALV_EVENT_TOOLBAR_SET
E_INTERACTIVE.
CASE P_GRID_NAME.
WHEN 'G_GRID_100'.
PERFORM ALV_TOOLBAR_0 USING E_OBJECT.
ENDCASE.
ENDFORM. " ALV_TOOLBAR
*&---------------------------------------------------------------------*
*& Form ALV_TOOLBAR_0
*&---------------------------------------------------------------------*
FORM ALV_TOOLBAR_0 USING E_OBJECT TYPE REF TO CL_ALV_EVENT_TOOLBAR_SET.
DATA: LS_TOOLBAR TYPE STB_BUTTON.
PERFORM ALV_TOOLBAR_SET_CNT USING E_OBJECT
G_GRID_100
GT_OUTTAB[].
* 버튼 삽입
CLEAR LS_TOOLBAR.
LS_TOOLBAR-FUNCTION = '&&SEP90'.
LS_TOOLBAR-BUTN_TYPE = '3'. "분리자
APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
*
* CLEAR LS_TOOLBAR.
* LS_TOOLBAR-FUNCTION = 'R_ONLY'.
* LS_TOOLBAR-ICON = ICON_COMPARE.
* LS_TOOLBAR-TEXT = '배부금액만 보기'.
* LS_TOOLBAR-QUICKINFO = '배부금액만 보기'.
* APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
* CLEAR LS_TOOLBAR.
* LS_TOOLBAR-FUNCTION = '&&SEP90'.
* LS_TOOLBAR-BUTN_TYPE = '3'. "분리자
* INSERT LS_TOOLBAR INTO E_OBJECT->MT_TOOLBAR INDEX 1.
*
* CLEAR LS_TOOLBAR.
* LS_TOOLBAR-FUNCTION = 'SELD'.
* LS_TOOLBAR-ICON = ICON_DESELECT_ALL.
** LS_TOOLBAR-TEXT = 'DeSelect_All'.
* LS_TOOLBAR-QUICKINFO = 'DeSelect_All'.
* INSERT LS_TOOLBAR INTO E_OBJECT->MT_TOOLBAR INDEX 1.
*
* CLEAR LS_TOOLBAR.
* LS_TOOLBAR-FUNCTION = 'INSE'.
* LS_TOOLBAR-ICON = ICON_INSERT_ROW.
* LS_TOOLBAR-TEXT = 'Append'.
* LS_TOOLBAR-QUICKINFO = 'Append Row'.
* INSERT LS_TOOLBAR INTO E_OBJECT->MT_TOOLBAR INDEX 1.
ENDFORM. " ALV_TOOLBAR_0
*&---------------------------------------------------------------------*
*& Form ALV_TOOLBAR_SET_CNT
*&---------------------------------------------------------------------*
FORM ALV_TOOLBAR_SET_CNT USING E_OBJECT TYPE REF TO CL_ALV_EVENT_TOOLBAR_SET
PO_GRID TYPE REF TO CL_GUI_ALV_GRID
PT_IT TYPE STANDARD TABLE.
DATA: LS_TOOLBAR TYPE STB_BUTTON,
LT_FIDX TYPE LVC_T_FIDX,
L_TOT_INT TYPE I,
L_FIL_INT TYPE I,
L_TOT_CNT(10) VALUE '0',
L_FIL_CNT(10) VALUE '0'.
* 건수
DESCRIBE TABLE PT_IT LINES L_TOT_INT. "총건수
* 필터링 건수
CALL METHOD PO_GRID->GET_FILTERED_ENTRIES
IMPORTING
ET_FILTERED_ENTRIES = LT_FIDX.
DESCRIBE TABLE LT_FIDX LINES L_FIL_INT.
* 현재 건수 = 총건수 - 필터링 건수
L_FIL_INT = L_TOT_INT - L_FIL_INT.
WRITE: L_TOT_INT TO L_TOT_CNT,
L_FIL_INT TO L_FIL_CNT.
CONDENSE: L_TOT_CNT NO-GAPS,
L_FIL_CNT NO-GAPS.
* 버튼 추가
CLEAR LS_TOOLBAR.
LS_TOOLBAR-FUNCTION = '&&SEP90'.
LS_TOOLBAR-BUTN_TYPE = '3'. "분리자
APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
CLEAR LS_TOOLBAR.
LS_TOOLBAR-FUNCTION = 'TOT_CNT'.
CONCATENATE '전체:' L_TOT_CNT INTO LS_TOOLBAR-TEXT SEPARATED BY ''.
APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
IF LT_FIDX[] IS NOT INITIAL.
CLEAR LS_TOOLBAR.
LS_TOOLBAR-FUNCTION = 'CUR_CNT'.
CONCATENATE '현재:' L_FIL_CNT INTO LS_TOOLBAR-TEXT SEPARATED BY ''.
APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
ENDIF.
ENDFORM. " ALV_TOOLBAR_SET_CNT
*&---------------------------------------------------------------------*
*& Form DATA_CHANGE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DATA_CHANGE USING P_GRID_NAME
PR_DATA_CHANGED
TYPE REF TO CL_ALV_CHANGED_DATA_PROTOCOL..
CASE P_GRID_NAME.
WHEN 'G_GRID_200'.
PERFORM ALV_DATA_CHANGE_0 USING PR_DATA_CHANGED.
ENDCASE.
ENDFORM. " DATA_CHANGE
*&---------------------------------------------------------------------*
*& Form ALV_DATA_CHANGE_0
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->PR_DATA_CHANGED text
*----------------------------------------------------------------------*
FORM ALV_DATA_CHANGE_0 USING PR_DATA_CHANGED TYPE REF TO CL_ALV_CHANGED_DATA_PROTOCOL.
DATA : LS_MOD_CELLS TYPE LVC_S_MODI,
LT_MOD_CELLS TYPE LVC_T_MODI.
DATA : LV_VALUE TYPE STRING,
LV_FIELD TYPE FIELDNAME,
LV_DATAA TYPE STRING,
LV_DATAB TYPE STRING,
LV_DATAC TYPE STRING.
FIELD-SYMBOLS : <LFS_VALUE> TYPE ANY.
REFRESH: LT_MOD_CELLS.
SORT PR_DATA_CHANGED->MT_GOOD_CELLS BY ROW_ID.
LT_MOD_CELLS[] = PR_DATA_CHANGED->MT_GOOD_CELLS[].
LOOP AT LT_MOD_CELLS INTO LS_MOD_CELLS.
* CLEAR GT_OUTTAB.
* READ TABLE GT_OUTTAB INDEX LS_MOD_CELLS-ROW_ID.
PERFORM ALV_GET_CELL_VALUE USING PR_DATA_CHANGED
LS_MOD_CELLS-ROW_ID
LS_MOD_CELLS-FIELDNAME
CHANGING LV_VALUE.
CASE LS_MOD_CELLS-FIELDNAME.
WHEN 'GSBER'.
* PERFORM GET_GSBER_T USING LV_VALUE
* CHANGING LV_DATAA.
* PERFORM ALV_MODIFY_CELL USING PR_DATA_CHANGED
* LS_MOD_CELLS-ROW_ID
* 'GTEXT'
* LV_DATAA.
ENDCASE.
ENDLOOP.
ENDFORM. "ALV_DATA_CHANGE_0
*&---------------------------------------------------------------------*
*& Form ALV_GET_CELL_VALUE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_PR_DATA_CHANGED text
* -->P_LS_MOD_CELLS_ROW_ID text
* -->P_LS_MOD_CELLS_FIELDNAME text
* <--P_LV_VALUE text
*----------------------------------------------------------------------*
FORM ALV_GET_CELL_VALUE
USING PR_DATA_CHANGED TYPE REF TO CL_ALV_CHANGED_DATA_PROTOCOL
PV_ROW_ID
PV_FIELDNAME
CHANGING PV_VALUE.
CALL METHOD PR_DATA_CHANGED->GET_CELL_VALUE
EXPORTING
I_ROW_ID = PV_ROW_ID
* i_tabix =
I_FIELDNAME = PV_FIELDNAME
IMPORTING
E_VALUE = PV_VALUE.
ENDFORM. " ALV_GET_CELL_VALUE
*&---------------------------------------------------------------------*
*& Form ALV_MODIFY_CELL
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_PR_DATA_CHANGED text
* -->P_LS_MOD_CELLS_ROW_ID text
* -->P_LV_FIELD text
* -->P_<LFS_VALUE> text
*----------------------------------------------------------------------*
FORM ALV_MODIFY_CELL
USING PR_DATA_CHANGED TYPE REF TO CL_ALV_CHANGED_DATA_PROTOCOL
PV_ROW_ID
PV_FIELDNAME
PV_VALUE.
CALL METHOD PR_DATA_CHANGED->MODIFY_CELL
EXPORTING
I_ROW_ID = PV_ROW_ID
* i_tabix =
I_FIELDNAME = PV_FIELDNAME
I_VALUE = PV_VALUE.
ENDFORM. " ALV_MODIFY_CELL
*&---------------------------------------------------------------------*
*& Form HOTSPOT_CLICK
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_E_ROW_ID text
* -->P_E_COLUMN_ID text
*----------------------------------------------------------------------*
FORM HOTSPOT_CLICK USING PS_ROW_ID STRUCTURE LVC_S_ROW
PS_COLUMN_ID STRUCTURE LVC_S_COL.
READ TABLE GT_OUTTAB INDEX PS_ROW_ID-INDEX.
CASE PS_COLUMN_ID-FIELDNAME.
WHEN 'BELNR'.
* IF GT_OUTTAB-BELNR IS NOT INITIAL.
* SET PARAMETER ID 'BLN' FIELD GT_OUTTAB-BELNR.
* SET PARAMETER ID 'BUK' FIELD GT_OUTTAB-BUKRS.
* SET PARAMETER ID 'GJR' FIELD GT_OUTTAB-GJAHR.
* CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
* ENDIF.
* SUBMIT RFGLBALANCE WITH SO_SAKNR-LOW EQ GT_OUTTAB-HKONT
* WITH SO_BUKRS-LOW EQ GT_OUTTAB-BUKRS
* WITH GP_GJAHR EQ S_GJAHR-LOW
* WITH SO_GSBER-LOW IN R_GSBER
* AND RETURN.
ENDCASE.
ENDFORM. " HOTSPOT_CLICK
**&---------------------------------------------------------------------*
**& FORM HANDLE_DOUBLE_CLICK
**&---------------------------------------------------------------------*
** TEXT
**----------------------------------------------------------------------*
** -->P_ROW TEXT
** -->P_COLUMN TEXT
**----------------------------------------------------------------------*
FORM HANDLE_DOUBLE_CLICK USING P_ROW STRUCTURE LVC_S_ROW
P_COLUMN STRUCTURE LVC_S_COL.
* READ TABLE GT_OUTTAB INDEX P_ROW-INDEX.
*
* IF P_COLUMN-FIELDNAME EQ 'KBETR'.
* CHECK GT_OUTTAB-KBETR IS NOT INITIAL.
* SET PARAMETER ID 'MAT' FIELD GT_DATA-MATNR.
* SET PARAMETER ID 'LIF' FIELD GT_DATA-LIFNR_PR.
* SET PARAMETER ID 'ESO' FIELD '0'.
* SET PARAMETER ID 'EKO' FIELD GT_DATA-EKORG.
* SET PARAMETER ID 'WRK' FIELD GT_DATA-WERKS.
* SET PARAMETER ID 'EIB' FIELD SPACE.
* CALL TRANSACTION 'ME13' AND SKIP FIRST SCREEN.
* ENDIF.
ENDFORM. " HANDLE_DOUBLE_CLICK
*&---------------------------------------------------------------------*
*& Form ON_F4
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_SENDER text
* -->P_E_FIELDNAME text
* -->P_E_FIELDVALUE text
* -->P_ES_ROW_NO text
* -->P_ER_EVENT_DATA text
* -->P_ET_BAD_CELLS text
* -->P_E_DISPLAY text
*----------------------------------------------------------------------*
FORM ON_F4 USING P_SENDER
P_FIELDNAME TYPE LVC_FNAME
P_FIELDVALUE TYPE LVC_VALUE
PS_ROW_NO TYPE LVC_S_ROID
PR_EVENT_DATA TYPE REF TO CL_ALV_EVENT_DATA
PT_BAD_CELLS TYPE LVC_T_MODI
P_DISPLAY TYPE CHAR01.
DATA: LS_F4 TYPE DDSHRETVAL,
LT_F4 TYPE TABLE OF DDSHRETVAL,
LS_MODI TYPE LVC_S_MODI,
IT_DYNP LIKE TABLE OF DYNPREAD WITH HEADER LINE,
BEGIN OF LT_MAKTX OCCURS 0,
MATNR TYPE EINA-MATNR,
MAKTX TYPE MAKT-MAKTX,
END OF LT_MAKTX.
FIELD-SYMBOLS: <ITAB> TYPE LVC_T_MODI.
PR_EVENT_DATA->M_EVENT_HANDLED = 'X'.
CASE P_FIELDNAME.
WHEN 'MAKTX'.
*--------------------------------------------------------------------*
* 자재기준의 Info Record에 등록되어있는 공급업체 조회
*-------------------------------------------------------------------*
* DATA: LV_MATNR TYPE MARA-MATNR.
* LV_MATNR = P_FIELDVALUE.
*
* READ TABLE GT_OUTTAB INDEX PS_ROW_NO-ROW_ID.
*
* IF GT_OUTTAB-MAKTX IS NOT INITIAL.
** 데이타조회
* SELECT MATNR MAKTX
* INTO CORRESPONDING FIELDS OF TABLE LT_MAKTX
* FROM MAKT
* WHERE MAKTX EQ GT_OUTTAB-MAKTX
* AND SPRAS EQ SY-LANGU.
*
** SORT LT_EINA BY MATNR LIFNR ERDAT DESCENDING.
** DELETE ADJACENT DUPLICATES FROM LT_EINA.
*
* CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
* EXPORTING
* RETFIELD = 'MATNR'
* DYNPPROG = SY-CPROG
* DYNPNR = SY-DYNNR
* VALUE_ORG = 'S'
** multiple_choice = abap_true
* TABLES
* VALUE_TAB = LT_MAKTX
* RETURN_TAB = LT_F4.
*
* CHECK NOT LT_F4 IS INITIAL.
*
* READ TABLE LT_F4 INDEX 1 INTO LS_F4..
*
* GT_OUTTAB-MAKTX = LS_F4-FIELDVAL.
* MODIFY GT_OUTTAB INDEX PS_ROW_NO-ROW_ID.
*
* PERFORM ALV_REFRESH USING G_GRID_100 GT_FCAT_100[] 'A'.
*
* ENDIF.
WHEN OTHERS.
ENDCASE.
ENDFORM. " ON_F4
*&---------------------------------------------------------------------*
*& Form ALV_SET_ROW_COLOR
*&---------------------------------------------------------------------*
* 더블클릭한 행을 ROW_COLOR = 'C500'. 처리한다. & REFRESH
*----------------------------------------------------------------------*
FORM ALV_SET_ROW_COLOR USING PO_GRID TYPE REF TO CL_GUI_ALV_GRID
PT_FCAT TYPE LVC_T_FCAT
P_TABIX
CHANGING CT_M TYPE STANDARD TABLE.
DATA: L_FNAME(30).
FIELD-SYMBOLS: <LFS_WA> TYPE ANY,
<LFS>.
L_FNAME = 'ROW_COLOR'.
READ TABLE CT_M ASSIGNING <LFS_WA> WITH KEY (L_FNAME) = 'C500'.
IF SY-SUBRC = 0.
ASSIGN COMPONENT L_FNAME OF STRUCTURE <LFS_WA> TO <LFS>.
<LFS> = ''.
MODIFY CT_M FROM <LFS_WA> INDEX SY-TABIX TRANSPORTING (L_FNAME).
ENDIF.
READ TABLE CT_M ASSIGNING <LFS_WA> INDEX P_TABIX.
IF SY-SUBRC = 0.
ASSIGN COMPONENT L_FNAME OF STRUCTURE <LFS_WA> TO <LFS>.
<LFS> = 'C500'.
MODIFY CT_M FROM <LFS_WA> INDEX SY-TABIX TRANSPORTING (L_FNAME).
ENDIF.
PERFORM ALV_REFRESH USING PO_GRID PT_FCAT ''.
ENDFORM. " ALV_SET_ROW_COLOR
*&---------------------------------------------------------------------*
*& Form ALV_SET_NEW_OK_CODE
*&---------------------------------------------------------------------*
* ALV 이벤트 후에 화면 PAI 를 타게 한다.
*----------------------------------------------------------------------*
FORM ALV_SET_NEW_OK_CODE USING P_NEW_OKCD.
CALL METHOD CL_GUI_CFW=>SET_NEW_OK_CODE
EXPORTING
NEW_CODE = P_NEW_OKCD.
ENDFORM. " ALV_SET_NEW_OK_CODE
*&---------------------------------------------------------------------*
*& Form ALV_SET_CURSOR
*&---------------------------------------------------------------------*
FORM ALV_SET_CURSOR USING PO_GRID TYPE REF TO CL_GUI_ALV_GRID
P_ROWID
P_COLNM.
DATA: LS_ROW TYPE LVC_S_ROW,
LS_COL TYPE LVC_S_COL.
LS_ROW-INDEX = P_ROWID.
LS_COL-FIELDNAME = P_COLNM.
* CALL METHOD PO_GRID->SET_SCROLL_INFO_VIA_ID
* EXPORTING
* IS_ROW_INFO = LS_ROW
* IS_COL_INFO = LS_COL.
CALL METHOD PO_GRID->SET_CURRENT_CELL_VIA_ID
EXPORTING
IS_ROW_ID = LS_ROW
IS_COLUMN_ID = LS_COL.
CALL METHOD CL_GUI_ALV_GRID=>SET_FOCUS
EXPORTING
CONTROL = PO_GRID.
ENDFORM. " ALV_SET_CURSOR
************************************************************************
************************************************************************
************************************************************************
************************************************************************
************************************************************************
************************************************************************
************************************************************************
************************************************************************
************************************************************************
************************************************************************
*&---------------------------------------------------------------------*
*& Form CRE_DOCKING_GRID
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM CRE_DOCKING_GRID .
** Create Object Docking Container
CREATE OBJECT G_DOCKING_CONTAINER_100
EXPORTING
REPID = SY-REPID
DYNNR = SY-DYNNR
SIDE = G_DOCKING_CONTAINER_100->DOCK_AT_TOP
EXTENSION = 800.
*** Docking Container Split
* CREATE OBJECT G_SPLIT
* EXPORTING
* PARENT = G_DOCKING_CONTAINER_100
* SASH_POSITION = 5 "Position of Splitter Bar (in Percent)
* WITH_BORDER = 0. "With Border = 1 Without Border = 0
*
*** Docking Container 위치 [ Top and Body ]
* G_TOP_CONTAINER = G_SPLIT->TOP_LEFT_CONTAINER .
* G_BOTTOM_CONTAINER = G_SPLIT->BOTTOM_RIGHT_CONTAINER .
** Create Object GRID
CREATE OBJECT G_GRID_100
EXPORTING
I_PARENT = G_DOCKING_CONTAINER_100.
ENDFORM. " CRE_DOCKING_CONTAINER
*&---------------------------------------------------------------------*
*& Form CREATE_container_OBJECT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->PO_CUSTOM_CONTAINER text
*----------------------------------------------------------------------*
FORM CREATE_CONTAINER_OBJECT USING PO_CUSTOM_CONTAINER
TYPE REF TO CL_GUI_CUSTOM_CONTAINER
PV_CONTAINER_NAME TYPE SCRFNAME.
*"create container for TOP OF PAGE
CREATE OBJECT PO_CUSTOM_CONTAINER
EXPORTING
CONTAINER_NAME = PV_CONTAINER_NAME
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5.
ENDFORM. " CREATE_CONTAINER_OBJECT
*&---------------------------------------------------------------------*
*& Form CREATE_container_OBJECT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->PO_CUSTOM_CONTAINER text
*----------------------------------------------------------------------*
FORM CREATE_SPLITTER_CON_OBJECT USING PO_SPLITTER_CONTAINER
TYPE REF TO CL_GUI_SPLITTER_CONTAINER
PO_CUSTOM_CONTAINER
TYPE REF TO CL_GUI_CUSTOM_CONTAINER
PV_ROWS
PV_COLUMNS.
*"create container for TOP OF PAGE
CREATE OBJECT PO_SPLITTER_CONTAINER
EXPORTING
PARENT = PO_CUSTOM_CONTAINER
ROWS = PV_ROWS
COLUMNS = PV_COLUMNS.
ENDFORM. " CREATE_CONTAINER_OBJECT
*&---------------------------------------------------------------------*
*& Form CREATE_GRID_DOC_PARENT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_GO_ALV_GRID1 text
* -->P_GO_DOCK_BOT0100 text
*----------------------------------------------------------------------*
FORM CREATE_GRID_CUST_PARENT USING PO_ALV_GRID
TYPE REF TO CL_GUI_ALV_GRID
PO_CUST_CONTAINER
TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
*" create alv Grid Item
CREATE OBJECT PO_ALV_GRID
EXPORTING
I_PARENT = PO_CUST_CONTAINER.
ENDFORM. " CREATE_GRID_DOC_PARENT
*&---------------------------------------------------------------------*
*& Form CREATE_GRID_split_PARENT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->PO_ALV_GRID text
* -->PO_CUST_CONTAINER text
*----------------------------------------------------------------------*
FORM CREATE_GRID_SPLIT_PARENT USING PO_ALV_GRID
TYPE REF TO CL_GUI_ALV_GRID
PO_CONTAINER
TYPE REF TO CL_GUI_CONTAINER.
*" create alv Grid Item
CREATE OBJECT PO_ALV_GRID
EXPORTING
I_PARENT = PO_CONTAINER.
ENDFORM. " CREATE_GRID_DOC_PARENT
*&---------------------------------------------------------------------*
*& Form CRE_TOP_OF_PAGE_DOC
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM CRE_DOCUMENT_FILLDATA .
* CREATE OBJECT G_DOCUMENT
* EXPORTING
* STYLE = CO_STYLE.
PERFORM TOP_OF_PAGE_CHECK.
ENDFORM. " CRE_TOP_OF_PAGE_DOC
*&---------------------------------------------------------------------*
*& Form SET_FCAT_100
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM SET_FCAT_100.
PERFORM ALV_FIELDCAT_MERGE TABLES GT_OUTTAB GT_FCAT_100
USING 'GT_OUTTAB'.
** Internal Table 'Modify' 생략을 위한 Field-symbols 처리.
LOOP AT GT_FCAT_100 ASSIGNING <GFS_FCAT>.
<GFS_FCAT>-JUST = 'C'.
<GFS_FCAT>-COL_OPT = 'X'.
CASE <GFS_FCAT>-FIELDNAME.
* WHEN 'CHECK'.
* <GFS_FCAT>-COLTEXT = '선택'. ""CHECK
* <GFS_FCAT>-CHECKBOX = 'X'.
* <GFS_FCAT>-JUST = 'C'.
* <GFS_FCAT>-COL_POS = 1.
* <GFS_FCAT>-EDIT = 'X'.
* <GFS_FCAT>-COL_OPT = ''.
* <GFS_FCAT>-OUTPUTLEN = 5.
WHEN 'KOKRS'.
* <GFS_FCAT>-EDIT = CO_X.
<GFS_FCAT>-JUST = 'C'.
WHEN 'BUKRS'.
* <GFS_FCAT>-EDIT = CO_X.
<GFS_FCAT>-JUST = 'C'.
WHEN 'GBCAT'.
* <GFS_FCAT>-EDIT = CO_X.
<GFS_FCAT>-JUST = 'C'.
WHEN 'DATBI'.
* <GFS_FCAT>-EDIT = CO_X.
<GFS_FCAT>-JUST = 'C'.
WHEN 'DATAB'.
* <GFS_FCAT>-EDIT = CO_X.
<GFS_FCAT>-JUST = 'C'.
WHEN 'ZGBCAT'.
<GFS_FCAT>-JUST = 'C'.
* <GFS_FCAT>-EDIT = CO_X.
WHEN 'ZGBCDT'.
* <GFS_FCAT>-EDIT = CO_X.
WHEN 'ERDAT'.
<GFS_FCAT>-TECH = CO_X.
WHEN 'ERZET'.
<GFS_FCAT>-TECH = CO_X.
WHEN 'ERNAM'.
<GFS_FCAT>-TECH = CO_X.
WHEN 'AEDAT'.
<GFS_FCAT>-TECH = CO_X.
WHEN 'AEZET'.
<GFS_FCAT>-TECH = CO_X.
WHEN 'AENAM'.
<GFS_FCAT>-TECH = CO_X.
WHEN OTHERS.
<GFS_FCAT>-TECH = CO_X.
ENDCASE.
ENDLOOP.
* 그외 파라미터들
* <GFS_FCAT>-COLTEXT = 'FIELD TEXT' "필드 텍스트.
* <GFS_FCAT>-KEY = ''. "키로 지정하면 색깔이 생기고 자동고정도 된다.
* <GFS_FCAT>-EDIT = 'X'. "해당 필드를 수정 가능하게 할수 있다.
* <GFS_FCAT>-DO_SUM = 'X'. " 'X'=Sum , 'C'=평균값
* <GFS_FCAT>-NO_ZERO = 'X'. "0인 값은 표시안함
* <GFS_FCAT>-OUTPUTLEN = '3'. "길이를 한정하고플때 (PT_FCAT-COL_OPT = ''.)
* <GFS_FCAT>-CURRENCY = 'KRW'. "전체 칼럼에 적용
* <GFS_FCAT>-CFIELDNAME = 'WAERS'. "해당 ROW의 WAERS 필드의 값에 따라
* <GFS_FCAT>-QUANTITY = 'EA'. "전체 칼럼에 적용
* <GFS_FCAT>-QFIELDNAME = 'MEINS'. "해당 ROW의 MEINS 필드의 값에 따라
* <GFS_FCAT>-REF_FIELD = 'STATS'. "DESC 필드이면서 도메인 탐색도움말 나오게 하기위해
* <GFS_FCAT>-REF_TABLE = 'ZMMET0200'. "DESC 필드이면서 도메인 탐색도움말 나오게 하기위해
* <GFS_FCAT>-F4AVAILABL = 'X'. "필드에 탐색도움말 설정후 셋팅해야함, 도메인 있으면 이 값만 셋팅해도 됨
* <GFS_FCAT>-HOTSPOT = 'X'. "손가락
* <GFS_FCAT>-CHECKBOX = 'X'. "체크박스로 표시
* <GFS_FCAT>-JUST = 'L'. "정렬 L/R/C
* <GFS_FCAT>-FIX_COLUMN = 'X'. "틀고정 필드
* <GFS_FCAT>-CONVEXIT = 'ABPSP'. "Conversion Exit
* <GFS_FCAT>-EDIT_MASK = '__-___-_____'. "Edit Mask
* <GFS_FCAT>-NO_MERGING = 'X'. "Sort해도 Cell이 병합되지 않게한다.
* <GFS_FCAT>-EMPHASIZE = 'C100'. "진하늘 (C110:파랑)
* <GFS_FCAT>-EMPHASIZE = 'C200'. "회색 (C210:연하늘 = C400)
* <GFS_FCAT>-EMPHASIZE = 'C300'. "노랑 (C310:진한노랑)
* <GFS_FCAT>-EMPHASIZE = 'C400'. "연하늘 (C410:진하늘 = C100)
* <GFS_FCAT>-EMPHASIZE = 'C500'. "초록 (C310:진한초록)
* <GFS_FCAT>-EMPHASIZE = 'C600'. "진분홍 (C610:빨강)
* <GFS_FCAT>-EMPHASIZE = 'C700'. "연분홍 (C710:갈색)
* <GFS_FCAT>-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_BUTTON. " 버튼으로 하고 싶을 때 (라인마다 적용할때에는 CELLTAB 을 사용)
* <GFS_FCAT>-ICON = 'X'. "Tree일 경우 필드를 Icon으로 표시하기위해
* <GFS_FCAT>-COL_OPT = 'X'. "X = 자동정렬.
ENDFORM. " SET_FIELD_CAT_100
*&---------------------------------------------------------------------*
*& Form SET_LAYOUT_100
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM SET_LAYOUT_100 USING P_EDIT "수정모드 사용여부
P_COLOR "색깔셋팅 사용여부
CHANGING PS_LAYOUT TYPE LVC_S_LAYO.
CLEAR PS_LAYOUT.
*-- LAYOUT SETTING
PS_LAYOUT-ZEBRA = CO_X.
PS_LAYOUT-CWIDTH_OPT = CO_X. " Column Width 최적화 사용여부
PS_LAYOUT-NO_TOTLINE = SPACE.
PS_LAYOUT-DETAILINIT = 'X'. "Detail값이 NULL이라도 보여줌
* PS_LAYOUT-SEL_MODE = 'C'. "A = COLUMN AND ROW. B = SIMPLE. C = MULTI. D = CELL.
PS_LAYOUT-NO_ROWINS = 'X'.
PS_LAYOUT-NO_ROWMOVE = 'X'.
PS_LAYOUT-NO_ROWMARK = 'X'. "ROWMARK 삭제.
PS_LAYOUT-SMALLTITLE = 'X'. "제목크
* PS_LAYOUT-TOTALS_BEF = 'X'. "합계를 위로 표시
PS_LAYOUT-FRONTEND = 'X'. "ALV 제어: 엑셀 또는 크리스털 또는 ALV
IF P_EDIT = 'X'.
PS_LAYOUT-STYLEFNAME = 'CELLTAB'. "Input/Output 셋팅
ENDIF.
IF P_COLOR = 'X'.
PS_LAYOUT-CTAB_FNAME = 'CELLCOL'. "Color 셋팅
ENDIF.
PS_LAYOUT-INFO_FNAME = 'ROW_COLOR'. "라인의 색깔
* PS_LAYOUT-BOX_FNAME = 'BOX'. "ALV 제어: 내부테이블필드의 필드이름
* PS_LAYOUT-GRID_TITLE = '프로그램 LIST'. "ALV 제어: 제목바 텍스트
* PS_LAYOUT-NO_TOOLBAR = 'X'. "ALV 제어: 툴바 숨기기
ENDFORM. " SET_LAYOUT_100
*&---------------------------------------------------------------------*
*& Form SET_TOOLBAR_100
*&---------------------------------------------------------------------*
* text 툴바의 버튼중 나타내지 않을 버튼을 지정한다.
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM SET_TOOLBAR_100 USING P_TB_NAME.
** Alv Toolbar 처리 ( 전체 )
FIELD-SYMBOLS: <TABLE> TYPE UI_FUNCTIONS.
DATA: L_TB_NAME LIKE FELD-NAME.
GV_REPID = SY-CPROG.
CONCATENATE P_TB_NAME '[]' INTO L_TB_NAME.
ASSIGN (L_TB_NAME) TO <TABLE>.
REFRESH: <TABLE>.
PERFORM ALV_EXCLUDE_TB_1
TABLES <TABLE>
* USING: CL_GUI_ALV_GRID=>mc_fc_excl_all. "툴바 모두제거
USING:
* CL_GUI_ALV_GRID=>mc_fc_detail, "상세정보
CL_GUI_ALV_GRID=>MC_FC_REFRESH, "Refresh
CL_GUI_ALV_GRID=>MC_FC_CHECK,
CL_GUI_ALV_GRID=>MC_FC_LOC_CUT, "데이타 잘라내기
* CL_GUI_ALV_GRID=>MC_FC_LOC_COPY, "데이타 복사
* CL_GUI_ALV_GRID=>MC_MB_PASTE
* CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE, "데이타 붙여넣기
CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW, "Paste new Row
CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO, "실행취소
* CL_GUI_ALV_GRID=>MC_FG_EDIT, "edit관련한 버튼을 모두 제거
* CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW, "행 생성
* CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW, "행 삽입
* CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW, "행 삭제
* CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW, "행 카피
CL_GUI_ALV_GRID=>MC_FC_GRAPH, "그래프
CL_GUI_ALV_GRID=>MC_FC_INFO. "Info
* CL_GUI_ALV_GRID=>MC_MB_VIEW, "
* CL_GUI_ALV_GRID=>MC_FC_VIEWS, "리스트출력 '&VIEW'
* CL_GUI_ALV_GRID=>MC_FC_VIEW_CRYSTAL, "크리스탈보기
* CL_GUI_ALV_GRID=>MC_FC_VIEW_EXCEL, "엑셀보기
* CL_GUI_ALV_GRID=>MC_FC_VIEW_GRID, "Grid보기 '&VGRID'
* CL_GUI_ALV_GRID=>MC_FC_VIEW_LOTUS. "
* cl_gui_alv_grid=>mc_fc_sort,
* cl_gui_alv_grid=>mc_fc_sort_asc, "Sort ASC
* cl_gui_alv_grid=>mc_fc_sort_dsc, "Sort DESC
* cl_gui_alv_grid=>mc_fc_find, "Find
* cl_gui_alv_grid=>mc_fc_find_more, "Find Next
* cl_gui_alv_grid=>MC_MB_FILTER,
* cl_gui_alv_grid=>mc_fc_filter, "Set 필터
* cl_gui_alv_grid=>mc_fc_delete_filter, "Del 필터
* cl_gui_alv_grid=>mc_fc_sum, "Sum
* cl_gui_alv_grid=>mc_fc_subtot, "Sub Sum
* cl_gui_alv_grid=>mc_fc_minimum, "Min
* cl_gui_alv_grid=>mc_fc_maximum, "Max
* cl_gui_alv_grid=>MC_FC_AVERAGE, "평균
* cl_gui_alv_grid=>mc_fc_auf, "소계확장&AUF
* cl_gui_alv_grid=>mc_fc_print, "프린트
* cl_gui_alv_grid=>mc_fc_print_back,
* cl_gui_alv_grid=>mc_fc_print_prev,
* cl_gui_alv_grid=>MC_MB_EXPORT, "
* cl_gui_alv_grid=>mc_fc_data_save, "Export
* cl_gui_alv_grid=>mc_fc_word_processor, "워드
* cl_gui_alv_grid=>mc_fc_pc_file, "로컬파일
* cl_gui_alv_grid=>mc_fc_send, "Send
* cl_gui_alv_grid=>mc_fc_to_office, "Office
* cl_gui_alv_grid=>mc_fc_call_abc, "ABC분석
* cl_gui_alv_grid=>mc_fc_html, "HTML
* cl_gui_alv_grid=>mc_fc_load_variant, "불러오기
* cl_gui_alv_grid=>mc_fc_current_variant, "현재
* cl_gui_alv_grid=>mc_fc_save_variant, "저장
* cl_gui_alv_grid=>mc_fc_maintain_variant, "Vari관리
* cl_gui_alv_grid=>mc_fc_col_optimize, "Optimize
* cl_gui_alv_grid=>mc_fc_separator, "분리자
* cl_gui_alv_grid=>mc_fc_select_all, "전체선택
* cl_gui_alv_grid=>mc_fc_deselect_all, "전체해제
* cl_gui_alv_grid=>mc_fc_col_invisible, "칼럼숨기기
* cl_gui_alv_grid=>mc_fc_fix_columns, "칼럼고정
* cl_gui_alv_grid=>mc_fc_unfix_columns, "칼럼고정풀기
* cl_gui_alv_grid=>mc_fc_average, "Average '&AVERAGE'
* cl_gui_alv_grid=>mc_fc_f4,
* cl_gui_alv_grid=>mc_fc_help,
* CL_GUI_ALV_GRID=>MC_FC_CALL_ABC, " '&ABC'
* cl_gui_alv_grid=>mc_fc_call_chain,
* cl_gui_alv_grid=>mc_fc_back_classic,
* cl_gui_alv_grid=>mc_fc_call_crbatch,
* cl_gui_alv_grid=>mc_fc_call_crweb,
* cl_gui_alv_grid=>mc_fc_call_lineitems,
* cl_gui_alv_grid=>mc_fc_call_master_data,
* cl_gui_alv_grid=>mc_fc_call_more,
* CL_GUI_ALV_GRID=>MC_FC_CALL_REPORT,
* cl_gui_alv_grid=>mc_fc_call_xint,
* cl_gui_alv_grid=>mc_fc_call_xxl,
* cl_gui_alv_grid=>mc_fc_expcrdata,
* cl_gui_alv_grid=>mc_fc_expcrdesig,
* cl_gui_alv_grid=>mc_fc_expcrtempl,
* cl_gui_alv_grid=>mc_fc_expmdb,
* cl_gui_alv_grid=>mc_fc_extend,
* cl_gui_alv_grid=>mc_fc_loc_move_row,
* cl_gui_alv_grid=>mc_fc_reprep,
* CL_GUI_ALV_GRID=>MC_FC_TO_REP_TREE.
ENDFORM. " SET_TOOLBAR_100
*&---------------------------------------------------------------------*
*& Form ALV_EXCLUDE_TB_1
*&---------------------------------------------------------------------*
FORM ALV_EXCLUDE_TB_1 TABLES PT_EX TYPE UI_FUNCTIONS
USING PV_VALUE.
DATA: LS_EXCLUDE TYPE UI_FUNC.
LS_EXCLUDE = PV_VALUE.
APPEND LS_EXCLUDE TO PT_EX.
ENDFORM. " ALV_EXCLUDE_TB_1
*&---------------------------------------------------------------------*
*& Form SET_ALV_EVENT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM SET_ALV_EVENT .
* CALL METHOD G_GRID_100->SET_READY_FOR_INPUT
* EXPORTING
* I_READY_FOR_INPUT = 1.
*
* CALL METHOD G_GRID_100->REGISTER_EDIT_EVENT
* EXPORTING
* I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED.
*
* CALL METHOD G_GRID_100->REGISTER_EDIT_EVENT
* EXPORTING
* I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.
" EVENT 일어날때 자동적으로 DATA 체크.
* CALL METHOD G_GRID_100->CHECK_CHANGED_DATA.
*
** 이벤트
* CREATE OBJECT G_EVENT_ALL
* EXPORTING
* E_OBJECT_TEXT = 'G_GRID_100'.
**
* SET HANDLER G_EVENT_ALL->HANDLE_TOOLBAR FOR G_GRID_100.
* SET HANDLER G_EVENT_ALL->HANDLE_USER_COMMAND FOR G_GRID_100.
* SET HANDLER G_EVENT_ALL->HANDLE_DOUBLE_CLICK FOR G_GRID_100.
* SET HANDLER G_EVENT_ALL->HANDLE_HOTSPOT_CLICK FOR G_GRID_100.
* SET HANDLER G_EVENT_ALL->HANDLE_BUTTON_CLICK FOR G_GRID_100.
* SET HANDLER G_EVENT_ALL->HANDLE_DATA_CHANGED FOR G_GRID_100.
* SET HANDLER G_EVENT_ALL->HANDLE_MENU_BUTTON FOR G_GRID_100.
* SET HANDLER G_EVENT_ALL->HANDLE_ON_F4 FOR G_GRID_100.
* DATA : LT_ONF4 TYPE LVC_T_F4 WITH HEADER LINE.
* LT_ONF4-FIELDNAME = 'MAKTX'.
* LT_ONF4-REGISTER = 'X'.
* LT_ONF4-GETBEFORE = 'X'.
** lt_onf4-chngeafter = 'X'.
* APPEND LT_ONF4.
*
* CALL METHOD G_GRID_100->REGISTER_F4_FOR_FIELDS
* EXPORTING
* IT_F4 = LT_ONF4[].
ENDFORM. " SET_ALV_EVENT
*&---------------------------------------------------------------------*
*& Form DISPLAY_ALV
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DISPLAY_ALV .
** ALV Grid를 출력한다.
CALL METHOD G_GRID_100->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_VARIANT = GS_VARIANT_100
IS_LAYOUT = GS_LAYOUT_100
IT_TOOLBAR_EXCLUDING = GT_TOOLBAR_EXCLUDING_100
I_SAVE = 'A'
I_DEFAULT = 'X'
CHANGING
IT_FIELDCATALOG = GT_FCAT_100
IT_OUTTAB = GT_OUTTAB[]
IT_SORT = GT_SORT_100.
ENDFORM. " DISPLAY_ALV
*&---------------------------------------------------------------------*
*& Form ALV_FIELDCAT_MERGE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_GT_OUTTAB text
* -->P_GT_FCAT_100 text
* -->P_0066 text
*----------------------------------------------------------------------*
FORM ALV_FIELDCAT_MERGE TABLES PT_M TYPE TABLE
PT_FCAT TYPE LVC_T_FCAT
USING P_IT_NAME.
CLEAR: PT_FCAT, PT_FCAT[].
DATA: LT_FCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
DATA: LV_IT_NAME TYPE SLIS_TABNAME.
GV_REPID = SY-CPROG.
LV_IT_NAME = P_IT_NAME.
* IT 구조를 가져오기 위해
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = GV_REPID
I_INTERNAL_TABNAME = LV_IT_NAME
I_INCLNAME = GV_REPID
* I_BYPASSING_BUFFER = ' '
CHANGING
CT_FIELDCAT = LT_FCAT[].
* ALV GRID용으로 변환
CALL FUNCTION 'LVC_TRANSFER_FROM_SLIS'
EXPORTING
IT_FIELDCAT_ALV = LT_FCAT[]
IMPORTING
ET_FIELDCAT_LVC = PT_FCAT[]
TABLES
IT_DATA = PT_M.
ENDFORM. " ALV_FIELDCAT_MERGE
*&---------------------------------------------------------------------*
*& Form REFRESH_ALV
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM REFRESH_ALV .
CALL METHOD G_GRID_100->REFRESH_TABLE_DISPLAY
EXPORTING
IS_STABLE = GS_STBL.
ENDFORM. " REFRESH_ALV
*&---------------------------------------------------------------------*
*& Form TOP_OF_PAGE_CHECK
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM TOP_OF_PAGE_CHECK .
* DATA : LV_TEXT TYPE SDYDO_TEXT_ELEMENT.
*
* GV_CNT_TOTAL = LINES( GT_OUTTAB ). "Excel 건수
* CONCATENATE TEXT-T11 ` : ` GV_CNT_TOTAL TEXT-T12 INTO LV_TEXT.
*
** Adding Icon
* CALL METHOD G_DOCUMENT->ADD_ICON
* EXPORTING
* SAP_ICON = 'ICON_PARAMETER'.
** Adding Gap
* CALL METHOD G_DOCUMENT->ADD_GAP
* EXPORTING
* WIDTH = 5.
** Adding Text
* CALL METHOD G_DOCUMENT->ADD_TEXT
* EXPORTING
* TEXT = LV_TEXT
* SAP_EMPHASIS = CL_DD_AREA=>STRONG. " Text 강조.
** Adding Line
* CALL METHOD G_DOCUMENT->NEW_LINE.
** CONCATENATE TEXT-T12 GV_CNT_OK INTO LV_TEXT SEPARATED BY CO_SEP."고객생성 가능 건수
** Adding Icon
* CALL METHOD G_DOCUMENT->ADD_ICON
* EXPORTING
* SAP_ICON = 'ICON_LED_YELLOW'.
** Adding Gap
* CALL METHOD G_DOCUMENT->ADD_GAP
* EXPORTING
* WIDTH = 5.
** Adding Text
* CALL METHOD G_DOCUMENT->ADD_TEXT
* EXPORTING
* TEXT = TEXT-T12.
** Adding Line
* CALL METHOD G_DOCUMENT->NEW_LINE.
*
** GV_CNT_NO = GV_CNT_TOTAL - GV_CNT_OK. "고객생성 불가능 건수
** CONCATENATE TEXT-T13 GV_CNT_NO INTO LV_TEXT SEPARATED BY CO_SEP.
** Adding Icon
* CALL METHOD G_DOCUMENT->ADD_ICON
* EXPORTING
* SAP_ICON = 'ICON_LED_RED'.
** Adding Gap
* CALL METHOD G_DOCUMENT->ADD_GAP
* EXPORTING
* WIDTH = 5.
** Adding Text
* CALL METHOD G_DOCUMENT->ADD_TEXT
* EXPORTING
* TEXT = TEXT-T13.
*
** Adding Line
* CALL METHOD G_DOCUMENT->NEW_LINE.
*
** CONCATENATE TEXT-T14 GV_CNT_END INTO LV_TEXT SEPARATED BY CO_SEP.
** Adding Icon
* CALL METHOD G_DOCUMENT->ADD_ICON
* EXPORTING
* SAP_ICON = 'ICON_LED_GREEN'.
** Adding Gap
* CALL METHOD G_DOCUMENT->ADD_GAP
* EXPORTING
* WIDTH = 5.
** Adding Text
* CALL METHOD G_DOCUMENT->ADD_TEXT
* EXPORTING
* TEXT = TEXT-T14.
* CALL METHOD G_DOCUMENT->DISPLAY_DOCUMENT
* EXPORTING
* PARENT = G_TOP_CONTAINER.
** Calling the method of ALV to process top of page
* CALL METHOD G_GRID_100->LIST_PROCESSING_EVENTS
* EXPORTING
* I_EVENT_NAME = 'TOP_OF_PAGE'
* I_DYNDOC_ID = G_DOCUMENT.
ENDFORM. " TOP_OF_PAGE_CHECK
*&---------------------------------------------------------------------*
*& Form ALV_REFRESH
*&---------------------------------------------------------------------*
* P_GB = ' ' : REFRESH 만 수행
* 'F' : Fieldcat 길이가 변경에 대한 수행
* 'S' : Sort, SUMMARY 에 대한 REFRESH 수행
* 'A' : Fieldcat 길이 + Sort, SUMMARY 수행
*----------------------------------------------------------------------*
FORM ALV_REFRESH USING PO_GRID TYPE REF TO CL_GUI_ALV_GRID
PT_FCAT TYPE LVC_T_FCAT
P_GB.
IF PO_GRID IS INITIAL. EXIT. ENDIF.
DATA: LS_STBL TYPE LVC_S_STBL,
L_SOFT_REFRESH.
* Fieldcat 길이가 변경되거나 하였을 경우
CASE P_GB.
WHEN 'F' OR 'A'.
CALL METHOD PO_GRID->SET_FRONTEND_FIELDCATALOG
EXPORTING
IT_FIELDCATALOG = PT_FCAT[].
ENDCASE.
* Sort, SUMMARY등의 REFRESH
CASE P_GB.
WHEN 'S' OR 'A'.
L_SOFT_REFRESH = ''.
WHEN OTHERS.
L_SOFT_REFRESH = 'X'.
ENDCASE.
LS_STBL-ROW = 'X'.
LS_STBL-COL = 'X'.
CALL METHOD PO_GRID->REFRESH_TABLE_DISPLAY
EXPORTING
IS_STABLE = LS_STBL
I_SOFT_REFRESH = L_SOFT_REFRESH.
ENDFORM. " ALV_REFRESH
*&---------------------------------------------------------------------*
*& Form GET_SELECTED_ROWS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM GET_SELECTED_ROWS .
DATA: LV_CNT TYPE I.
DATA: LV_ROW_NO LIKE GS_ROW_NO-ROW_ID.
CLEAR LV_ROW_NO.
**-- GET SELECTED ROWS
CLEAR : GT_ROW_NO[].
CLEAR GS_ROW_NO.
CALL METHOD G_GRID_100->GET_SELECTED_ROWS
IMPORTING
ET_ROW_NO = GT_ROW_NO.
ENDFORM. " GET_SELECTED_ROWS
*&---------------------------------------------------------------------*
*& Form ALV_SORT_0100
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_GT_SORT_100 text
*----------------------------------------------------------------------*
FORM SET_SORT_0100 TABLES PT_SORT STRUCTURE LVC_S_SORT.
* CLEAR: PT_SORT, PT_SORT[].
*
* CLEAR PT_SORT.
* PT_SORT-FIELDNAME = 'BELNR'.
* PT_SORT-SPOS = '1'.
* PT_SORT-UP = 'X'.
** PT_SORT-DOWN = 'X'.
* PT_SORT-SUBTOT = 'X'.
* APPEND PT_SORT.
*
* CLEAR PT_SORT.
* PT_SORT-FIELDNAME = 'KSTAR'.
* PT_SORT-SPOS = '2'.
* PT_SORT-UP = 'X'.
* APPEND PT_SORT.
ENDFORM. " ALV_SORT_0100
************************************************************************
************************************************************************
************************************************************************
************************************************************************
************************************************************************
************************************************************************
************************************************************************
************************************************************************
************************************************************************
************************************************************************
*&---------------------------------------------------------------------*
*& Form ALV_APPEND_COLUMN_COLOR
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_TEXT_H40 text
* -->P_2628 text
* -->P_2629 text
* -->P_2630 text
*----------------------------------------------------------------------*
FORM ALV_APPEND_COLUMN_COLOR USING PV_FNAME
PV_COLOR
PV_INT
PV_INV.
CLEAR: GS_ALV_COLOR.
GS_ALV_COLOR-FNAME = PV_FNAME.
GS_ALV_COLOR-COLOR-INT = PV_INT.
GS_ALV_COLOR-COLOR-INV = PV_INV.
CASE PV_COLOR.
WHEN '0'.
GS_ALV_COLOR-COLOR-COL = CL_GUI_RESOURCES=>LIST_COL_BACKGROUND.
WHEN '1'.
GS_ALV_COLOR-COLOR-COL = CL_GUI_RESOURCES=>LIST_COL_HEADING.
WHEN '2'.
GS_ALV_COLOR-COLOR-COL = CL_GUI_RESOURCES=>LIST_COL_NORMAL.
WHEN '3'.
GS_ALV_COLOR-COLOR-COL = CL_GUI_RESOURCES=>LIST_COL_TOTAL.
WHEN '4'.
GS_ALV_COLOR-COLOR-COL = CL_GUI_RESOURCES=>LIST_COL_KEY.
WHEN '5'.
GS_ALV_COLOR-COLOR-COL = CL_GUI_RESOURCES=>LIST_COL_POSITIVE.
WHEN '6'.
GS_ALV_COLOR-COLOR-COL = CL_GUI_RESOURCES=>LIST_COL_NEGATIVE.
WHEN '7'.
GS_ALV_COLOR-COLOR-COL = CL_GUI_RESOURCES=>LIST_COL_GROUP.
ENDCASE.
IF PV_INV = 1.
GS_ALV_COLOR-COLOR-INV = CL_GUI_RESOURCES=>LIST_INVERSE.
ENDIF.
APPEND GS_ALV_COLOR TO GT_ALV_COLOR. CLEAR GS_ALV_COLOR.
ENDFORM. " ALV_APPEND_COLUMN_COLOR
*&---------------------------------------------------------------------*
*& Form alv_class_title
*&---------------------------------------------------------------------*
* -->PV_GRID text
* -->PV_TEXT text
*----------------------------------------------------------------------*
FORM ALV_CLASS_TITLE USING PV_GRID
PV_TEXT.
DATA : LO_GRID TYPE REF TO CL_GUI_ALV_GRID,
LV_TEXT TYPE LVC_TITLE.
LO_GRID = PV_GRID.
LV_TEXT = PV_TEXT.
CALL METHOD LO_GRID->SET_GRIDTITLE
EXPORTING
I_GRIDTITLE = LV_TEXT.
ENDFORM. " alv_class_title
----------------------------------------------------------------------------------
Extracted by Mass Download version 1.4.6 - E.G.Mellodew. 1998-2015. Sap Release 701
'Abap' 카테고리의 다른 글
F02 (0) | 2021.06.01 |
---|---|
F01 (0) | 2021.06.01 |
ALV 1 (0) | 2021.06.01 |
[ABAP] Dynamic table - cell color (0) | 2013.11.29 |
[ABAP] Dynamic Table (0) | 2013.11.27 |