06-19-2010 2:15 AM
Hi!
How can i get name of double clicked Item in ALV Tree?
I found only this:
METHODS handle_item_double_click
FOR EVENT item_double_click OF cl_gui_alv_tree
IMPORTING node_key
fieldname.
METHOD handle_item_double_click.
double_click_node_key = node_key.
item_fieldname = fieldname.
MESSAGE s398(00) WITH fieldname.
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'DBCL'.
But this is giving me only the node key and the field name of clicked item (i.e "CARRID", "CONNID"). I want to get the name of clicked item (i.e. "LH", "5578"m etc.)
I know that this is possible when you create a tree with this method:
call method g_tree->add_nodes_and_items
exporting
node_table = node_table
item_table = item_table
item_table_structure_name = 'MTREEITM'
exceptions
failed = 1
cntl_system_error = 3
error_in_tables = 4
dp_error = 5
table_structure_name_not_found = 6.
if sy-subrc <> 0.
message a000(tree_control_msg).
endif.
endmethod.
becouse then you have a table with node keys and item names, but my tree is created by looping this:
form add_ekko_node using ps_ekko like wa_ekko
value(p_relate_key)
changing p_node_key.
data: ld_node_text type lvc_value,
ls_sflight type sflight.
* Set item-layout
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 = gd_tree->c_hierarchy_column_name.
ls_item_layout-style = cl_gui_column_tree=>style_default.
ld_node_text = ps_ekko-carrid.
append ls_item_layout to lt_item_layout.
* Add node
call method gd_tree->add_node
exporting
i_relat_node_key = p_relate_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = ld_node_text
is_outtab_line = ps_ekko
it_item_layout = lt_item_layout
importing
e_new_node_key = p_node_key.
endform. " ADD_EKKO_NODE
So, can i get the name of clicked item with tree constructed that way?
Best regards,
Przemek
Edited by: hamsterman on Jun 19, 2010 1:57 PM
06-21-2010 10:59 AM
Hi ,
Use below method to get the node text. You get_outtab_line method to get the node_text.
06-21-2010 10:59 AM
Hi ,
Use below method to get the node text. You get_outtab_line method to get the node_text.
06-21-2010 11:00 AM
Hi ,
Use below method to get the node text. You get_outtab_line method to get the node_text.
CALL METHOD atree_0100->get_outtab_line
EXPORTING
i_node_key = p_node
IMPORTING
e_outtab_line = wf_tree_data
e_node_text = wf_node_text
et_item_layout = int_item_layout
es_node_layout = wf_s_node_layout.
Alternatively, you can build an internal table of nodes and their corresponding texts as you are building the tree. When you double click get the node key and read the internal table for the text.
Thanks and Best Regards,