Application Development and Automation 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: 
Read only

SALV Tree Issue

former_member194669
Active Contributor
0 Likes
472

Hi,

I am using SALV tree in a docking container , This is my problem


Currently tree displayed this way 

TIC Data       | Version | Docno |
B                 04        1000 
  5QY02           04        1000 
     **           04        1000
R                 01        1001 
  003JH           01        1001  
     **           01        1001
     **           XX        1001

" i want the tree to be displayed like this way

TIC Data       | Docno |
B                1000 
  5QY02          1000 
     ** 04       1000

R                1001 
  003JH          1001  
     ** 01       1001
     ** xx       1001

" Here ** are the small page ICONs as displayed as last node

Following is the code for creating the nodes


*&---------------------------------------------------------------------*
* Form f_add_dcode_line                                                *
*&---------------------------------------------------------------------*
* This will build node for designcode                                  *
*----------------------------------------------------------------------*
form f_add_dcode_line  using    p_ls_data type ylactctic
                               p_key
                      changing p_l_dcode_key.
  data: nodes type ref to cl_salv_nodes,
        node type ref to cl_salv_node,
        text type lvc_value,
        item type ref to cl_salv_item.
  nodes = grt_tree->get_nodes( ).
  try.
      node = nodes->add_node( related_node = p_key
                              relationship =
   cl_gui_column_tree=>relat_last_child ).
      text = p_ls_data-designcode.
      node->set_text( text ).
      node->set_data_row( p_ls_data ).
      item = node->get_hierarchy_item( ).
      item->set_type( if_salv_c_item_type=>link ).
      item = node->get_item( 'DESIGNCODE' ).
      item->set_type( if_salv_c_item_type=>button ).
      p_l_dcode_key = node->get_key( ).
    catch cx_salv_msg.
  endtry.
endform.                                 " F_add_dcode_line
*
*&---------------------------------------------------------------------*
* Form f_add_tcode_line                                                *
*&---------------------------------------------------------------------*
* This will build node for TIC code                                    *
*----------------------------------------------------------------------*
form f_add_tcode_line using    p_ls_data type ylactctic
                               p_l_dcode_key
                      changing p_l_tcode_key.
  data: nodes type ref to cl_salv_nodes,
        node type ref to cl_salv_node,
        text type lvc_value.
  nodes = grt_tree->get_nodes( ).
  try.
      text = p_ls_data-ticcode.
      node = nodes->add_node( related_node = p_l_dcode_key
                              data_row     = p_ls_data
                              text         = text
                              relationship =
   cl_gui_column_tree=>relat_last_child ).
      p_l_tcode_key = node->get_key( ).
    catch cx_salv_msg.
  endtry.
endform.                                 " F_add_tcode_line
*
*&---------------------------------------------------------------------*
* Form f_add_tvers_line                                                *
*&---------------------------------------------------------------------*
* This will build node for TIC code                                    *
*----------------------------------------------------------------------*
form f_add_tvers_line  using    p_ls_data type ylactctic
                                p_l_tcode_key
                       changing p_l_tvers_key.

  data: nodes type ref to cl_salv_nodes,
        node type ref to cl_salv_node.
  nodes = grt_tree->get_nodes( ).
  try.
      node = nodes->add_node( related_node = p_l_tcode_key
                          data_row     = p_ls_data
         relationship = cl_gui_column_tree=>relat_last_child ).
      p_l_tvers_key = node->get_key( ).
    catch cx_salv_msg.
  endtry.

endform.                                 " F_add_tvers_line
*

Any help will be appreciated

a®

2 REPLIES 2
Read only

former_member194669
Active Contributor
0 Likes
402

Any takers?

a®

Read only

0 Likes
402

Hi,

I solved myself.

Here is the modified code . While creating last node we have to pass the value along with relationship for CHILD.


  v_text = p_ls_data-ticversion.
  try.
      node = nodes->add_node( related_node = p_l_tcode_key
                          data_row     = p_ls_data
                          text         = v_text "<<< -------
         relationship = cl_gui_column_tree=>relat_last_child ).
      p_l_tvers_key = node->get_key( ).
    catch cx_salv_msg.
  endtry.

a®