‎2009 Apr 16 8:41 AM
Hello!
I have a doking container. Now I want to install a Tree Control on it. How can I do it? I need an example ..
Thanks!
‎2009 Apr 16 9:02 AM
HI,
Try to do below
data: docking_container type ref to cl_gui_docking_container,
* Tree control class
tree type ref to cl_gui_alv_tree,
* Splitter container class
splitter_container type ref to cl_gui_splitter_container,
* Create container for alv tree
create object docking_container
exporting
side = cl_gui_docking_container=>dock_at_left
extension = 270
repid = g_repid
dynnr = c_0100.
if not docking_container is initial.
* Creating object for splitter container
create object splitter_container
exporting
link_dynnr = c_0100
link_repid = g_repid
parent = docking_container
rows = 1
columns = 1.
endif. " IF NOT docking_container IS INITIAL
if not splitter_container is initial.
* Method to get the container name of top splitter area of docking container
call method splitter_container->get_container
exporting
row = 1
column = 1
receiving
container = top_container.
endif. " IF NOT splitter_container IS INITIAL
* Create object for Event Receiver
create object tree_event_receiver.
* Create object for tree control
create object tree
exporting
parent = top_container "docking_container
node_selection_mode = cl_gui_column_tree=>node_sel_mode_single
item_selection = ''
no_html_header = c_x
no_toolbar = ''
exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
illegal_node_selection_mode = 5
failed = 6
illegal_column_name = 7.
"Next fill you r field catalog
* Method to create tree control with given table
call method tree->set_table_for_first_display
exporting
is_hierarchy_header = wa_hierarchy_header
i_background_id = ' '
changing
it_outtab = it_main_plan_dummy[]
it_fieldcatalog = it_fcat.Hope these thigns will useful to you.
Thanks!
‎2009 Apr 16 9:02 AM
HI,
Try to do below
data: docking_container type ref to cl_gui_docking_container,
* Tree control class
tree type ref to cl_gui_alv_tree,
* Splitter container class
splitter_container type ref to cl_gui_splitter_container,
* Create container for alv tree
create object docking_container
exporting
side = cl_gui_docking_container=>dock_at_left
extension = 270
repid = g_repid
dynnr = c_0100.
if not docking_container is initial.
* Creating object for splitter container
create object splitter_container
exporting
link_dynnr = c_0100
link_repid = g_repid
parent = docking_container
rows = 1
columns = 1.
endif. " IF NOT docking_container IS INITIAL
if not splitter_container is initial.
* Method to get the container name of top splitter area of docking container
call method splitter_container->get_container
exporting
row = 1
column = 1
receiving
container = top_container.
endif. " IF NOT splitter_container IS INITIAL
* Create object for Event Receiver
create object tree_event_receiver.
* Create object for tree control
create object tree
exporting
parent = top_container "docking_container
node_selection_mode = cl_gui_column_tree=>node_sel_mode_single
item_selection = ''
no_html_header = c_x
no_toolbar = ''
exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
illegal_node_selection_mode = 5
failed = 6
illegal_column_name = 7.
"Next fill you r field catalog
* Method to create tree control with given table
call method tree->set_table_for_first_display
exporting
is_hierarchy_header = wa_hierarchy_header
i_background_id = ' '
changing
it_outtab = it_main_plan_dummy[]
it_fieldcatalog = it_fcat.Hope these thigns will useful to you.
Thanks!
‎2009 Apr 16 12:37 PM
Thanks!
I think it is very good and I can use it. But I want to write my table into the structure.
CALL METHOD tree->set_table_for_first_display
EXPORTING
is_hierarchy_header = wa_hierarchy_header
i_background_id = ' '
CHANGING
it_outtab = it_main_plan_dummy[]
it_fieldcatalog = it_fcat.
What kind of type is it_main_plan_dummy[] and it_fcat. Can I write of type Type-pools: slis?
Thank you!