REPORT z15_23.
DATA: BEGIN OF gt_sflight OCCURS 0.
INCLUDE STRUCTURE sflight.
DATA: chk TYPE c.
DATA: cellbtn TYPE lvc_t_styl.
DATA: END OF gt_sflight.
DATA : gs_sflight LIKE LINE OF gt_sflight.
DATA : con1_ref TYPE REF TO cl_gui_custom_container.
DATA : g_grid TYPE REF TO cl_gui_alv_grid.
DATA : gs_variant TYPE disvariant.
DATA : gs_layout TYPE lvc_s_layo.
DATA : gt_toolbar TYPE ui_functions.
DATA : gt_sort TYPE lvc_t_sort.
DATA : gt_fieldcat TYPE lvc_t_fcat.
DATA : ok_code TYPE sy-ucomm.
TYPE-POOLS: icon.
*----------------------------------------------------------------------*
* CLASS lcl_event_receiver DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS : handle_toolbar
FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive.
METHODS : handle_command
FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm.
METHODS : handle_button_click
FOR EVENT button_click OF cl_gui_alv_grid
IMPORTING es_col_id es_row_no.
ENDCLASS. "lcl_event_receiver DEFINITION
*----------------------------------------------------------------------*
* CLASS lcl_event_receiver IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar.
DATA: ls_toolbar TYPE stb_button.
CLEAR ls_toolbar.
ls_toolbar-butn_type = 3.
APPEND ls_toolbar TO e_object->mt_toolbar.
CLEAR ls_toolbar.
ls_toolbar-function = 'RESH'.
ls_toolbar-icon = icon_refresh.
ls_toolbar-quickinfo = 'Refresh'.
ls_toolbar-text = ' '.
ls_toolbar-disabled = ' '.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD. "handle_toolbar
METHOD handle_command.
DATA : l_scroll TYPE lvc_s_stbl.
CASE e_ucomm.
WHEN 'RESH'.
SELECT * FROM sflight
INTO CORRESPONDING FIELDS OF TABLE gt_sflight.
l_scroll-row = 'X'.
l_scroll-col = 'X'.
CALL METHOD g_grid->refresh_table_display
EXPORTING
i_soft_refresh = ''
is_stable = l_scroll.
ENDCASE.
ENDMETHOD. "handle_command
METHOD handle_button_click.
CLEAR gt_sflight.
READ TABLE gt_sflight INDEX es_row_no-row_id INTO gs_sflight.
IF sy-subrc EQ 0.
MESSAGE gs_sflight-carrid TYPE 'I'.
ENDIF.
ENDMETHOD. "handle_on_entered
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
PARAMETERS: p_vari LIKE disvariant-variant.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
gs_variant-report = sy-repid.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = gs_variant
i_save = 'A'
IMPORTING
es_variant = gs_variant
EXCEPTIONS
not_found = 1
program_error = 2
OTHERS = 3.
IF sy-subrc EQ 0.
p_vari = gs_variant-variant.
ENDIF.
START-OF-SELECTION.
SELECT * FROM sflight
INTO CORRESPONDING FIELDS OF TABLE gt_sflight UP TO 100 ROWS.
CALL SCREEN 100.
*&---------------------------------------------------------------------*
*& Module INIT_CON OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE init_con OUTPUT.
IF con1_ref IS INITIAL.
CREATE OBJECT con1_ref
EXPORTING
container_name = 'CON1'.
CREATE OBJECT g_grid
EXPORTING
i_parent = con1_ref.
ENDIF.
gs_variant-report = sy-repid.
gs_variant-username = sy-uname.
PERFORM setting_layout CHANGING gs_layout.
PERFORM setting_toolbar.
PERFORM setting_sort.
PERFORM getting_catalog.
PERFORM setting_catalog.
PERFORM setting_cell.
PERFORM setting_event.
CALL METHOD g_grid->set_table_for_first_display
EXPORTING
is_variant = gs_variant
i_save = 'A'
i_default = ''
is_layout = gs_layout
it_toolbar_excluding = gt_toolbar
CHANGING
it_outtab = gt_sflight[]
it_fieldcatalog = gt_fieldcat
it_sort = gt_sort.
ENDMODULE. " INIT_CON OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
IF ok_code = 'BACK'.
DATA: l_row TYPE i,
l_value TYPE c,
l_col TYPE i,
ls_row TYPE lvc_s_row,
ls_col TYPE lvc_s_col,
ls_roid TYPE lvc_s_roid.
CALL METHOD g_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_roid.
LEAVE PROGRAM.
ENDIF.
ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS '100_STATUS'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Form SETTING_LAYOUT
*&---------------------------------------------------------------------*
FORM setting_layout CHANGING p_layout TYPE lvc_s_layo.
p_layout-cwidth_opt = ''. "칼럼 길이 자동조절
p_layout-grid_title = 'Pushbutton Test'.
"타이틀 바
p_layout-sel_mode = 'B'. "선택모드 : 멀티 선택 가능
p_layout-zebra = ''. "Sripe 속성 지정
p_layout-stylefname = 'CELLBTN'.
ENDFORM. " setting_layout
*&---------------------------------------------------------------------*
*& Form SETTING_TOOLBAR
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM setting_toolbar .
DATA: l_exclude TYPE ui_func.
l_exclude = cl_gui_alv_grid=>mc_fc_save_variant.
APPEND l_exclude TO gt_toolbar.
l_exclude = cl_gui_alv_grid=>mc_fc_maintain_variant.
APPEND l_exclude TO gt_toolbar.
ENDFORM. " SETTING_TOOLBAR
*&---------------------------------------------------------------------*
*& Form SETTING_SORT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM setting_sort .
DATA : ls_sort TYPE lvc_s_sort.
ls_sort-spos = '1'.
ls_sort-fieldname = 'CARRID'.
ls_sort-up = 'X'.
ls_sort-subtot = 'X'.
APPEND ls_sort TO gt_sort.
ENDFORM. " SETTING_SORT
*&---------------------------------------------------------------------*
*& Form SETTING_CATALOG
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM setting_catalog .
FIELD-SYMBOLS: <ls_fcat> TYPE lvc_s_fcat.
LOOP AT gt_fieldcat ASSIGNING <ls_fcat>.
IF <ls_fcat>-fieldname EQ 'FLDATE'.
<ls_fcat>-edit_mask = '____/__/__'.
ENDIF.
IF <ls_fcat>-fieldname EQ 'CURRENCY'.
<ls_fcat>-just = 'R'.
ENDIF.
ENDLOOP.
ENDFORM. " SETTING_CATALOG
*&---------------------------------------------------------------------*
*& Form GETTING_CATALOG
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM getting_catalog .
DATA : lt_fieldcat TYPE kkblo_t_fieldcat.
CALL FUNCTION 'K_KKB_FIELDCAT_MERGE'
EXPORTING
i_callback_program = sy-repid
i_tabname = 'GT_SFLIGHT'
i_inclname = sy-repid
CHANGING
ct_fieldcat = lt_fieldcat[].
IF sy-subrc EQ 0.
CALL FUNCTION 'LVC_TRANSFER_FROM_KKBLO'
EXPORTING
it_fieldcat_kkblo = lt_fieldcat[]
IMPORTING
et_fieldcat_lvc = gt_fieldcat[].
ENDIF.
ENDFORM. " GETTING_CATALO
*&---------------------------------------------------------------------*
*& Form SETTING_CELL
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM setting_cell .
DATA : lt_cellbtn TYPE lvc_t_styl,
ls_cellbtn TYPE lvc_s_styl,
ls_fieldcat TYPE lvc_s_fcat,
l_mode TYPE raw4,
index TYPE i.
* Display cell as PUSHBUTTON
CLEAR index.
LOOP AT gt_sflight.
index = index + 1.
CLEAR: lt_cellbtn[], ls_cellbtn.
LOOP AT gt_fieldcat INTO ls_fieldcat.
ls_cellbtn-fieldname = ls_fieldcat-fieldname.
IF ls_cellbtn-fieldname EQ 'CHK'.
ls_cellbtn-fieldname = 'CHK'.
ls_cellbtn-style = cl_gui_alv_grid=>mc_style_button.
ENDIF.
INSERT ls_cellbtn INTO TABLE lt_cellbtn.
ENDLOOP.
INSERT LINES OF lt_cellbtn INTO TABLE gt_sflight-cellbtn.
MODIFY gt_sflight INDEX index.
CLEAR gt_sflight.
ENDLOOP.
ENDFORM. " SETTING_CELL
*&---------------------------------------------------------------------*
*& Form SETTING_EVENT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM setting_event .
DATA : event_receiver TYPE REF TO lcl_event_receiver.
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_toolbar FOR g_grid.
SET HANDLER event_receiver->handle_button_click FOR g_grid.
ENDFORM. " SETTING_EVENT
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
631 | REPORT z17_01 . | sapjoy | 2012.08.02 | 1084 |
630 | REPORT z16_11. | sapjoy | 2012.08.02 | 1408 |
629 | REPORT z16_10. | sapjoy | 2012.08.02 | 1191 |
628 | REPORT z16_08. | sapjoy | 2012.08.02 | 1095 |
627 | REPORT z16_07. | sapjoy | 2012.08.02 | 1079 |
626 | REPORT z16_06. | sapjoy | 2012.08.02 | 1015 |
625 | REPORT z16_05. | sapjoy | 2012.08.02 | 1193 |
624 | REPORT z16_04. | sapjoy | 2012.08.02 | 1247 |
623 | REPORT z16_03. | sapjoy | 2012.08.02 | 1148 |
622 | REPORT Z16_02. | sapjoy | 2012.08.02 | 945 |
621 | REPORT z16_01. | sapjoy | 2012.08.02 | 1078 |
620 | REPORT z15_28. | sapjoy | 2012.08.02 | 1030 |
619 | REPORT z15_27. | sapjoy | 2012.08.02 | 949 |
618 | REPORT z15_26. | sapjoy | 2012.08.02 | 978 |
617 | REPORT z15_25. [1] | sapjoy | 2012.08.02 | 1202 |
616 | REPORT z15_24. | sapjoy | 2012.08.02 | 1410 |
» | REPORT z15_23. [1] | sapjoy | 2012.08.02 | 1220 |
614 | REPORT z15_22. | sapjoy | 2012.08.02 | 1112 |
613 | REPORT z15_21. | sapjoy | 2012.08.02 | 1163 |
612 | REPORT z15_20. | sapjoy | 2012.08.02 | 1212 |
위 소스와 같이 테스트를 해봤으나 버튼이 생성되지 않네요.. 뭐가 잘못된 것일까요??