<?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 Re: Problem with alv tree in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-tree/m-p/7100136#M1508343</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI vivek,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the code below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;* type pool declarations for tree
TYPE-POOLS : fibs,stree.
*Data declaration for additional node information
DATA : t_node TYPE snodetext.
*Internal table and wa decl for nodes
DATA : it_node LIKE TABLE OF t_node INITIAL SIZE 0,
wa_node LIKE t_node.
*Internal table and wa decl for Education table PA0022
DATA : it_0022 TYPE STANDARD TABLE OF pa0022 INITIAL SIZE 0,
wa_0022 TYPE pa0022.
*Internal table and wa decl for text table t517x
DATA : it_517x TYPE STANDARD TABLE OF t517x INITIAL SIZE 0,
wa_517x TYPE t517x.
*Internal table and wa decl for text table t517T
DATA : it_517t TYPE STANDARD TABLE OF t517t INITIAL SIZE 0,
wa_517t TYPE t517t.
*Internal table and wa decl for text table t519T
DATA : it_519t TYPE STANDARD TABLE OF t519t INITIAL SIZE 0,
wa_519t TYPE t519t.
*initialization event
INITIALIZATION.
*Start of selection event
START-OF-SELECTION.
*Select the data for tree
  PERFORM fetch_data.
*Build the hierarchy for tree
  PERFORM build_hierarchy.
*Build Tree for display
  PERFORM build_tree.
*&amp;amp;--------------------------------------------------------------*
*&amp;amp; Form fetch_data
*&amp;amp;--------------------------------------------------------------*
* text
*---------------------------------------------------------------*
* --&amp;gt; p1 text
* &amp;lt;-- p2 text
*---------------------------------------------------------------*
FORM fetch_data .
*select data from PA0022
  SELECT * FROM pa0022 INTO CORRESPONDING FIELDS OF TABLE it_0022
  UP TO 50 ROWS.
*select data from T517x
  SELECT * FROM t517x INTO CORRESPONDING FIELDS OF TABLE it_517x
  WHERE langu = 'E'.
*select data from T517T
  SELECT * FROM t517t INTO CORRESPONDING FIELDS OF TABLE it_517t
  WHERE sprsl = 'E'.
*select data from T519t
  SELECT * FROM t519t INTO CORRESPONDING FIELDS OF TABLE it_519t
  WHERE sprsl = 'E'.
ENDFORM. " fetch_data
*&amp;amp;----------------------------------------------------------------*
*&amp;amp; Form build_hierarchy
*&amp;amp;----------------------------------------------------------------*
FORM build_hierarchy .
*Building the nodes and hierarchy for tree
  CLEAR : it_node[],
  wa_node.

  wa_node-type = 'T'.
  wa_node-name = 'Education'.
  wa_node-tlevel = '01'.
  wa_node-nlength = '15'.
  wa_node-color = '4'.
  wa_node-text = 'Infotype 0022'.
  wa_node-tlength ='20'.
  wa_node-tcolor = 3.
  APPEND wa_node TO it_node.
  CLEAR wa_node.
*Filling the values of internal table into tree
  LOOP AT it_0022 INTO wa_0022.
    wa_node-type = 'P'.
    wa_node-name = 'PERNR'.
    wa_node-tlevel = '02'.
    wa_node-nlength = '8'.
    wa_node-color = '1'.
    wa_node-text = wa_0022-pernr.
    wa_node-tlength ='20'.
    wa_node-tcolor = 4.
    APPEND wa_node TO it_node.
    CLEAR wa_node.
*Filling the text of T517t
    READ TABLE it_517t INTO wa_517t WITH KEY slart = wa_0022-slart.
    wa_node-type = 'P'.
    wa_node-name = wa_0022-slart.
    wa_node-tlevel = '03'.
    wa_node-nlength = '8'.
    wa_node-color = '1'.
    wa_node-text = wa_517t-stext.
    wa_node-tlength ='40'.
    wa_node-tcolor = 4.
    APPEND wa_node TO it_node.
    CLEAR wa_node.
*Filling the text of T519t
    READ TABLE it_519t INTO wa_519t WITH KEY slabs = wa_0022-slabs.
    wa_node-type = 'P'.
    wa_node-name = wa_0022-slabs.
    wa_node-tlevel = '04'.
    wa_node-nlength = '8'.
    wa_node-color = '2'.
    wa_node-text = wa_519t-stext.
    wa_node-tlength ='40'.
    wa_node-tcolor = 4.
    APPEND wa_node TO it_node.
    CLEAR wa_node.
*Filling the text of T517x
    READ TABLE it_517x INTO wa_517x WITH KEY faart = wa_0022-sltp1.
    wa_node-type = 'P'.
    wa_node-name = wa_0022-sltp1.
    wa_node-tlevel = '05'.
    wa_node-nlength = '8'.
    wa_node-color = '1'.
    wa_node-text = wa_517x-ftext.
    wa_node-tlength ='40'.
    wa_node-tcolor = 4.
    APPEND wa_node TO it_node.
    CLEAR wa_node.

    wa_node-type = 'P'.
    wa_node-tlevel = '06'.
    wa_node-nlength = '8'.
    wa_node-color = '1'.
    wa_node-text = '% Completed'.
    wa_node-tlength ='15'.
    wa_node-tcolor = 4.
    APPEND wa_node TO it_node.
    CLEAR wa_node.
  ENDLOOP.
ENDFORM. " build_hierarchy
*&amp;amp;---------------------------------------------------------------*
*&amp;amp; Form build_tree
*&amp;amp;---------------------------------------------------------------*

FORM build_tree .
*Fm for constructing the tree
  CALL FUNCTION 'RS_TREE_CONSTRUCT'
    TABLES
      nodetab = it_node.
  IF sy-subrc &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
*FM for displaying the tree
  CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
    EXPORTING
      callback_program     = sy-repid
      check_duplicate_name = '1'
      color_of_node        = '4'
      color_of_mark        = '3'
      color_of_link        = '1'
      color_of_match       = '5'
      node_length          = 30
      text_length          = 75
      use_control          = 'L'.
ENDFORM. " build_tree&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 Jul 2010 12:26:15 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-07-27T12:26:15Z</dc:date>
    <item>
      <title>Problem with alv tree</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-tree/m-p/7100133#M1508340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;I'm working on an alv tree in a modal dialog.I am adding the heirarchy structure.But only one level is showing.&lt;/P&gt;&lt;P&gt;I mean only fodlers are showing.No data is being displayed.If i add another folder on top of these folders,&lt;/P&gt;&lt;P&gt;then even these folders dont display.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Jul 2010 07:53:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-tree/m-p/7100133#M1508340</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-07-20T07:53:42Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with alv tree</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-tree/m-p/7100134#M1508341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What do you mean by "hierarchy structure"? If you meant hierarchy header, that is only the header for the tree part itself, not the ALV part of the control. Or do you mean that you already see the root node in your tree, but no children?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you have a look at the ALV_TREE demos? E.g. BCALV_TREE_01 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you provide further information on what you have done and where exactly you are stuck, I can probably support you a bit more.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jul 2010 11:41:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-tree/m-p/7100134#M1508341</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-07-27T11:41:30Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with alv tree</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-tree/m-p/7100135#M1508342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;few simple stepd to build hierarachy tree structure in ALV&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Fill the final internal table to be displayed.&lt;/P&gt;&lt;P&gt;2. Build the fieldcatalog.&lt;/P&gt;&lt;P&gt;3. loop the final internal table and add nodes according to the fields which you want to display in the hierarchy.&lt;/P&gt;&lt;P&gt;    for example&lt;/P&gt;&lt;P&gt;    here i have two hierarchy levels and using two different internal tables, the code as follows&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    loop at it_tab into wa_tab.&lt;/P&gt;&lt;P&gt;    perform add_itab_node using      wa_tab&lt;/P&gt;&lt;P&gt;                                     ''&lt;/P&gt;&lt;P&gt;                            changing l_profile_key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    loop at IT_FINAL into WA_FINAL where profile eq wa_tab-profile.&lt;/P&gt;&lt;P&gt;      perform add_itab1_line using      WA_FINAL&lt;/P&gt;&lt;P&gt;                                       l_profile_key&lt;/P&gt;&lt;P&gt;                              changing l_posnr_key.&lt;/P&gt;&lt;P&gt;    endloop.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. under the performs use the method add_node to add the node for the tree&lt;/P&gt;&lt;P&gt;    find the below code in the performs&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;    orm add_carrid_line using     ps_HEADER type TY_FINAL&lt;/P&gt;&lt;P&gt;                               p_relat_key type lvc_nkey&lt;/P&gt;&lt;P&gt;                     changing  p_node_key type lvc_nkey.&lt;/P&gt;&lt;P&gt;  data: l_node_text type lvc_value,&lt;/P&gt;&lt;P&gt;        ls_HEADER type TY_FINAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;set item-layout&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  data: lt_item_layout type lvc_t_layi,&lt;/P&gt;&lt;P&gt;        ls_item_layout type lvc_s_layi.&lt;/P&gt;&lt;P&gt;  ls_item_layout-t_image = '@3P@'.&lt;/P&gt;&lt;P&gt;  ls_item_layout-fieldname = tree1-&amp;gt;c_hierarchy_column_name.&lt;/P&gt;&lt;P&gt;  ls_item_layout-style   =&lt;/P&gt;&lt;P&gt;                        cl_gui_column_tree=&amp;gt;style_intensifd_critical.&lt;/P&gt;&lt;P&gt;  append ls_item_layout to lt_item_layout.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;add node&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  l_node_text =  ps_HEADER-PROFILE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  data: ls_node type lvc_s_layn.&lt;/P&gt;&lt;P&gt;  ls_node-n_image   = space.&lt;/P&gt;&lt;P&gt;  ls_node-exp_image = space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call method tree1-&amp;gt;add_node&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      i_relat_node_key = p_relat_key&lt;/P&gt;&lt;P&gt;      i_relationship   = cl_gui_column_tree=&amp;gt;relat_last_child&lt;/P&gt;&lt;P&gt;      i_node_text      = l_node_text&lt;/P&gt;&lt;P&gt;      is_outtab_line   = ls_HEADER&lt;/P&gt;&lt;P&gt;      is_node_layout   = ls_node&lt;/P&gt;&lt;P&gt;      it_item_layout   = lt_item_layout&lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      e_new_node_key   = p_node_key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.                               " add_carrid_line&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5. use the node_key values to display the child or parent nodes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;sirisha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jul 2010 12:02:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-tree/m-p/7100135#M1508342</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-07-27T12:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with alv tree</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-tree/m-p/7100136#M1508343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI vivek,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the code below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;* type pool declarations for tree
TYPE-POOLS : fibs,stree.
*Data declaration for additional node information
DATA : t_node TYPE snodetext.
*Internal table and wa decl for nodes
DATA : it_node LIKE TABLE OF t_node INITIAL SIZE 0,
wa_node LIKE t_node.
*Internal table and wa decl for Education table PA0022
DATA : it_0022 TYPE STANDARD TABLE OF pa0022 INITIAL SIZE 0,
wa_0022 TYPE pa0022.
*Internal table and wa decl for text table t517x
DATA : it_517x TYPE STANDARD TABLE OF t517x INITIAL SIZE 0,
wa_517x TYPE t517x.
*Internal table and wa decl for text table t517T
DATA : it_517t TYPE STANDARD TABLE OF t517t INITIAL SIZE 0,
wa_517t TYPE t517t.
*Internal table and wa decl for text table t519T
DATA : it_519t TYPE STANDARD TABLE OF t519t INITIAL SIZE 0,
wa_519t TYPE t519t.
*initialization event
INITIALIZATION.
*Start of selection event
START-OF-SELECTION.
*Select the data for tree
  PERFORM fetch_data.
*Build the hierarchy for tree
  PERFORM build_hierarchy.
*Build Tree for display
  PERFORM build_tree.
*&amp;amp;--------------------------------------------------------------*
*&amp;amp; Form fetch_data
*&amp;amp;--------------------------------------------------------------*
* text
*---------------------------------------------------------------*
* --&amp;gt; p1 text
* &amp;lt;-- p2 text
*---------------------------------------------------------------*
FORM fetch_data .
*select data from PA0022
  SELECT * FROM pa0022 INTO CORRESPONDING FIELDS OF TABLE it_0022
  UP TO 50 ROWS.
*select data from T517x
  SELECT * FROM t517x INTO CORRESPONDING FIELDS OF TABLE it_517x
  WHERE langu = 'E'.
*select data from T517T
  SELECT * FROM t517t INTO CORRESPONDING FIELDS OF TABLE it_517t
  WHERE sprsl = 'E'.
*select data from T519t
  SELECT * FROM t519t INTO CORRESPONDING FIELDS OF TABLE it_519t
  WHERE sprsl = 'E'.
ENDFORM. " fetch_data
*&amp;amp;----------------------------------------------------------------*
*&amp;amp; Form build_hierarchy
*&amp;amp;----------------------------------------------------------------*
FORM build_hierarchy .
*Building the nodes and hierarchy for tree
  CLEAR : it_node[],
  wa_node.

  wa_node-type = 'T'.
  wa_node-name = 'Education'.
  wa_node-tlevel = '01'.
  wa_node-nlength = '15'.
  wa_node-color = '4'.
  wa_node-text = 'Infotype 0022'.
  wa_node-tlength ='20'.
  wa_node-tcolor = 3.
  APPEND wa_node TO it_node.
  CLEAR wa_node.
*Filling the values of internal table into tree
  LOOP AT it_0022 INTO wa_0022.
    wa_node-type = 'P'.
    wa_node-name = 'PERNR'.
    wa_node-tlevel = '02'.
    wa_node-nlength = '8'.
    wa_node-color = '1'.
    wa_node-text = wa_0022-pernr.
    wa_node-tlength ='20'.
    wa_node-tcolor = 4.
    APPEND wa_node TO it_node.
    CLEAR wa_node.
*Filling the text of T517t
    READ TABLE it_517t INTO wa_517t WITH KEY slart = wa_0022-slart.
    wa_node-type = 'P'.
    wa_node-name = wa_0022-slart.
    wa_node-tlevel = '03'.
    wa_node-nlength = '8'.
    wa_node-color = '1'.
    wa_node-text = wa_517t-stext.
    wa_node-tlength ='40'.
    wa_node-tcolor = 4.
    APPEND wa_node TO it_node.
    CLEAR wa_node.
*Filling the text of T519t
    READ TABLE it_519t INTO wa_519t WITH KEY slabs = wa_0022-slabs.
    wa_node-type = 'P'.
    wa_node-name = wa_0022-slabs.
    wa_node-tlevel = '04'.
    wa_node-nlength = '8'.
    wa_node-color = '2'.
    wa_node-text = wa_519t-stext.
    wa_node-tlength ='40'.
    wa_node-tcolor = 4.
    APPEND wa_node TO it_node.
    CLEAR wa_node.
*Filling the text of T517x
    READ TABLE it_517x INTO wa_517x WITH KEY faart = wa_0022-sltp1.
    wa_node-type = 'P'.
    wa_node-name = wa_0022-sltp1.
    wa_node-tlevel = '05'.
    wa_node-nlength = '8'.
    wa_node-color = '1'.
    wa_node-text = wa_517x-ftext.
    wa_node-tlength ='40'.
    wa_node-tcolor = 4.
    APPEND wa_node TO it_node.
    CLEAR wa_node.

    wa_node-type = 'P'.
    wa_node-tlevel = '06'.
    wa_node-nlength = '8'.
    wa_node-color = '1'.
    wa_node-text = '% Completed'.
    wa_node-tlength ='15'.
    wa_node-tcolor = 4.
    APPEND wa_node TO it_node.
    CLEAR wa_node.
  ENDLOOP.
ENDFORM. " build_hierarchy
*&amp;amp;---------------------------------------------------------------*
*&amp;amp; Form build_tree
*&amp;amp;---------------------------------------------------------------*

FORM build_tree .
*Fm for constructing the tree
  CALL FUNCTION 'RS_TREE_CONSTRUCT'
    TABLES
      nodetab = it_node.
  IF sy-subrc &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
*FM for displaying the tree
  CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
    EXPORTING
      callback_program     = sy-repid
      check_duplicate_name = '1'
      color_of_node        = '4'
      color_of_mark        = '3'
      color_of_link        = '1'
      color_of_match       = '5'
      node_length          = 30
      text_length          = 75
      use_control          = 'L'.
ENDFORM. " build_tree&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jul 2010 12:26:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-tree/m-p/7100136#M1508343</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-07-27T12:26:15Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with alv tree</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-tree/m-p/7100137#M1508344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Found solution&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jan 2012 06:39:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-alv-tree/m-p/7100137#M1508344</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-12T06:39:17Z</dc:date>
    </item>
  </channel>
</rss>

