<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic cl_salv_tree - Expand functionality not available in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/cl-salv-tree-expand-functionality-not-available/m-p/6277106#M1387623</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear SDN members,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to use CL_SALV_TREE in a very simple way. I only want a simple tree with two columns, in which I would like to be able to navigate to subnodes etc...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code I implemented is like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* Create instance
    CALL METHOD cl_salv_tree=&amp;gt;factory
      IMPORTING
        r_salv_tree = gr_tree
      CHANGING
        t_table     = it_produtos_cat.

* Get nodes reference
  gr_nodes = gr_tree-&amp;gt;get_nodes( ).

*Add first node 
  gr_node = gr_nodes-&amp;gt;add_node(
      related_node   = key       " empty at this moment
      relationship   = cl_salv_nodes=&amp;gt;if_salv_c_node_relation~parent
    data_row       = wa_produtos
    visible        = abap_true
  expander       = abap_true
    enabled        = abap_true
    folder         = abap_true ).

* Get Key of the node added
  key = gr_node-&amp;gt;get_key( ).

*Add first child 
  gr_node = gr_nodes-&amp;gt;add_node(
      related_node   = key       " key from the first node
      relationship   = cl_salv_nodes=&amp;gt;if_salv_c_node_relation~last_child
    data_row       = wa_produtos
    visible        = abap_true
  expander       = abap_true
    enabled        = abap_true
    folder         = abap_false ).

* display tree
  gr_tree-&amp;gt;display( ).
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At the moment I have two problems, the major problem is that I do not have a expander icon to expand the first node...actually in this version of my code I can only see the first node. I am quite sure the relation is ok, because when I you the method&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* Expand all nodes
  gr_nodes-&amp;gt;expand_all( ).
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;before display, all nodes apear. But all without expander icon and consequently it is not possible to expand or collapse the nodes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The other problem is that when I select one or more nodes, and execute method&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* Get selected nodes
gr_selections = gr_tree-&amp;gt;get_selections( ).
lt_nodes = gr_selections-&amp;gt;get_selected_nodes( ).
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The nodes table lt_nodes is always empty!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?! Specially for my first problem (Expander is not available) ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;MPM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S.: I tried already the method SET_EXPANDER of class cl_salv_node.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Marcelo Moreira on Nov 11, 2009 4:41 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Nov 2009 15:41:11 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-11-11T15:41:11Z</dc:date>
    <item>
      <title>cl_salv_tree - Expand functionality not available</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/cl-salv-tree-expand-functionality-not-available/m-p/6277106#M1387623</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear SDN members,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to use CL_SALV_TREE in a very simple way. I only want a simple tree with two columns, in which I would like to be able to navigate to subnodes etc...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code I implemented is like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* Create instance
    CALL METHOD cl_salv_tree=&amp;gt;factory
      IMPORTING
        r_salv_tree = gr_tree
      CHANGING
        t_table     = it_produtos_cat.

* Get nodes reference
  gr_nodes = gr_tree-&amp;gt;get_nodes( ).

*Add first node 
  gr_node = gr_nodes-&amp;gt;add_node(
      related_node   = key       " empty at this moment
      relationship   = cl_salv_nodes=&amp;gt;if_salv_c_node_relation~parent
    data_row       = wa_produtos
    visible        = abap_true
  expander       = abap_true
    enabled        = abap_true
    folder         = abap_true ).

* Get Key of the node added
  key = gr_node-&amp;gt;get_key( ).

*Add first child 
  gr_node = gr_nodes-&amp;gt;add_node(
      related_node   = key       " key from the first node
      relationship   = cl_salv_nodes=&amp;gt;if_salv_c_node_relation~last_child
    data_row       = wa_produtos
    visible        = abap_true
  expander       = abap_true
    enabled        = abap_true
    folder         = abap_false ).

* display tree
  gr_tree-&amp;gt;display( ).
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At the moment I have two problems, the major problem is that I do not have a expander icon to expand the first node...actually in this version of my code I can only see the first node. I am quite sure the relation is ok, because when I you the method&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* Expand all nodes
  gr_nodes-&amp;gt;expand_all( ).
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;before display, all nodes apear. But all without expander icon and consequently it is not possible to expand or collapse the nodes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The other problem is that when I select one or more nodes, and execute method&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* Get selected nodes
gr_selections = gr_tree-&amp;gt;get_selections( ).
lt_nodes = gr_selections-&amp;gt;get_selected_nodes( ).
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The nodes table lt_nodes is always empty!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?! Specially for my first problem (Expander is not available) ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;MPM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S.: I tried already the method SET_EXPANDER of class cl_salv_node.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Marcelo Moreira on Nov 11, 2009 4:41 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Nov 2009 15:41:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/cl-salv-tree-expand-functionality-not-available/m-p/6277106#M1387623</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-11T15:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: cl_salv_tree - Expand functionality not available</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/cl-salv-tree-expand-functionality-not-available/m-p/6277107#M1387624</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear SDN Members,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code I presented before actually is ok....but there are 2 lines missing. They seem to be not really important, but they make the diference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The two lines missing are:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
gr_columns = gr_tree-&amp;gt;get_columns( ).
gr_columns-&amp;gt;set_optimize( abap_true ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These two likes make the expander icon appear....if you do not have these two lines, no expander is shown!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, I still have the problem of the selected nodes method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas for the final problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Nov 2009 20:07:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/cl-salv-tree-expand-functionality-not-available/m-p/6277107#M1387624</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-11T20:07:45Z</dc:date>
    </item>
  </channel>
</rss>

