<?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 Building Tree hierarchy Using nested loops and class cl_gui_column_tree in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/building-tree-hierarchy-using-nested-loops-and-class-cl-gui-column-tree/m-p/8089498#M1615297</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to create a tree report using custom container and class cl_gui_column_tree. I have read and understood the standard demo report which SAP has provided i.e. SAPCOLUMN_TREE_CONTROL_DEMO. But in this report all the levels nodes are created as constants and hardcoded. I want to create hierarchy using nested loops. For this i took one example of a hierarchy of VBAK-VBELN-&amp;gt;VBAP-POSNR Like One sales order has many line items and each line item can have number of line items in billing plan. &lt;/P&gt;&lt;P&gt;I have done some coding for it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM build_tree USING node_table TYPE treev_ntab&lt;/P&gt;&lt;P&gt;                                       item_table TYPE zitem_table.              " i created the zitem_table table type of mtreeitm in SE11.&lt;/P&gt;&lt;P&gt;  DATA: node TYPE treev_node,&lt;/P&gt;&lt;P&gt;             item TYPE mtreeitm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  node-node_key = root.&lt;/P&gt;&lt;P&gt;  CLEAR node-relatkey.&lt;/P&gt;&lt;P&gt;  CLEAR node-relatship.&lt;/P&gt;&lt;P&gt;  node-hidden = ' '.&lt;/P&gt;&lt;P&gt;  node-disabled = ' '.&lt;/P&gt;&lt;P&gt;  CLEAR node-n_image.&lt;/P&gt;&lt;P&gt;  CLEAR node-exp_image.&lt;/P&gt;&lt;P&gt;  node-isfolder = 'X'.&lt;/P&gt;&lt;P&gt;  node-expander = 'X'.&lt;/P&gt;&lt;P&gt;  APPEND node TO node_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  item-node_key = root.&lt;/P&gt;&lt;P&gt;  item-item_name = colm1.&lt;/P&gt;&lt;P&gt;  item-class = cl_gui_column_tree=&amp;gt;item_class_text.&lt;/P&gt;&lt;P&gt;  item-text = 'Root'.&lt;/P&gt;&lt;P&gt;  APPEND item TO item_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  item-node_key = root.&lt;/P&gt;&lt;P&gt;  item-item_name = colm2.&lt;/P&gt;&lt;P&gt;  item-class = cl_gui_column_tree=&amp;gt;item_class_text.&lt;/P&gt;&lt;P&gt;  item-text = 'Amount'.&lt;/P&gt;&lt;P&gt;  APPEND item TO item_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT it_vbeln INTO wa_vbeln.&lt;/P&gt;&lt;P&gt;    node-node_key = wa_vbeln-vbeln.&lt;/P&gt;&lt;P&gt;    node-relatkey = root.&lt;/P&gt;&lt;P&gt;    node-relatship = cl_gui_column_tree=&amp;gt;relat_last_child.&lt;/P&gt;&lt;P&gt;    node-hidden = ' '.&lt;/P&gt;&lt;P&gt;    node-disabled = ' '.&lt;/P&gt;&lt;P&gt;    CLEAR node-n_image.&lt;/P&gt;&lt;P&gt;    CLEAR node-exp_image.&lt;/P&gt;&lt;P&gt;    node-isfolder = 'X'.&lt;/P&gt;&lt;P&gt;    node-expander = 'X'.&lt;/P&gt;&lt;P&gt;    APPEND node TO node_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    item-node_key = wa_vbeln-vbeln.&lt;/P&gt;&lt;P&gt;    item-item_name = colm1.&lt;/P&gt;&lt;P&gt;    item-class = cl_gui_column_tree=&amp;gt;item_class_text.&lt;/P&gt;&lt;P&gt;    item-text = wa_vbeln-vbeln.&lt;/P&gt;&lt;P&gt;    APPEND item TO item_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    item-node_key = wa_vbeln-vbeln.&lt;/P&gt;&lt;P&gt;    item-item_name = colm2.&lt;/P&gt;&lt;P&gt;    item-class = cl_gui_column_tree=&amp;gt;item_class_text.&lt;/P&gt;&lt;P&gt;    item-text = wa_vbeln-netwr.&lt;/P&gt;&lt;P&gt;    APPEND item TO item_table.&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;    LOOP AT it_posnr INTO wa_posnr.&lt;/P&gt;&lt;P&gt;    node-node_key = wa_posnr-posnr.&lt;/P&gt;&lt;P&gt;    node-relatkey = wa_vbeln-vbeln.&lt;/P&gt;&lt;P&gt;    node-relatship = cl_gui_column_tree=&amp;gt;relat_last_child.&lt;/P&gt;&lt;P&gt;    node-hidden = ' '.&lt;/P&gt;&lt;P&gt;    node-disabled = ' '.&lt;/P&gt;&lt;P&gt;    CLEAR node-n_image.&lt;/P&gt;&lt;P&gt;    CLEAR node-exp_image.&lt;/P&gt;&lt;P&gt;    node-isfolder = ' '.&lt;/P&gt;&lt;P&gt;    node-expander = ' '.&lt;/P&gt;&lt;P&gt;    APPEND node TO node_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    item-node_key = wa_posnr-posnr.&lt;/P&gt;&lt;P&gt;    item-item_name = colm1.&lt;/P&gt;&lt;P&gt;    item-class = cl_gui_column_tree=&amp;gt;item_class_text.&lt;/P&gt;&lt;P&gt;    item-text = wa_posnr-posnr.&lt;/P&gt;&lt;P&gt;    APPEND item TO item_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    item-node_key = wa_posnr-posnr.&lt;/P&gt;&lt;P&gt;    item-item_name = colm2.&lt;/P&gt;&lt;P&gt;    item-class = cl_gui_column_tree=&amp;gt;item_class_text.&lt;/P&gt;&lt;P&gt;    item-text = wa_posnr-netpr.&lt;/P&gt;&lt;P&gt;    APPEND item TO item_table.&lt;/P&gt;&lt;P&gt;    &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;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now this program compiles fine and runs till there is only one level. That is root-&amp;gt;vbeln. But when i add one more loop of it_posnr it gives me runtime error of message type 'X'. The problem i found was uniqueness of item-item_name as all the sales order have posnr = 0010. What could be done? I tried giving item_name unique hierarchy level using counters just like stufe field in prps eg. 10.10.10, 10.10.20,10.20.10,10.20.20,20.10.10 etc.. etc.. but still i am getting runtime error when i add one more hierarchy using nested loop. Plz guide.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Yayati6260 on Jul 14, 2011 7:25 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 Jul 2011 05:25:23 GMT</pubDate>
    <dc:creator>YayatiEkbote</dc:creator>
    <dc:date>2011-07-13T05:25:23Z</dc:date>
    <item>
      <title>Building Tree hierarchy Using nested loops and class cl_gui_column_tree</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/building-tree-hierarchy-using-nested-loops-and-class-cl-gui-column-tree/m-p/8089498#M1615297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to create a tree report using custom container and class cl_gui_column_tree. I have read and understood the standard demo report which SAP has provided i.e. SAPCOLUMN_TREE_CONTROL_DEMO. But in this report all the levels nodes are created as constants and hardcoded. I want to create hierarchy using nested loops. For this i took one example of a hierarchy of VBAK-VBELN-&amp;gt;VBAP-POSNR Like One sales order has many line items and each line item can have number of line items in billing plan. &lt;/P&gt;&lt;P&gt;I have done some coding for it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM build_tree USING node_table TYPE treev_ntab&lt;/P&gt;&lt;P&gt;                                       item_table TYPE zitem_table.              " i created the zitem_table table type of mtreeitm in SE11.&lt;/P&gt;&lt;P&gt;  DATA: node TYPE treev_node,&lt;/P&gt;&lt;P&gt;             item TYPE mtreeitm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  node-node_key = root.&lt;/P&gt;&lt;P&gt;  CLEAR node-relatkey.&lt;/P&gt;&lt;P&gt;  CLEAR node-relatship.&lt;/P&gt;&lt;P&gt;  node-hidden = ' '.&lt;/P&gt;&lt;P&gt;  node-disabled = ' '.&lt;/P&gt;&lt;P&gt;  CLEAR node-n_image.&lt;/P&gt;&lt;P&gt;  CLEAR node-exp_image.&lt;/P&gt;&lt;P&gt;  node-isfolder = 'X'.&lt;/P&gt;&lt;P&gt;  node-expander = 'X'.&lt;/P&gt;&lt;P&gt;  APPEND node TO node_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  item-node_key = root.&lt;/P&gt;&lt;P&gt;  item-item_name = colm1.&lt;/P&gt;&lt;P&gt;  item-class = cl_gui_column_tree=&amp;gt;item_class_text.&lt;/P&gt;&lt;P&gt;  item-text = 'Root'.&lt;/P&gt;&lt;P&gt;  APPEND item TO item_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  item-node_key = root.&lt;/P&gt;&lt;P&gt;  item-item_name = colm2.&lt;/P&gt;&lt;P&gt;  item-class = cl_gui_column_tree=&amp;gt;item_class_text.&lt;/P&gt;&lt;P&gt;  item-text = 'Amount'.&lt;/P&gt;&lt;P&gt;  APPEND item TO item_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT it_vbeln INTO wa_vbeln.&lt;/P&gt;&lt;P&gt;    node-node_key = wa_vbeln-vbeln.&lt;/P&gt;&lt;P&gt;    node-relatkey = root.&lt;/P&gt;&lt;P&gt;    node-relatship = cl_gui_column_tree=&amp;gt;relat_last_child.&lt;/P&gt;&lt;P&gt;    node-hidden = ' '.&lt;/P&gt;&lt;P&gt;    node-disabled = ' '.&lt;/P&gt;&lt;P&gt;    CLEAR node-n_image.&lt;/P&gt;&lt;P&gt;    CLEAR node-exp_image.&lt;/P&gt;&lt;P&gt;    node-isfolder = 'X'.&lt;/P&gt;&lt;P&gt;    node-expander = 'X'.&lt;/P&gt;&lt;P&gt;    APPEND node TO node_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    item-node_key = wa_vbeln-vbeln.&lt;/P&gt;&lt;P&gt;    item-item_name = colm1.&lt;/P&gt;&lt;P&gt;    item-class = cl_gui_column_tree=&amp;gt;item_class_text.&lt;/P&gt;&lt;P&gt;    item-text = wa_vbeln-vbeln.&lt;/P&gt;&lt;P&gt;    APPEND item TO item_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    item-node_key = wa_vbeln-vbeln.&lt;/P&gt;&lt;P&gt;    item-item_name = colm2.&lt;/P&gt;&lt;P&gt;    item-class = cl_gui_column_tree=&amp;gt;item_class_text.&lt;/P&gt;&lt;P&gt;    item-text = wa_vbeln-netwr.&lt;/P&gt;&lt;P&gt;    APPEND item TO item_table.&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;    LOOP AT it_posnr INTO wa_posnr.&lt;/P&gt;&lt;P&gt;    node-node_key = wa_posnr-posnr.&lt;/P&gt;&lt;P&gt;    node-relatkey = wa_vbeln-vbeln.&lt;/P&gt;&lt;P&gt;    node-relatship = cl_gui_column_tree=&amp;gt;relat_last_child.&lt;/P&gt;&lt;P&gt;    node-hidden = ' '.&lt;/P&gt;&lt;P&gt;    node-disabled = ' '.&lt;/P&gt;&lt;P&gt;    CLEAR node-n_image.&lt;/P&gt;&lt;P&gt;    CLEAR node-exp_image.&lt;/P&gt;&lt;P&gt;    node-isfolder = ' '.&lt;/P&gt;&lt;P&gt;    node-expander = ' '.&lt;/P&gt;&lt;P&gt;    APPEND node TO node_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    item-node_key = wa_posnr-posnr.&lt;/P&gt;&lt;P&gt;    item-item_name = colm1.&lt;/P&gt;&lt;P&gt;    item-class = cl_gui_column_tree=&amp;gt;item_class_text.&lt;/P&gt;&lt;P&gt;    item-text = wa_posnr-posnr.&lt;/P&gt;&lt;P&gt;    APPEND item TO item_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    item-node_key = wa_posnr-posnr.&lt;/P&gt;&lt;P&gt;    item-item_name = colm2.&lt;/P&gt;&lt;P&gt;    item-class = cl_gui_column_tree=&amp;gt;item_class_text.&lt;/P&gt;&lt;P&gt;    item-text = wa_posnr-netpr.&lt;/P&gt;&lt;P&gt;    APPEND item TO item_table.&lt;/P&gt;&lt;P&gt;    &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;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now this program compiles fine and runs till there is only one level. That is root-&amp;gt;vbeln. But when i add one more loop of it_posnr it gives me runtime error of message type 'X'. The problem i found was uniqueness of item-item_name as all the sales order have posnr = 0010. What could be done? I tried giving item_name unique hierarchy level using counters just like stufe field in prps eg. 10.10.10, 10.10.20,10.20.10,10.20.20,20.10.10 etc.. etc.. but still i am getting runtime error when i add one more hierarchy using nested loop. Plz guide.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Yayati6260 on Jul 14, 2011 7:25 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2011 05:25:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/building-tree-hierarchy-using-nested-loops-and-class-cl-gui-column-tree/m-p/8089498#M1615297</guid>
      <dc:creator>YayatiEkbote</dc:creator>
      <dc:date>2011-07-13T05:25:23Z</dc:date>
    </item>
    <item>
      <title>Re: Building Tree hierarchy Using nested loops and class cl_gui_column_tree</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/building-tree-hierarchy-using-nested-loops-and-class-cl-gui-column-tree/m-p/8089499#M1615298</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt; Thanks the issue is solved. The node key was not getting a unique identification as nodekey. I resolved the issue by generating unique identification for each level. Thanks all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Yayati Ekbote&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jul 2011 12:37:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/building-tree-hierarchy-using-nested-loops-and-class-cl-gui-column-tree/m-p/8089499#M1615298</guid>
      <dc:creator>YayatiEkbote</dc:creator>
      <dc:date>2011-07-15T12:37:31Z</dc:date>
    </item>
  </channel>
</rss>

