REPORT z19_001 .
TYPES: node_table_type LIKE STANDARD TABLE OF mtreesnode
WITH DEFAULT KEY.
DATA : con1_ref TYPE REF TO cl_gui_custom_container,
tree_con_ref TYPE REF TO cl_gui_custom_container.
DATA : g_tree TYPE REF TO cl_gui_simple_tree.
DATA : grid1 TYPE REF TO cl_gui_alv_grid,
gs_variant LIKE disvariant,
gs_cs_variant LIKE disvariant,
gs_layout TYPE lvc_s_layo,
gs_toolbar TYPE ui_functions,
gt_sort TYPE lvc_t_sort,
gt_sflight TYPE TABLE OF sflight.
TYPE-POOLS: icon.
*---------------------------------------------------------------------*
* CLASS lcl_event_receiver DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row e_column.
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.
PRIVATE SECTION.
ENDCLASS. "lcl_event_receiver DEFINITION
*---------------------------------------------------------------------*
* CLASS lcl_event_receiver IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_double_click.
LEAVE TO SCREEN 0.
ENDMETHOD. "handle_double_click
*-- Add ToolBar
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.
*- REFRESH
WHEN 'RESH'.
SELECT * FROM sflight INTO TABLE gt_sflight.
l_scroll-row = 'X'.
l_scroll-col = 'X'.
CALL METHOD grid1->refresh_table_display
EXPORTING
i_soft_refresh = ''
is_stable = l_scroll.
ENDCASE.
ENDMETHOD. "handle_user_command
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
*
DATA : event_receiver TYPE REF TO lcl_event_receiver.
START-OF-SELECTION.
SELECT * FROM sflight INTO TABLE gt_sflight.
CALL SCREEN 100.
*---------------------------------------------------------------------*
* MODULE init_con OUTPUT
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
MODULE init_con OUTPUT.
IF con1_ref IS INITIAL.
CREATE OBJECT con1_ref
EXPORTING container_name = 'CON1'.
CREATE OBJECT grid1
EXPORTING
i_parent = con1_ref.
PERFORM setting_layout.
PERFORM setting_toolbar.
PERFORM setting_sort.
PERFORM setting_event.
CALL METHOD grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
i_save = 'A'
is_variant = gs_variant " variant display
i_default = ' '
is_layout = gs_layout
it_toolbar_excluding = gs_toolbar
CHANGING
it_outtab = gt_sflight
it_sort = gt_sort.
ENDIF.
ENDMODULE. " init_con OUTPUT
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'G100'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK' OR 'EXIT' OR 'CANC'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Form setting_layout
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_GS_LAYOCAT text
*----------------------------------------------------------------------*
FORM setting_layout .
*- General display options
gs_layout-cwidth_opt = 'X'.
* TITLE BAR
gs_layout-grid_title = 'SIMPLE TREE TEST'.
* Selection modes for SEL_MODE
gs_layout-sel_mode = 'D'.
* Grid pattern
gs_layout-zebra = 'X'.
ENDFORM. " setting_layout
*&---------------------------------------------------------------------*
*& Form setting_toolbar
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_GS_TOOLBAR text
*----------------------------------------------------------------------*
FORM setting_toolbar.
DATA: l_exclude TYPE ui_func.
l_exclude = cl_gui_alv_grid=>mc_fc_save_variant.
APPEND l_exclude TO gs_toolbar.
l_exclude = cl_gui_alv_grid=>mc_fc_maintain_variant.
APPEND l_exclude TO gs_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_event
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM setting_event .
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_double_click FOR grid1.
SET HANDLER event_receiver->handle_toolbar FOR grid1.
SET HANDLER event_receiver->handle_command FOR grid1.
ENDFORM. " setting_event
*&---------------------------------------------------------------------*
*& Module init_tree OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE init_tree OUTPUT.
IF g_tree IS INITIAL.
DATA: node_table TYPE node_table_type.
CREATE OBJECT tree_con_ref
EXPORTING
" the container is linked to the custom control with the
" name 'TREE_CONTAINER' on the dynpro
container_name = 'TREE_CONTAINER'.
* create a tree control
CREATE OBJECT g_tree
EXPORTING
parent = tree_con_ref
" single node selection is used
node_selection_mode = cl_gui_simple_tree=>node_sel_mode_single.
PERFORM build_node_table USING node_table.
* node_table_structure_name = 'MTREESNODE'
CALL METHOD g_tree->add_nodes
EXPORTING
table_structure_name = 'MTREESNODE'
node_table = node_table.
ENDIF.
ENDMODULE. " init_tree OUTPUT
*&---------------------------------------------------------------------*
*& Form BUILD_NODE_TABLE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_NODE_TABLE text
*----------------------------------------------------------------------*
FORM build_node_table
USING
node_table TYPE node_table_type.
DATA: node LIKE mtreesnode.
CLEAR node.
node-node_key = 'Root'.
node-isfolder = 'X'. " a folder.
node-text = 'AIRPLANE'.
APPEND node TO node_table.
CLEAR node.
node-node_key = 'Child1'.
node-relatkey = 'Root'.
node-isfolder = 'X'.
node-text = 'CARRID'.
node-expander = 'X' .
APPEND node TO node_table.
CLEAR node.
node-node_key = 'AA'.
node-relatkey = 'Child1'.
node-n_image = '@10@'.
node-text = 'AA'.
APPEND node TO node_table.
CLEAR node.
node-node_key = 'AZ'.
node-relatkey = 'Child1'.
NODE-style = CL_GUI_SIMPLE_TREE=>style_emphasized.
node-text = 'AZ'.
APPEND node TO node_table.
CLEAR node.
node-node_key = 'DL'.
node-relatkey = 'Child1'.
node-expander = ' '.
* NODE-HIDDEN = ' '.
node-disabled = 'X'.
NODE-RELATSHIP = CL_GUI_SIMPLE_TREE=>RELAT_LAST_CHILD.
node-text = 'DL'.
APPEND node TO node_table.
ENDFORM. " build_node_table
댓글 0
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
91 | REPORT z19_003 | sapjoy | 2007.03.27 | 2473 |
90 | REPORT z19_002 | sapjoy | 2007.03.24 | 2362 |
» | REPORT z19_001 | sapjoy | 2007.03.23 | 2552 |
88 | REPORT z18_022 | sapjoy | 2007.03.17 | 2464 |
87 | REPORT z18_019 | sapjoy | 2007.03.13 | 2473 |
86 | REPORT z18_018 [4] | sapjoy | 2007.03.12 | 2463 |
85 | REPORT z18_014 | sapjoy | 2007.03.10 | 2844 |
84 | REPORT z18_013 [1] | sapjoy | 2007.03.09 | 2585 |
83 | REPORT z18_012 [1] | sapjoy | 2007.03.09 | 2404 |
82 | REPORT Z15_045 | sapjoy | 2007.03.09 | 2388 |
81 | REPORT z18_011 [1] | sapjoy | 2007.03.08 | 2326 |
80 | REPORT z18_008 | sapjoy | 2007.03.07 | 2359 |
79 | REPORT z18_007 | sapjoy | 2007.03.07 | 2206 |
78 | REPORT z18_006 | sapjoy | 2007.03.06 | 2423 |
77 | REPORT z18_005 | sapjoy | 2007.03.06 | 2157 |
76 | REPORT z18_004 [1] | sapjoy | 2007.03.06 | 2348 |
75 | REPORT Z18_002 | sapjoy | 2007.03.06 | 3083 |
74 | Z18_001_PBO | sapjoy | 2007.03.03 | 2585 |
73 | REPORT Z18_001 | sapjoy | 2007.03.03 | 2774 |
72 | REPORT Z02_016 | sapjoy | 2007.02.27 | 2294 |