Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

NODE_KEY in cl_salv_tree_events??

former_member194669
Active Contributor
0 Kudos

Hi,

I am writing a report using CL_SALV_TREE. My probem is if i double click on the tree then i want to know to how to get the record from the internal table behind the tree using this key that we are getting once we double click on any node (ie NODE_KEY ).

please see my code below

I am using a docking container to display in the left side of screen i am displaying the tree.

 

  create object g_docking_container_1
    exporting
      repid     = g_repid
      dynnr     = '300'
      extension = 205
      side      = cl_gui_docking_container=>dock_at_left.

  create object g_docking_container_2
    exporting
      repid     = g_repid
      dynnr     = '300'
      extension = 160
      side      = cl_gui_docking_container=>dock_at_top.

  call method cl_salv_tree=>factory
    exporting
      r_container = g_docking_container_1
    importing
      r_salv_tree = grt_tree
    changing
      t_table     = i_ylactctic1.

  grt_functions = grt_tree->get_functions( ).
  grt_functions->set_all( abap_true ).
  grt_display = grt_tree->get_tree_settings( ).

  grt_nodes = grt_tree->get_nodes( ).

  grt_columns = grt_tree->get_columns( ).
  grt_column ?= grt_columns->get_column( 'MANDT' ).


  perform f_build_tree_header.
  perform f_build_tree_info.
  perform f_build_tree_events.

  grt_tree->display( ).


form f_build_tree_events.
  data: lr_events type ref to cl_salv_events_tree.
  lr_events = grt_tree->get_event( ).
  create object grt_events.
  set handler grt_events->on_double_click for lr_events.

  try.
      lr_events->add_key_for_keypress( if_salv_c_keys=>f4 ).
      lr_events->add_key_for_keypress( if_salv_c_keys=>enter ).
    catch cx_salv_msg.
  endtry.
endform.                                 


class lcl_handle_events definition.
  public section.
    methods:
      on_double_click for event double_click of cl_salv_events_tree
        importing node_key columnname.
endclass.                   


class lcl_handle_events implementation.
  method on_double_click.
  perform f_show_event_info using node_key columnname text-i06.
          
  endmethod.                   


endclass.                   


form f_show_event_info using i_node_key   type salv_de_node_key
                             i_columnname type lvc_fname
                             i_text       type string.
  data: l_string type string.
  "<< Here i am getting the NODE_KEY , i have checked its have some
  "<< numeric value but i don't know using this how to read the
  "<< internal table behind the tree
  
  break-point.
endform.                                 

Any help will be appreciated.

2 REPLIES 2

former_member194669
Active Contributor
0 Kudos

Solved by myself.

0 Kudos

Hey!

Can you tell me how you solved it? Got the same probleme here...

Thank you very much!