‎2010 May 26 2:21 PM
Hi i am new to ABAP and trying to build ALV TREE.But i couldn't get code pasted below.
data: lt_item_layout type lvc_t_layi,
ls_item_layout type lvc_s_layi.
ls_item_layout-t_image = '@3P@'.
ls_item_layout-fieldname = tree1->c_hierarchy_column_name.
ls_item_layout-style =
cl_gui_column_tree=>style_intensifd_critical.
append ls_item_layout to lt_item_layout.
* add node
l_node_text = ps_sflight-carrid.
data: ls_node type lvc_s_layn.
ls_node-n_image = space.
ls_node-exp_image = space.
* call method tree1->add_node
exporting
i_relat_node_key = p_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = l_node_text
is_outtab_line = ls_sflight
is_node_layout = ls_node
it_item_layout = lt_item_layout
importing
e_new_node_key = p_node_key.*
In the above can any one please explain about method add_node with parameters and where we are telling reletion between root and parent node.Also,explain what is field p_node_key which is node's key???
‎2010 May 26 2:30 PM
Hi Kishore,
'e_new_node_key' is the key you'll get when you will create a node.. and if you want to create child to this node you will have to pass the value returned in 'p_node_key' as i_relat_node_key value in next node.
call method tree1->add_node
exporting
i_relat_node_key = ' '
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = l_node_text
is_outtab_line = ls_sflight
is_node_layout = ls_node
it_item_layout = lt_item_layout
importing
e_new_node_key = p_node_key.
call method tree1->add_node
exporting
i_relat_node_key = p_node_key.
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = l_node_text
is_outtab_line = ls_sflight
is_node_layout = ls_node
it_item_layout = lt_item_layout
importing
e_new_node_key = p_node_key.*
‎2010 May 26 2:28 PM
Hi
You can check sample below to get more details about add_note method.
node_key_root = p_adir.
CLEAR item_table.
CLEAR item.
item-item_name = 'FOLDER'.
item-class = cl_column_tree_model=>item_class_text.
item-text = p_adir .
APPEND item TO item_table.
item-item_name = 'LOCATION'.
item-class = cl_column_tree_model=>item_class_text.
item-text = 'Root' .
APPEND item TO item_table.
isfolder_flag = c_x.
expander_flag = c_x.
CALL METHOD acol_treem->add_node
EXPORTING
node_key = node_key_root
isfolder = isfolder_flag
expander = expander_flag
item_table = item_table.Also, please check PDF file in [Column tree model|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/2ec457c4-0a01-0010-2bbc-c6e03a4a03d2?quicklink=index&overridelayout=true] where contins more examples and documentation about this
Kind regards
Carlos Machado
‎2010 May 26 2:30 PM
Hi Kishore,
'e_new_node_key' is the key you'll get when you will create a node.. and if you want to create child to this node you will have to pass the value returned in 'p_node_key' as i_relat_node_key value in next node.
call method tree1->add_node
exporting
i_relat_node_key = ' '
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = l_node_text
is_outtab_line = ls_sflight
is_node_layout = ls_node
it_item_layout = lt_item_layout
importing
e_new_node_key = p_node_key.
call method tree1->add_node
exporting
i_relat_node_key = p_node_key.
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = l_node_text
is_outtab_line = ls_sflight
is_node_layout = ls_node
it_item_layout = lt_item_layout
importing
e_new_node_key = p_node_key.*