REPORT z15_27.
DATA : gt_sflight LIKE sflight OCCURS 0 WITH HEADER LINE.
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_context_menu
FOR EVENT context_menu_request OF cl_gui_alv_grid
IMPORTING e_object.
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 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_context_menu.
CALL METHOD e_object->load_gui_status
EXPORTING
PROGRAM = SY-REPID
STATUS = 'CONTEXT_MENU'
MENU = e_object.
ENDMETHOD.
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 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.
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_context_menu FOR g_grid.
CALL METHOD g_grid->set_table_for_first_display
EXPORTING
* i_structure_name = 'SFLIGHT'
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 = 'Context Menu Test'.
"타이틀 바
p_layout-sel_mode = 'B'. "선택모드 : 멀티 선택 가능
p_layout-zebra = ''. "Sripe 속성 지정
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 'PRICE'.
<ls_fcat>-key = 'X'.
ENDIF.
IF <ls_fcat>-fieldname EQ 'CURRENCY'.
<ls_fcat>-fix_column = 'X'.
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
댓글 0
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
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 | 1190 |
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 | 944 |
621 | REPORT z16_01. | sapjoy | 2012.08.02 | 1078 |
620 | REPORT z15_28. | sapjoy | 2012.08.02 | 1030 |
» | REPORT z15_27. | sapjoy | 2012.08.02 | 949 |
618 | REPORT z15_26. | sapjoy | 2012.08.02 | 976 |
617 | REPORT z15_25. [1] | sapjoy | 2012.08.02 | 1202 |
616 | REPORT z15_24. | sapjoy | 2012.08.02 | 1410 |
615 | 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 |