<?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: Tree structure in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/tree-structure/m-p/4336776#M1033087</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for answering to my question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 29 Aug 2008 12:09:33 GMT</pubDate>
    <dc:creator>giridhar_padaraju</dc:creator>
    <dc:date>2008-08-29T12:09:33Z</dc:date>
    <item>
      <title>Tree structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/tree-structure/m-p/4336772#M1033083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;   Can you please tell me, how to maintain a tree structure in ALV? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2008 07:31:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/tree-structure/m-p/4336772#M1033083</guid>
      <dc:creator>giridhar_padaraju</dc:creator>
      <dc:date>2008-08-29T07:31:31Z</dc:date>
    </item>
    <item>
      <title>Re: Tree structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/tree-structure/m-p/4336773#M1033084</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check the link for sample code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="733238"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, &lt;/P&gt;&lt;P&gt;anirban&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2008 07:35:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/tree-structure/m-p/4336773#M1033084</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-29T07:35:18Z</dc:date>
    </item>
    <item>
      <title>Re: Tree structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/tree-structure/m-p/4336774#M1033085</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Refer to the link.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapdev.co.uk/reporting/alv/alvtree.htm" target="test_blank"&gt;http://www.sapdev.co.uk/reporting/alv/alvtree.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reagrds&lt;/P&gt;&lt;P&gt;Sumit Agarwal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2008 07:39:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/tree-structure/m-p/4336774#M1033085</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-29T07:39:27Z</dc:date>
    </item>
    <item>
      <title>Re: Tree structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/tree-structure/m-p/4336775#M1033086</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Refer to this program...run it and try to understand it&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp; Report  Z9_KHUSH_ALVTREE&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp; Date      Name&lt;/P&gt;&lt;P&gt;*&amp;amp; 15-05-07  Khushboo Gupta&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp; This Report Prints the Purchase Orders and its Items in the ALV TREE&lt;/P&gt;&lt;P&gt;*&amp;amp; format with the various option like Select All, Deselect All,&lt;/P&gt;&lt;P&gt;*&amp;amp; Insert First Child, Next Child, Last Child,&lt;/P&gt;&lt;P&gt;*&amp;amp; Insert First Sibling Next Sibling, Last Sibling,&lt;/P&gt;&lt;P&gt;*&amp;amp; Delete Node, Context Menu, Parent-Child Click for Checkboxes,&lt;/P&gt;&lt;P&gt;*&amp;amp; Toolbar Scrolldown&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;report  z9_khush_alvtree.&lt;/P&gt;&lt;P&gt;type-pools : slis.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*DATA DECLARATION&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*--&amp;gt; Internal Table&lt;/P&gt;&lt;P&gt;data : it_ekpo        type standard table of z9gv_ekpo with header line,&lt;/P&gt;&lt;P&gt;       gts_ekpo       type standard table of z9gv_ekpo with header line,&lt;/P&gt;&lt;P&gt;       gt_ekpo        type standard table of z9gv_ekpo with header line,&lt;/P&gt;&lt;P&gt;       it_fieldcatalog type lvc_t_fcat,&lt;/P&gt;&lt;P&gt;       lt_nodes        type lvc_t_nkey,&lt;/P&gt;&lt;P&gt;       lt_items        type lvc_t_layi,&lt;/P&gt;&lt;P&gt;       l_t_key         type lvc_t_nkey,&lt;/P&gt;&lt;P&gt;       l_hierarchy_header type treev_hhdr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--&amp;gt; Work Area Declaration&lt;/P&gt;&lt;P&gt;data : wa_ekpo            type z9gv_ekpo,&lt;/P&gt;&lt;P&gt;       wa_fieldcatalog    type lvc_s_fcat,&lt;/P&gt;&lt;P&gt;       wa_list_commentary type slis_t_listheader,&lt;/P&gt;&lt;P&gt;       ls_line            type slis_listheader,&lt;/P&gt;&lt;P&gt;       la_ekpo            type z9gv_ekpo,&lt;/P&gt;&lt;P&gt;       ls_item_u          type lvc_s_laci,&lt;/P&gt;&lt;P&gt;       ls_item            type lvc_s_layi,&lt;/P&gt;&lt;P&gt;       ls_item_layout     type lvc_s_layi.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Refrence Variable for the ALV TREE -&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*--&amp;gt; Tree,Container and Toolbar.&lt;/P&gt;&lt;P&gt;data : tree                   type ref to cl_gui_alv_tree,&lt;/P&gt;&lt;P&gt;       cc                     type ref to cl_gui_custom_container,&lt;/P&gt;&lt;P&gt;       mr_toolbar             type ref to cl_gui_toolbar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--&amp;gt; Variables Declaration.&lt;/P&gt;&lt;P&gt;data : ok_code                   type sy-ucomm,&lt;/P&gt;&lt;P&gt;       save_ok                   type sy-ucomm,&lt;/P&gt;&lt;P&gt;       ld_nkey                   type lvc_nkey,&lt;/P&gt;&lt;P&gt;       ld_ntext                  type lvc_value,&lt;/P&gt;&lt;P&gt;       l_tree_container_name(30) type c,&lt;/P&gt;&lt;P&gt;       l_logo                    type sdydo_value,&lt;/P&gt;&lt;P&gt;       l_ebeln_key               type lvc_nkey,&lt;/P&gt;&lt;P&gt;       l_ebelp_key               type lvc_nkey,&lt;/P&gt;&lt;P&gt;       l_top_key                 type lvc_nkey,&lt;/P&gt;&lt;P&gt;       node_text                 type lvc_value,&lt;/P&gt;&lt;P&gt;       ls_node_text              type lvc_value,&lt;/P&gt;&lt;P&gt;       lt_events                 type cntl_simple_events,&lt;/P&gt;&lt;P&gt;       l_event                   type cntl_simple_event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;For Classes lcl_tree_event_receiver and lcl_toolbar_event_receiver&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data : l_rc type c,&lt;/P&gt;&lt;P&gt;       lt_children type lvc_t_nkey,&lt;/P&gt;&lt;P&gt;       ls_children type lvc_s_nkey,&lt;/P&gt;&lt;P&gt;       ls_lvc_s_laci type lvc_s_laci,&lt;/P&gt;&lt;P&gt;       lt_lvc_t_laci type lvc_t_laci,&lt;/P&gt;&lt;P&gt;       ls_node_layout type lvc_s_lacn,&lt;/P&gt;&lt;P&gt;       lt_item_ly type lvc_t_layi,&lt;/P&gt;&lt;P&gt;       wa_item_ly type lvc_s_layi,&lt;/P&gt;&lt;P&gt;       ls_ekpo type z9gv_ekpo,&lt;/P&gt;&lt;P&gt;       lt_item_layout type lvc_t_layi,&lt;/P&gt;&lt;P&gt;       lt_selected_node type lvc_t_nkey,&lt;/P&gt;&lt;P&gt;       l_menu type ref to cl_ctmenu,&lt;/P&gt;&lt;P&gt;       l_fc_handled type as4flag,&lt;/P&gt;&lt;P&gt;       l_selected_node type lvc_nkey.&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp;                     Selection Screen&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;selection-screen : begin of block blk1.&lt;/P&gt;&lt;P&gt;select-options : s_ebeln for wa_ekpo-ebeln.&lt;/P&gt;&lt;P&gt;selection-screen : end of block blk1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;class lcl_tree_event_receiver definition.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  public section.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Define an event handler method for each event you want to&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;react to the events&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*--&amp;gt; For Node Double Click&lt;/P&gt;&lt;P&gt;    methods handle_node_double_click&lt;/P&gt;&lt;P&gt;      for event node_double_click of cl_gui_alv_tree&lt;/P&gt;&lt;P&gt;      importing node_key sender.&lt;/P&gt;&lt;P&gt;*--&amp;gt; For Parent-Child Checkbox Check&lt;/P&gt;&lt;P&gt;    methods handle_checkbox_changed&lt;/P&gt;&lt;P&gt;      for event checkbox_change of cl_gui_alv_tree&lt;/P&gt;&lt;P&gt;      importing node_key sender.&lt;/P&gt;&lt;P&gt;*--&amp;gt; For Node Context Menu Request&lt;/P&gt;&lt;P&gt;    methods: handle_node_cm_req&lt;/P&gt;&lt;P&gt;      for event node_context_menu_request of cl_gui_alv_tree&lt;/P&gt;&lt;P&gt;      importing node_key menu.&lt;/P&gt;&lt;P&gt;*--&amp;gt; For Node Context Menu Selected&lt;/P&gt;&lt;P&gt;    methods: handle_node_cm_sel&lt;/P&gt;&lt;P&gt;      for event node_context_menu_selected of cl_gui_alv_tree&lt;/P&gt;&lt;P&gt;      importing node_key fcode sender.&lt;/P&gt;&lt;P&gt;endclass.                    "lcl_tree_event_receiver DEFINITION&lt;/P&gt;&lt;P&gt;**********************************************************************&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;class lcl_tree_event_receiver implementation.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Implement your event handler methods.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  method handle_node_double_click.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  First check if the node is a leaf, i.e. can not be expanded&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    call method sender-&amp;gt;get_children&lt;/P&gt;&lt;P&gt;      exporting&lt;/P&gt;&lt;P&gt;        i_node_key  = node_key&lt;/P&gt;&lt;P&gt;      importing&lt;/P&gt;&lt;P&gt;        et_children = lt_children.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    if not lt_children is initial.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Expand the nodes which has child nodes or leaf&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      call method sender-&amp;gt;expand_node&lt;/P&gt;&lt;P&gt;        exporting&lt;/P&gt;&lt;P&gt;          i_node_key    = node_key&lt;/P&gt;&lt;P&gt;          i_level_count = 2.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    refresh lt_children.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  endmethod.                    "handle_node_double_click&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  method handle_node_cm_req.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Event parameter 'menu' holds a reference to the standard context&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;menu of ALV Tree (functions 'Expand'/'Collapse' on nodes).&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;You may either append your own functions (separated by a line)&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;or clear the menu if you do not want to allow standard functions.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  In this case the standard menu is cleared.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    call method menu-&amp;gt;clear.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  The next line defines one line of the context menu.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    call method menu-&amp;gt;add_function&lt;/P&gt;&lt;P&gt;      exporting&lt;/P&gt;&lt;P&gt;        fcode = 'DEL_SUBTREE'&lt;/P&gt;&lt;P&gt;        text  = text-011.        "Delete Subtree&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  endmethod.                    "handle_node_cm_req&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  method handle_node_cm_sel.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;At this point of execution, the user selected a menu entry of the&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;menu build up in event handler method handle_node_cm_req.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Query your own function codes and react accordingly.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    case fcode.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    If Delete Subtree is selected.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      when 'DEL_SUBTREE'.&lt;/P&gt;&lt;P&gt;        call function 'POPUP_TO_CONFIRM_STEP'&lt;/P&gt;&lt;P&gt;          exporting&lt;/P&gt;&lt;P&gt;            textline1      = text-022&lt;/P&gt;&lt;P&gt;            textline2      = text-023&lt;/P&gt;&lt;P&gt;            titel          = text-024&lt;/P&gt;&lt;P&gt;            cancel_display = ' '&lt;/P&gt;&lt;P&gt;          importing&lt;/P&gt;&lt;P&gt;            answer         = l_rc.&lt;/P&gt;&lt;P&gt;        if l_rc eq 'J'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;         Deleting Subtree if User confirms.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          call method sender-&amp;gt;delete_subtree&lt;/P&gt;&lt;P&gt;            exporting&lt;/P&gt;&lt;P&gt;              i_node_key = node_key.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        Do not forget to refresh the display when you change the contents&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        of your list.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          call method sender-&amp;gt;frontend_update.&lt;/P&gt;&lt;P&gt;        endif.&lt;/P&gt;&lt;P&gt;    endcase.&lt;/P&gt;&lt;P&gt;  endmethod.                    "handle_node_cm_sel&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  method handle_checkbox_changed.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;    data: lt_childrent like lt_children,&lt;/P&gt;&lt;P&gt;          lt_childrenl like lt_children,&lt;/P&gt;&lt;P&gt;          lt_childrenr like lt_children.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  First Check if the node has child nodes or leaf or not&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    call method sender-&amp;gt;get_children&lt;/P&gt;&lt;P&gt;      exporting&lt;/P&gt;&lt;P&gt;        i_node_key  = node_key&lt;/P&gt;&lt;P&gt;      importing&lt;/P&gt;&lt;P&gt;        et_children = lt_children.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    loop at lt_children into ls_children.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Get the Each Selected output line in the table gt_ekpo&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    for each child node&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      call method sender-&amp;gt;get_children&lt;/P&gt;&lt;P&gt;        exporting&lt;/P&gt;&lt;P&gt;          i_node_key  = ls_children-node_key&lt;/P&gt;&lt;P&gt;        importing&lt;/P&gt;&lt;P&gt;          et_children = lt_childrent.&lt;/P&gt;&lt;P&gt;    endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    if lt_childrent is not initial.&lt;/P&gt;&lt;P&gt;      loop at lt_childrent into ls_children.&lt;/P&gt;&lt;P&gt;        append ls_children to lt_children.&lt;/P&gt;&lt;P&gt;      endloop.&lt;/P&gt;&lt;P&gt;      clear ls_children.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      loop at lt_childrent into ls_children.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Get the Each Selected output line in the table gt_ekpo&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    for each child node&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        call method sender-&amp;gt;get_children&lt;/P&gt;&lt;P&gt;          exporting&lt;/P&gt;&lt;P&gt;            i_node_key  = ls_children-node_key&lt;/P&gt;&lt;P&gt;          importing&lt;/P&gt;&lt;P&gt;            et_children = lt_childrenl.&lt;/P&gt;&lt;P&gt;      endloop.&lt;/P&gt;&lt;P&gt;      clear ls_children.&lt;/P&gt;&lt;P&gt;      if lt_childrenl is not initial.&lt;/P&gt;&lt;P&gt;        loop at lt_childrenl into ls_children.&lt;/P&gt;&lt;P&gt;          append ls_children to lt_children.&lt;/P&gt;&lt;P&gt;        endloop.&lt;/P&gt;&lt;P&gt;        clear ls_children.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        loop at lt_childrenl into ls_children.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Get the Each Selected output line in the table gt_ekpo&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    for each child node&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          call method sender-&amp;gt;get_children&lt;/P&gt;&lt;P&gt;            exporting&lt;/P&gt;&lt;P&gt;              i_node_key  = ls_children-node_key&lt;/P&gt;&lt;P&gt;            importing&lt;/P&gt;&lt;P&gt;              et_children = lt_childrenr.&lt;/P&gt;&lt;P&gt;        endloop.&lt;/P&gt;&lt;P&gt;        clear ls_children.&lt;/P&gt;&lt;P&gt;        if lt_childrenr is not initial.&lt;/P&gt;&lt;P&gt;          loop at lt_childrenr into ls_children.&lt;/P&gt;&lt;P&gt;            append ls_children to lt_children.&lt;/P&gt;&lt;P&gt;          endloop.&lt;/P&gt;&lt;P&gt;          clear ls_children.&lt;/P&gt;&lt;P&gt;        endif.&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;    loop at lt_children into ls_children.&lt;/P&gt;&lt;P&gt;      call method tree-&amp;gt;get_outtab_line&lt;/P&gt;&lt;P&gt;        exporting&lt;/P&gt;&lt;P&gt;          i_node_key     = ls_children-node_key&lt;/P&gt;&lt;P&gt;        importing&lt;/P&gt;&lt;P&gt;          e_outtab_line  = gt_ekpo&lt;/P&gt;&lt;P&gt;          et_item_layout = lt_item_ly&lt;/P&gt;&lt;P&gt;        exceptions&lt;/P&gt;&lt;P&gt;          node_not_found = 1&lt;/P&gt;&lt;P&gt;          others         = 2.&lt;/P&gt;&lt;P&gt;      if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;        message id sy-msgid type sy-msgty number sy-msgno&lt;/P&gt;&lt;P&gt;                   with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      if gt_ekpo is not initial.&lt;/P&gt;&lt;P&gt;        loop at lt_item_ly into wa_item_ly where fieldname = '&amp;amp;Hierarchy'.&lt;/P&gt;&lt;P&gt;          if wa_item_ly-chosen is initial.&lt;/P&gt;&lt;P&gt;            clear: ls_lvc_s_laci, ls_node_layout.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Setting the layout of the checkboxes (checked)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            ls_lvc_s_laci-fieldname = tree-&amp;gt;c_hierarchy_column_name.&lt;/P&gt;&lt;P&gt;            ls_lvc_s_laci-u_chosen = 'X'.&lt;/P&gt;&lt;P&gt;            ls_lvc_s_laci-chosen = 'X'.&lt;/P&gt;&lt;P&gt;            append ls_lvc_s_laci to lt_lvc_t_laci.&lt;/P&gt;&lt;P&gt;            clear: ls_lvc_s_laci, ls_node_layout.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          else.&lt;/P&gt;&lt;P&gt;            clear: ls_lvc_s_laci, ls_node_layout.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Setting the layout of the checkboxes (checked)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            ls_lvc_s_laci-fieldname = tree-&amp;gt;c_hierarchy_column_name.&lt;/P&gt;&lt;P&gt;            ls_lvc_s_laci-u_chosen = 'X'.&lt;/P&gt;&lt;P&gt;            ls_lvc_s_laci-chosen = ' '.&lt;/P&gt;&lt;P&gt;            append ls_lvc_s_laci to lt_lvc_t_laci.&lt;/P&gt;&lt;P&gt;            clear: ls_lvc_s_laci, ls_node_layout.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          endif.&lt;/P&gt;&lt;P&gt;        endloop.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Changing the ALV Tree Checkboxes Layout&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        call method tree-&amp;gt;change_node&lt;/P&gt;&lt;P&gt;          exporting&lt;/P&gt;&lt;P&gt;            i_node_key     = ls_children-node_key&lt;/P&gt;&lt;P&gt;            i_outtab_line  = gt_ekpo&lt;/P&gt;&lt;P&gt;            is_node_layout = ls_node_layout&lt;/P&gt;&lt;P&gt;            it_item_layout = lt_lvc_t_laci.&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;    endloop.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Do not forget to refresh the display when you change the contents&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  of your list.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    call method sender-&amp;gt;frontend_update.&lt;/P&gt;&lt;P&gt;    refresh: lt_children,&lt;/P&gt;&lt;P&gt;             lt_lvc_t_laci,&lt;/P&gt;&lt;P&gt;             lt_item_ly.&lt;/P&gt;&lt;P&gt;  endmethod.                    "handle_checkbox_changed&lt;/P&gt;&lt;P&gt;endclass.                    "lcl_tree_event_receiver &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;class lcl_toolbar_event_receiver definition.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  public section.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  For Each Function Selected in the Toolbar.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    methods: on_function_selected&lt;/P&gt;&lt;P&gt;               for event function_selected of cl_gui_toolbar&lt;/P&gt;&lt;P&gt;                 importing fcode sender,&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  For the Toolbar Dropdown&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;             on_toolbar_dropdown&lt;/P&gt;&lt;P&gt;               for event dropdown_clicked of cl_gui_toolbar&lt;/P&gt;&lt;P&gt;                 importing fcode&lt;/P&gt;&lt;P&gt;                           posx&lt;/P&gt;&lt;P&gt;                           posy&lt;/P&gt;&lt;P&gt;                           sender.&lt;/P&gt;&lt;P&gt;endclass.                    "lcl_toolbar_event_receiver DEFINITION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;class lcl_toolbar_event_receiver implementation.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  method on_function_selected.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    case fcode.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    If Collapse Button is cliked on the TOOLBAR&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      when '&amp;amp;COLLAPSE'.&lt;/P&gt;&lt;P&gt;        call method tree-&amp;gt;collapse_all_nodes&lt;/P&gt;&lt;P&gt;          exceptions&lt;/P&gt;&lt;P&gt;            failed            = 1&lt;/P&gt;&lt;P&gt;            cntl_system_error = 2&lt;/P&gt;&lt;P&gt;            others            = 3.&lt;/P&gt;&lt;P&gt;        if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;          message id sy-msgid type sy-msgty number sy-msgno&lt;/P&gt;&lt;P&gt;                     with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;        endif.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Do not forget to refresh the display when you change the contents&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      of your list.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    call method tree-&amp;gt;frontend_update.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    If Expand Button is cliked on the TOOLBAR&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      when '&amp;amp;EXPAND'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        call method tree-&amp;gt;expand_nodes&lt;/P&gt;&lt;P&gt;          exporting&lt;/P&gt;&lt;P&gt;            it_node_key             = l_t_key&lt;/P&gt;&lt;P&gt;          exceptions&lt;/P&gt;&lt;P&gt;            failed                  = 1&lt;/P&gt;&lt;P&gt;            cntl_system_error       = 2&lt;/P&gt;&lt;P&gt;            error_in_node_key_table = 3&lt;/P&gt;&lt;P&gt;            dp_error                = 4&lt;/P&gt;&lt;P&gt;            node_not_found          = 5&lt;/P&gt;&lt;P&gt;            others                  = 6.&lt;/P&gt;&lt;P&gt;        if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;          message id sy-msgid type sy-msgty number sy-msgno&lt;/P&gt;&lt;P&gt;                     with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;        endif.&lt;/P&gt;&lt;P&gt;        refresh lt_nodes.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Do not forget to refresh the display when you change the contents&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      of your list.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    call method tree-&amp;gt;frontend_update.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    If Select All Option of the Toolbar is selected.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      when 'SELECT_ALL'.&lt;/P&gt;&lt;P&gt;        loop at l_t_key into ld_nkey.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        Getting the Subtrees for each node&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          call method tree-&amp;gt;get_subtree&lt;/P&gt;&lt;P&gt;            exporting&lt;/P&gt;&lt;P&gt;              i_node_key       = ld_nkey&lt;/P&gt;&lt;P&gt;            importing&lt;/P&gt;&lt;P&gt;              et_subtree_nodes = lt_nodes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          loop at lt_nodes into ld_nkey.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;          Getting the Each Line of the Each node of sub trees&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            call method tree-&amp;gt;get_outtab_line&lt;/P&gt;&lt;P&gt;              exporting&lt;/P&gt;&lt;P&gt;                i_node_key     = ld_nkey&lt;/P&gt;&lt;P&gt;              importing&lt;/P&gt;&lt;P&gt;                e_node_text    = ld_ntext&lt;/P&gt;&lt;P&gt;                et_item_layout = lt_items&lt;/P&gt;&lt;P&gt;              exceptions&lt;/P&gt;&lt;P&gt;                node_not_found = 1&lt;/P&gt;&lt;P&gt;                others         = 2.&lt;/P&gt;&lt;P&gt;            if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;              message id sy-msgid type sy-msgty number sy-msgno&lt;/P&gt;&lt;P&gt;                         with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;            endif.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;          Looping at those items which has got checkbox property as editable&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            loop at lt_items into ls_item&lt;/P&gt;&lt;P&gt;                 where ( class = cl_gui_column_tree=&amp;gt;item_class_checkbox&lt;/P&gt;&lt;P&gt;                 and     editable = 'X' ).&lt;/P&gt;&lt;P&gt;              clear: ls_item_u.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;            Changing layout for the Checkbox Status to checked.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;              move-corresponding ls_item to ls_item_u.&lt;/P&gt;&lt;P&gt;              ls_item_u-chosen   = 'X'.    " mark checkbox&lt;/P&gt;&lt;P&gt;              ls_item_u-u_chosen = 'X'.  " do update of checkbox&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;            Changing each item in the tree with the new layout&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;              call method tree-&amp;gt;change_item&lt;/P&gt;&lt;P&gt;                exporting&lt;/P&gt;&lt;P&gt;                  i_node_key     = ld_nkey&lt;/P&gt;&lt;P&gt;                  i_fieldname    = tree-&amp;gt;c_hierarchy_column_name&lt;/P&gt;&lt;P&gt;                  i_data         = ' '&lt;/P&gt;&lt;P&gt;                  i_u_data       = ' '  " do not update i_data = node text&lt;/P&gt;&lt;P&gt;                  is_item_layout = ls_item_u&lt;/P&gt;&lt;P&gt;                exceptions&lt;/P&gt;&lt;P&gt;                  node_not_found = 1&lt;/P&gt;&lt;P&gt;                  others         = 2.&lt;/P&gt;&lt;P&gt;              if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;                message id sy-msgid type sy-msgty number sy-msgno&lt;/P&gt;&lt;P&gt;                   with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;              endif.&lt;/P&gt;&lt;P&gt;              clear ls_item_u.&lt;/P&gt;&lt;P&gt;            endloop.  " items of a single node&lt;/P&gt;&lt;P&gt;          endloop.  " nodes&lt;/P&gt;&lt;P&gt;        endloop.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Do not forget to refresh the display when you change the contents&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      of your list.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    call method tree-&amp;gt;frontend_update.&lt;/P&gt;&lt;P&gt;      when 'DESELECT_ALL'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      If DESelect All Option of the Toolbar is selected.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        loop at l_t_key into ld_nkey.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        Getting the Subtrees for each node&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          call method tree-&amp;gt;get_subtree&lt;/P&gt;&lt;P&gt;            exporting&lt;/P&gt;&lt;P&gt;              i_node_key       = ld_nkey&lt;/P&gt;&lt;P&gt;            importing&lt;/P&gt;&lt;P&gt;              et_subtree_nodes = lt_nodes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          loop at lt_nodes into ld_nkey.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;          Getting the Each Line of the Each node of sub trees&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            call method tree-&amp;gt;get_outtab_line&lt;/P&gt;&lt;P&gt;              exporting&lt;/P&gt;&lt;P&gt;                i_node_key     = ld_nkey&lt;/P&gt;&lt;P&gt;              importing&lt;/P&gt;&lt;P&gt;                e_node_text    = ld_ntext&lt;/P&gt;&lt;P&gt;                et_item_layout = lt_items&lt;/P&gt;&lt;P&gt;              exceptions&lt;/P&gt;&lt;P&gt;                node_not_found = 1&lt;/P&gt;&lt;P&gt;                others         = 2.&lt;/P&gt;&lt;P&gt;            if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;              message id sy-msgid type sy-msgty number sy-msgno&lt;/P&gt;&lt;P&gt;                         with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;            endif.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;          Looping at those items which has got checkbox property as editable&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            loop at lt_items into ls_item&lt;/P&gt;&lt;P&gt;                 where ( class = cl_gui_column_tree=&amp;gt;item_class_checkbox&lt;/P&gt;&lt;P&gt;                 and     editable = 'X' ).&lt;/P&gt;&lt;P&gt;              clear: ls_item_u.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;            Changing layout for the Checkbox Status to uncheck.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;              move-corresponding ls_item to ls_item_u.&lt;/P&gt;&lt;P&gt;              ls_item_u-chosen   = ' '.    " mark checkbox&lt;/P&gt;&lt;P&gt;              ls_item_u-u_chosen = 'X'.  " do update of checkbox&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;            Changing each item in the tree with the new layout&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;              call method tree-&amp;gt;change_item&lt;/P&gt;&lt;P&gt;                exporting&lt;/P&gt;&lt;P&gt;                  i_node_key     = ld_nkey&lt;/P&gt;&lt;P&gt;                  i_fieldname    = tree-&amp;gt;c_hierarchy_column_name&lt;/P&gt;&lt;P&gt;                  i_data         = ' '&lt;/P&gt;&lt;P&gt;                  i_u_data       = ' '  " do not update i_data = node text&lt;/P&gt;&lt;P&gt;                  is_item_layout = ls_item_u&lt;/P&gt;&lt;P&gt;                exceptions&lt;/P&gt;&lt;P&gt;                  node_not_found = 1&lt;/P&gt;&lt;P&gt;                  others         = 2.&lt;/P&gt;&lt;P&gt;              if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;                message id sy-msgid type sy-msgty number sy-msgno&lt;/P&gt;&lt;P&gt;                   with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;              endif.&lt;/P&gt;&lt;P&gt;              clear ls_item_u.&lt;/P&gt;&lt;P&gt;            endloop.  " items of a single node&lt;/P&gt;&lt;P&gt;          endloop.  " nodes&lt;/P&gt;&lt;P&gt;        endloop.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Do not forget to refresh the display when you change the contents&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      of your list.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    call method tree-&amp;gt;frontend_update.&lt;/P&gt;&lt;P&gt;      when 'DELETE'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      get selected node&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        call method tree-&amp;gt;get_selected_nodes&lt;/P&gt;&lt;P&gt;          changing&lt;/P&gt;&lt;P&gt;            ct_selected_nodes = lt_selected_node.&lt;/P&gt;&lt;P&gt;        call method cl_gui_cfw=&amp;gt;flush.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        read table lt_selected_node into l_selected_node index 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      delete subtree&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        if not l_selected_node is initial.&lt;/P&gt;&lt;P&gt;          call method tree-&amp;gt;delete_subtree&lt;/P&gt;&lt;P&gt;            exporting&lt;/P&gt;&lt;P&gt;              i_node_key                = l_selected_node&lt;/P&gt;&lt;P&gt;              i_update_parents_expander = ''&lt;/P&gt;&lt;P&gt;              i_update_parents_folder   = 'X'.&lt;/P&gt;&lt;P&gt;        else.&lt;/P&gt;&lt;P&gt;          message i227(0h).&lt;/P&gt;&lt;P&gt;        endif.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Do not forget to refresh the display when you change the contents&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      of your list.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    call method tree-&amp;gt;frontend_update.&lt;/P&gt;&lt;P&gt;      when 'INSERT_LC'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      get selected node&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        call method tree-&amp;gt;get_selected_nodes&lt;/P&gt;&lt;P&gt;          changing&lt;/P&gt;&lt;P&gt;            ct_selected_nodes = lt_selected_node.&lt;/P&gt;&lt;P&gt;        call method cl_gui_cfw=&amp;gt;flush.&lt;/P&gt;&lt;P&gt;        read table lt_selected_node into l_selected_node index 1.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      get current Line&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        if not l_selected_node is initial.&lt;/P&gt;&lt;P&gt;          call method tree-&amp;gt;get_outtab_line&lt;/P&gt;&lt;P&gt;            exporting&lt;/P&gt;&lt;P&gt;              i_node_key    = l_selected_node&lt;/P&gt;&lt;P&gt;            importing&lt;/P&gt;&lt;P&gt;              e_outtab_line = ls_ekpo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          ls_item_layout-fieldname = tree-&amp;gt;c_hierarchy_column_name.&lt;/P&gt;&lt;P&gt;          ls_item_layout-class   = cl_gui_column_tree=&amp;gt;item_class_checkbox.&lt;/P&gt;&lt;P&gt;          ls_item_layout-editable = 'X'.&lt;/P&gt;&lt;P&gt;          append ls_item_layout to lt_item_layout.&lt;/P&gt;&lt;P&gt;          call method tree-&amp;gt;add_node&lt;/P&gt;&lt;P&gt;            exporting&lt;/P&gt;&lt;P&gt;              i_relat_node_key = l_selected_node&lt;/P&gt;&lt;P&gt;              i_relationship   = cl_tree_control_base=&amp;gt;relat_last_child&lt;/P&gt;&lt;P&gt;              is_outtab_line   = ls_ekpo&lt;/P&gt;&lt;P&gt;              i_node_text      = 'Last Child'&lt;/P&gt;&lt;P&gt;              it_item_layout   = lt_item_layout.            "#EC NOTEXT&lt;/P&gt;&lt;P&gt;        else.&lt;/P&gt;&lt;P&gt;          message i227(0h).&lt;/P&gt;&lt;P&gt;        endif.&lt;/P&gt;&lt;P&gt;        refresh lt_item_layout.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Do not forget to refresh the display when you change the contents&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      of your list.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    call method tree-&amp;gt;frontend_update.&lt;/P&gt;&lt;P&gt;      when 'INSERT_FC'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      get selected node&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        call method tree-&amp;gt;get_selected_nodes&lt;/P&gt;&lt;P&gt;          changing&lt;/P&gt;&lt;P&gt;            ct_selected_nodes = lt_selected_node.&lt;/P&gt;&lt;P&gt;        call method cl_gui_cfw=&amp;gt;flush.&lt;/P&gt;&lt;P&gt;        read table lt_selected_node into l_selected_node index 1.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      get current Line&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        if not l_selected_node is initial.&lt;/P&gt;&lt;P&gt;          call method tree-&amp;gt;get_outtab_line&lt;/P&gt;&lt;P&gt;            exporting&lt;/P&gt;&lt;P&gt;              i_node_key    = l_selected_node&lt;/P&gt;&lt;P&gt;            importing&lt;/P&gt;&lt;P&gt;              e_outtab_line = ls_ekpo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          ls_item_layout-fieldname = tree-&amp;gt;c_hierarchy_column_name.&lt;/P&gt;&lt;P&gt;          ls_item_layout-class   = cl_gui_column_tree=&amp;gt;item_class_checkbox.&lt;/P&gt;&lt;P&gt;          ls_item_layout-editable = 'X'.&lt;/P&gt;&lt;P&gt;          append ls_item_layout to lt_item_layout.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          call method tree-&amp;gt;add_node&lt;/P&gt;&lt;P&gt;            exporting&lt;/P&gt;&lt;P&gt;              i_relat_node_key = l_selected_node&lt;/P&gt;&lt;P&gt;              i_relationship   = cl_tree_control_base=&amp;gt;relat_first_child&lt;/P&gt;&lt;P&gt;              is_outtab_line   = ls_ekpo&lt;/P&gt;&lt;P&gt;              i_node_text      = 'First Child'&lt;/P&gt;&lt;P&gt;              it_item_layout   = lt_item_layout.            "#EC NOTEXT&lt;/P&gt;&lt;P&gt;        else.&lt;/P&gt;&lt;P&gt;          message i227(0h).&lt;/P&gt;&lt;P&gt;        endif.&lt;/P&gt;&lt;P&gt;        refresh lt_item_layout.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Do not forget to refresh the display when you change the contents&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      of your list.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    call method tree-&amp;gt;frontend_update.&lt;/P&gt;&lt;P&gt;      when 'INSERT_FS'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      get selected node&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        call method tree-&amp;gt;get_selected_nodes&lt;/P&gt;&lt;P&gt;          changing&lt;/P&gt;&lt;P&gt;            ct_selected_nodes = lt_selected_node.&lt;/P&gt;&lt;P&gt;        call method cl_gui_cfw=&amp;gt;flush.&lt;/P&gt;&lt;P&gt;        read table lt_selected_node into l_selected_node index 1.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      get current Line&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        if not l_selected_node is initial.&lt;/P&gt;&lt;P&gt;          call method tree-&amp;gt;get_outtab_line&lt;/P&gt;&lt;P&gt;            exporting&lt;/P&gt;&lt;P&gt;              i_node_key    = l_selected_node&lt;/P&gt;&lt;P&gt;            importing&lt;/P&gt;&lt;P&gt;              e_outtab_line = ls_ekpo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          ls_item_layout-fieldname = tree-&amp;gt;c_hierarchy_column_name.&lt;/P&gt;&lt;P&gt;          ls_item_layout-class   = cl_gui_column_tree=&amp;gt;item_class_checkbox.&lt;/P&gt;&lt;P&gt;          ls_item_layout-editable = 'X'.&lt;/P&gt;&lt;P&gt;          append ls_item_layout to lt_item_layout.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          call method tree-&amp;gt;add_node&lt;/P&gt;&lt;P&gt;            exporting&lt;/P&gt;&lt;P&gt;              i_relat_node_key = l_selected_node&lt;/P&gt;&lt;P&gt;              i_relationship   = cl_tree_control_base=&amp;gt;relat_first_sibling&lt;/P&gt;&lt;P&gt;              is_outtab_line   = ls_ekpo&lt;/P&gt;&lt;P&gt;              i_node_text      = 'First Sibling'&lt;/P&gt;&lt;P&gt;              it_item_layout   = lt_item_layout.            "#EC NOTEXT&lt;/P&gt;&lt;P&gt;        else.&lt;/P&gt;&lt;P&gt;          message i227(0h).&lt;/P&gt;&lt;P&gt;        endif.&lt;/P&gt;&lt;P&gt;        refresh lt_item_layout.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Do not forget to refresh the display when you change the contents&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      of your list.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    call method tree-&amp;gt;frontend_update.&lt;/P&gt;&lt;P&gt;      when 'INSERT_LS'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      get selected node&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        call method tree-&amp;gt;get_selected_nodes&lt;/P&gt;&lt;P&gt;          changing&lt;/P&gt;&lt;P&gt;            ct_selected_nodes = lt_selected_node.&lt;/P&gt;&lt;P&gt;        call method cl_gui_cfw=&amp;gt;flush.&lt;/P&gt;&lt;P&gt;        read table lt_selected_node into l_selected_node index 1.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      get current Line&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        if not l_selected_node is initial.&lt;/P&gt;&lt;P&gt;          call method tree-&amp;gt;get_outtab_line&lt;/P&gt;&lt;P&gt;            exporting&lt;/P&gt;&lt;P&gt;              i_node_key    = l_selected_node&lt;/P&gt;&lt;P&gt;            importing&lt;/P&gt;&lt;P&gt;              e_outtab_line = ls_ekpo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          ls_item_layout-fieldname = tree-&amp;gt;c_hierarchy_column_name.&lt;/P&gt;&lt;P&gt;          ls_item_layout-class   = cl_gui_column_tree=&amp;gt;item_class_checkbox.&lt;/P&gt;&lt;P&gt;          ls_item_layout-editable = 'X'.&lt;/P&gt;&lt;P&gt;          append ls_item_layout to lt_item_layout.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          call method tree-&amp;gt;add_node&lt;/P&gt;&lt;P&gt;            exporting&lt;/P&gt;&lt;P&gt;              i_relat_node_key = l_selected_node&lt;/P&gt;&lt;P&gt;              i_relationship   = cl_tree_control_base=&amp;gt;relat_last_sibling&lt;/P&gt;&lt;P&gt;              is_outtab_line   = ls_ekpo&lt;/P&gt;&lt;P&gt;              i_node_text      = 'Last Sibling'&lt;/P&gt;&lt;P&gt;              it_item_layout   = lt_item_layout.            "#EC NOTEXT&lt;/P&gt;&lt;P&gt;        else.&lt;/P&gt;&lt;P&gt;          message i227(0h).&lt;/P&gt;&lt;P&gt;        endif.&lt;/P&gt;&lt;P&gt;        refresh lt_item_layout.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Do not forget to refresh the display when you change the contents&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      of your list.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    call method tree-&amp;gt;frontend_update.&lt;/P&gt;&lt;P&gt;      when 'INSERT_NS'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      get selected node&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        call method tree-&amp;gt;get_selected_nodes&lt;/P&gt;&lt;P&gt;          changing&lt;/P&gt;&lt;P&gt;            ct_selected_nodes = lt_selected_node.&lt;/P&gt;&lt;P&gt;        call method cl_gui_cfw=&amp;gt;flush.&lt;/P&gt;&lt;P&gt;        read table lt_selected_node into l_selected_node index 1.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      get current Line&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        if not l_selected_node is initial.&lt;/P&gt;&lt;P&gt;          call method tree-&amp;gt;get_outtab_line&lt;/P&gt;&lt;P&gt;            exporting&lt;/P&gt;&lt;P&gt;              i_node_key    = l_selected_node&lt;/P&gt;&lt;P&gt;            importing&lt;/P&gt;&lt;P&gt;              e_outtab_line = ls_ekpo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          ls_item_layout-fieldname = tree-&amp;gt;c_hierarchy_column_name.&lt;/P&gt;&lt;P&gt;          ls_item_layout-class   = cl_gui_column_tree=&amp;gt;item_class_checkbox.&lt;/P&gt;&lt;P&gt;          ls_item_layout-editable = 'X'.&lt;/P&gt;&lt;P&gt;          append ls_item_layout to lt_item_layout.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          call method tree-&amp;gt;add_node&lt;/P&gt;&lt;P&gt;            exporting&lt;/P&gt;&lt;P&gt;              i_relat_node_key = l_selected_node&lt;/P&gt;&lt;P&gt;              i_relationship   = cl_tree_control_base=&amp;gt;relat_next_sibling&lt;/P&gt;&lt;P&gt;              is_outtab_line   = ls_ekpo&lt;/P&gt;&lt;P&gt;              i_node_text      = 'Next Sibling'&lt;/P&gt;&lt;P&gt;              it_item_layout   = lt_item_layout.            "#EC NOTEXT&lt;/P&gt;&lt;P&gt;        else.&lt;/P&gt;&lt;P&gt;          message i227(0h).&lt;/P&gt;&lt;P&gt;        endif.&lt;/P&gt;&lt;P&gt;        refresh lt_item_layout.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Do not forget to refresh the display when you change the contents&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      of your list.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    call method tree-&amp;gt;frontend_update.&lt;/P&gt;&lt;P&gt;    endcase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  endmethod.                    "on_function_selected&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  method on_toolbar_dropdown.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;create contextmenu&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    create object l_menu.&lt;/P&gt;&lt;P&gt;    clear l_fc_handled.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    case fcode.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    To Insert Child&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      when 'INSERT_LC'.&lt;/P&gt;&lt;P&gt;        l_fc_handled = 'X'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      insert as last child&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        call method l_menu-&amp;gt;add_function&lt;/P&gt;&lt;P&gt;          exporting&lt;/P&gt;&lt;P&gt;            fcode = 'INSERT_LC'&lt;/P&gt;&lt;P&gt;            text  = 'Insert New Line as Last Child'.        "#EC NOTEXT&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      insert as first child&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        call method l_menu-&amp;gt;add_function&lt;/P&gt;&lt;P&gt;          exporting&lt;/P&gt;&lt;P&gt;            fcode = 'INSERT_FC'&lt;/P&gt;&lt;P&gt;            text  = 'Insert New Line as First Child'.       "#EC NOTEXT&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      insert as next sibling&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        call method l_menu-&amp;gt;add_function&lt;/P&gt;&lt;P&gt;          exporting&lt;/P&gt;&lt;P&gt;            fcode = 'INSERT_NS'&lt;/P&gt;&lt;P&gt;            text  = 'Insert New Line as Next Sibling'.      "#EC NOTEXT&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      insert as last sibling&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        call method l_menu-&amp;gt;add_function&lt;/P&gt;&lt;P&gt;          exporting&lt;/P&gt;&lt;P&gt;            fcode = 'INSERT_LS'&lt;/P&gt;&lt;P&gt;            text  = 'Insert New Line as Last Sibling'.      "#EC NOTEXT&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      insert as first sibling&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        call method l_menu-&amp;gt;add_function&lt;/P&gt;&lt;P&gt;          exporting&lt;/P&gt;&lt;P&gt;            fcode = 'INSERT_FS'&lt;/P&gt;&lt;P&gt;            text  = 'Insert New Line as First Sibling'.     "#EC NOTEXT&lt;/P&gt;&lt;P&gt;    endcase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;show dropdownbox&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    if l_fc_handled = 'X'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Attaching the Context Menu to the Toolbar&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      call method mr_toolbar-&amp;gt;track_context_menu&lt;/P&gt;&lt;P&gt;        exporting&lt;/P&gt;&lt;P&gt;          context_menu = l_menu&lt;/P&gt;&lt;P&gt;          posx         = posx&lt;/P&gt;&lt;P&gt;          posy         = posy.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  endmethod.                    "on_toolbar_dropdown&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;START OF SELECTION&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;END OF SELECTION&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;end-of-selection.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Calling Screen 111 which has the Custom Container for the Tree Control&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  call screen 111.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp;                     S U B - R O U T I N E S&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp;      Module  alv_tree_PBO  OUTPUT&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;module alv_tree_pbo output.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Setting the PF STATUS&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  set pf-status 'MAIN100'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;If Tree Control is empty&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  if tree is initial.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Preparing the Tree for displaying the Required Format.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    perform init_tree.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Calling Function FLUSH for Sending the Buffered Automation Queue&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  to Frontend&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    call method cl_gui_cfw=&amp;gt;flush&lt;/P&gt;&lt;P&gt;      exceptions&lt;/P&gt;&lt;P&gt;        cntl_system_error = 1&lt;/P&gt;&lt;P&gt;        cntl_error        = 2.&lt;/P&gt;&lt;P&gt;    if sy-subrc ne 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   Displaying the Error message if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      call function 'POPUP_TO_INFORM'&lt;/P&gt;&lt;P&gt;        exporting&lt;/P&gt;&lt;P&gt;          titel = text-013&lt;/P&gt;&lt;P&gt;          txt1  = text-014&lt;/P&gt;&lt;P&gt;          txt2  = text-015&lt;/P&gt;&lt;P&gt;          txt3  = text-016 .&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endmodule.                 " alv_tree_PBO  OUTPUT&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  init_tree&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;form init_tree .&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;§1b. Create ALV Tree Control and corresponding Container.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;create container for alv-tree&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Name of the Custom Container on the Screen 111&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  l_tree_container_name = 'CUSTOM_CTRL'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  create object cc&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      container_name              = l_tree_container_name&lt;/P&gt;&lt;P&gt;    exceptions&lt;/P&gt;&lt;P&gt;      cntl_error                  = 1&lt;/P&gt;&lt;P&gt;      cntl_system_error           = 2&lt;/P&gt;&lt;P&gt;      create_error                = 3&lt;/P&gt;&lt;P&gt;      lifetime_error              = 4&lt;/P&gt;&lt;P&gt;      lifetime_dynpro_dynpro_link = 5&lt;/P&gt;&lt;P&gt;      others                      = 6&lt;/P&gt;&lt;P&gt;      .&lt;/P&gt;&lt;P&gt;  if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    message x208(00) with 'ERROR'.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create ALV Tree Control Object within the Container&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  create object tree&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      parent                      = cc&lt;/P&gt;&lt;P&gt;      node_selection_mode         = cl_gui_column_tree=&amp;gt;node_sel_mode_single&lt;/P&gt;&lt;P&gt;      hide_selection              = 'X'&lt;/P&gt;&lt;P&gt;      item_selection              = 'X'&lt;/P&gt;&lt;P&gt;      no_toolbar                  = ''&lt;/P&gt;&lt;P&gt;    exceptions&lt;/P&gt;&lt;P&gt;      cntl_error                  = 1&lt;/P&gt;&lt;P&gt;      cntl_system_error           = 2&lt;/P&gt;&lt;P&gt;      create_error                = 3&lt;/P&gt;&lt;P&gt;      lifetime_error              = 4&lt;/P&gt;&lt;P&gt;      illegal_node_selection_mode = 5&lt;/P&gt;&lt;P&gt;      failed                      = 6&lt;/P&gt;&lt;P&gt;      illegal_column_name         = 7&lt;/P&gt;&lt;P&gt;      others                      = 8.&lt;/P&gt;&lt;P&gt;  if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    message x208(00) with 'ERROR'.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;§2. Create Hierarchy-header&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Populating the HIERARCHY HEADER table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  perform build_hierarchy_header changing l_hierarchy_header.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Populating the FIELDCATALOG&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  perform build_fieldcatllog.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create info-table for html-header&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  perform get_htmlheader using wa_list_commentary&lt;/P&gt;&lt;P&gt;                               l_logo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;§3. Create empty Tree Control&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;IMPORTANT: Table 'gts_ekpo' must be empty. Do not change this table&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;(even after this method call). You can change data of your table&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;by calling methods of CL_GUI_ALV_TREE.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Furthermore, the output table 'gt_outtab' must be global and can&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;only be used for one ALV Tree Control.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  refresh gts_ekpo.&lt;/P&gt;&lt;P&gt;  call method tree-&amp;gt;set_table_for_first_display&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      i_structure_name    = 'Z9GV_EKPO'&lt;/P&gt;&lt;P&gt;      is_hierarchy_header = l_hierarchy_header&lt;/P&gt;&lt;P&gt;      it_list_commentary  = wa_list_commentary&lt;/P&gt;&lt;P&gt;      i_logo              = l_logo&lt;/P&gt;&lt;P&gt;    changing&lt;/P&gt;&lt;P&gt;      it_outtab           = gts_ekpo[]&lt;/P&gt;&lt;P&gt;      it_fieldcatalog     = it_fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;§4. Create hierarchy (nodes and leaves)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  perform create_hierarchy.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Change Toolbar&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  perform change_toolbar.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Events Register&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  perform register_events.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;§5. Send data to frontend.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  call method tree-&amp;gt;frontend_update.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Adjust column_width&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; CALL METHOD TREE-&amp;gt;COLUMN_OPTIMIZE.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;endform.                    " init_tree&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  build_hierarchy_header&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     &amp;lt;--P_HIERARCHY_HEADER  text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;form build_hierarchy_header  changing p_hierarchy_header type treev_hhdr.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Populating the Hierarchy Header Table for Defining the Header Node in&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;the Tree Heirarchy&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  p_hierarchy_header-heading = text-020.&lt;/P&gt;&lt;P&gt;  p_hierarchy_header-t_image = it_ekpo-ebeln.&lt;/P&gt;&lt;P&gt;  p_hierarchy_header-tooltip = text-021.&lt;/P&gt;&lt;P&gt;  p_hierarchy_header-width = 40.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.                    " build_hierarchy_header&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  build_fieldcatllog&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;form build_fieldcatllog .&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Selecting the Records from the Ekpo Table for the Selections made on&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;the Selection Screen.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  select ebeln&lt;/P&gt;&lt;P&gt;         ebelp&lt;/P&gt;&lt;P&gt;         aedat&lt;/P&gt;&lt;P&gt;         matnr&lt;/P&gt;&lt;P&gt;         menge&lt;/P&gt;&lt;P&gt;         meins&lt;/P&gt;&lt;P&gt;         netpr&lt;/P&gt;&lt;P&gt;    from ekpo into table it_ekpo&lt;/P&gt;&lt;P&gt;    where ebeln in s_ebeln.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Calling the FM LVC_FIELDCATALOG_MERGE to Populate the Fieldcatalog&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;table for the ALV&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  call function 'LVC_FIELDCATALOG_MERGE'&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      i_structure_name       = 'Z9GV_EKPO'&lt;/P&gt;&lt;P&gt;    changing&lt;/P&gt;&lt;P&gt;      ct_fieldcat            = it_fieldcatalog&lt;/P&gt;&lt;P&gt;    exceptions&lt;/P&gt;&lt;P&gt;      inconsistent_interface = 1&lt;/P&gt;&lt;P&gt;      program_error          = 2&lt;/P&gt;&lt;P&gt;      others                 = 3.&lt;/P&gt;&lt;P&gt;  if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    message id sy-msgid type sy-msgty number sy-msgno&lt;/P&gt;&lt;P&gt;            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;endform.                    " build_fieldcatllog&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  create_hierarchy&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;form create_hierarchy .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;§4a. Select data&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;§4b. Sort output table according to your conceived hierarchy&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  sort it_ekpo by ebeln ebelp.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Adding the First Header Node in the Tree Heirarchy.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Providing no key means that the node is added on top level:&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  call method tree-&amp;gt;add_node&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      i_relat_node_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      = text-012&lt;/P&gt;&lt;P&gt;    importing&lt;/P&gt;&lt;P&gt;      e_new_node_key   = l_top_key.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Note: The top level nodes do not correspond to a field of the&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;output table. Instead we use data of the table to invent another&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;hierarchy level above the levels that can be build by sorting.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;§4c. Add data to tree&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  loop at it_ekpo.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Prerequesite: The table is sorted.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;You add a node everytime the values of a sorted field changes.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Finally, the complete line is added as a leaf below the last&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;node.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    at new ebeln.&lt;/P&gt;&lt;P&gt;      read table it_ekpo into la_ekpo with key ebeln = it_ekpo-ebeln.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Top level nodes:&lt;/P&gt;&lt;/LI&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;      ls_item_layout-fieldname = tree-&amp;gt;c_hierarchy_column_name.&lt;/P&gt;&lt;P&gt;      ls_item_layout-class   = cl_gui_column_tree=&amp;gt;item_class_checkbox.&lt;/P&gt;&lt;P&gt;      ls_item_layout-editable = 'X'.&lt;/P&gt;&lt;P&gt;      append ls_item_layout to lt_item_layout.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      node_text = la_ekpo-ebeln.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Adding the First Node based on the Data From the Output table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      call method tree-&amp;gt;add_node&lt;/P&gt;&lt;P&gt;        exporting&lt;/P&gt;&lt;P&gt;          i_relat_node_key     = l_top_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          = node_text&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       = l_ebeln_key&lt;/P&gt;&lt;P&gt;        exceptions&lt;/P&gt;&lt;P&gt;          relat_node_not_found = 1&lt;/P&gt;&lt;P&gt;          node_not_found       = 2&lt;/P&gt;&lt;P&gt;          others               = 3.&lt;/P&gt;&lt;P&gt;      if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;        message id sy-msgid type sy-msgty number sy-msgno&lt;/P&gt;&lt;P&gt;           with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      append l_ebeln_key to l_t_key .&lt;/P&gt;&lt;P&gt;    endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    at new ebelp.&lt;/P&gt;&lt;P&gt;      clear la_ekpo.&lt;/P&gt;&lt;P&gt;      read table it_ekpo into la_ekpo with key ebeln = it_ekpo-ebeln&lt;/P&gt;&lt;P&gt;                                               ebelp = it_ekpo-ebelp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      ls_node_text = la_ekpo-ebelp.&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;      clear ls_item_layout.&lt;/P&gt;&lt;P&gt;      ls_item_layout-fieldname = tree-&amp;gt;c_hierarchy_column_name.&lt;/P&gt;&lt;P&gt;      ls_item_layout-class   = cl_gui_column_tree=&amp;gt;item_class_checkbox.&lt;/P&gt;&lt;P&gt;      ls_item_layout-editable = 'X'.&lt;/P&gt;&lt;P&gt;      append ls_item_layout to lt_item_layout.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      clear ls_item_layout.&lt;/P&gt;&lt;P&gt;      ls_item_layout-fieldname = 'EBELP'.&lt;/P&gt;&lt;P&gt;      ls_item_layout-alignment = cl_gui_column_tree=&amp;gt;align_right.&lt;/P&gt;&lt;P&gt;      append ls_item_layout to lt_item_layout.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Adding Second level of node&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      call method tree-&amp;gt;add_node&lt;/P&gt;&lt;P&gt;        exporting&lt;/P&gt;&lt;P&gt;          i_relat_node_key     = l_ebeln_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          = ls_node_text&lt;/P&gt;&lt;P&gt;          is_outtab_line       = la_ekpo&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       = l_ebelp_key&lt;/P&gt;&lt;P&gt;        exceptions&lt;/P&gt;&lt;P&gt;          relat_node_not_found = 1&lt;/P&gt;&lt;P&gt;          node_not_found       = 2&lt;/P&gt;&lt;P&gt;          others               = 3.&lt;/P&gt;&lt;P&gt;      if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;        message id sy-msgid type sy-msgty number sy-msgno&lt;/P&gt;&lt;P&gt;           with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;      clear la_ekpo.&lt;/P&gt;&lt;P&gt;    endat.&lt;/P&gt;&lt;P&gt;    clear la_ekpo.&lt;/P&gt;&lt;P&gt;    clear it_ekpo.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;endform.                    " create_hierarchy&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp;      Module  ALV_TREE_PAI  INPUT&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;module alv_tree_pai input.&lt;/P&gt;&lt;P&gt;  save_ok = ok_code.&lt;/P&gt;&lt;P&gt;  clear ok_code.&lt;/P&gt;&lt;P&gt;  case save_ok.&lt;/P&gt;&lt;P&gt;    when 'EXIT' or 'BACK' or 'CANC'.&lt;/P&gt;&lt;P&gt;      perform exit_program.&lt;/P&gt;&lt;P&gt;    when others.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;§6. Call dispatch to process toolbar functions&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      call method cl_gui_cfw=&amp;gt;dispatch.&lt;/P&gt;&lt;P&gt;  endcase.&lt;/P&gt;&lt;P&gt;  call method cl_gui_cfw=&amp;gt;flush.&lt;/P&gt;&lt;P&gt;endmodule.                 " ALV_TREE_PAI  INPUT&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  exit_program&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;form exit_program .&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Exiting the Program and Empting the ALV Tree&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  call method cc-&amp;gt;free.&lt;/P&gt;&lt;P&gt;  leave program.&lt;/P&gt;&lt;P&gt;endform.                    " exit_program&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  get_htmlheader&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     --&amp;gt;P_WA_LIST_COMMENTARY  text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;form get_htmlheader  using  p_list_commentary type slis_t_listheader&lt;/P&gt;&lt;P&gt;                            p_logo             type sdydo_value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Populating the LIST_COMMENTARY Table for the HTML Header in the ALV.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  clear ls_line.&lt;/P&gt;&lt;P&gt;  ls_line-typ  = 'H'.&lt;/P&gt;&lt;P&gt;  ls_line-info = text-017.&lt;/P&gt;&lt;P&gt;  append ls_line to p_list_commentary.&lt;/P&gt;&lt;P&gt;  clear ls_line.&lt;/P&gt;&lt;P&gt;  ls_line-typ  = 'S'.&lt;/P&gt;&lt;P&gt;  ls_line-info = text-018.&lt;/P&gt;&lt;P&gt;  append ls_line to p_list_commentary.&lt;/P&gt;&lt;P&gt;  ls_line-key  = text-019.&lt;/P&gt;&lt;P&gt;  ls_line-info = sy-datum.&lt;/P&gt;&lt;P&gt;  append ls_line to p_list_commentary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   p_logo = 'ENJOYSAP_LOGO'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.                    " get_htmlheader&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  register_events&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;form register_events .&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Declaring the Refrence variable to the CLASS Created for handling the&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; Tree Events&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  data : l_event_receiver       type ref to lcl_tree_event_receiver.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Fetching all the Registered events of the tree.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  call method tree-&amp;gt;get_registered_events&lt;/P&gt;&lt;P&gt;    importing&lt;/P&gt;&lt;P&gt;      events = lt_events.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Attachign the Event ID To the Required Events in the Events Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  l_event-eventid = cl_gui_column_tree=&amp;gt;eventid_node_double_click.&lt;/P&gt;&lt;P&gt;  append l_event to lt_events.&lt;/P&gt;&lt;P&gt;  l_event-eventid = cl_gui_column_tree=&amp;gt;eventid_checkbox_change.&lt;/P&gt;&lt;P&gt;  append l_event to lt_events.&lt;/P&gt;&lt;P&gt;  l_event-eventid = cl_gui_column_tree=&amp;gt;eventid_node_context_menu_req.&lt;/P&gt;&lt;P&gt;  append l_event to lt_events.&lt;/P&gt;&lt;P&gt;  l_event-eventid = cl_gui_column_tree=&amp;gt;eventid_checkbox_change.&lt;/P&gt;&lt;P&gt;  append l_event to lt_events.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Registering the Event Id Attached to the Events in the Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  call method tree-&amp;gt;set_registered_events&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      events                    = lt_events&lt;/P&gt;&lt;P&gt;    exceptions&lt;/P&gt;&lt;P&gt;      cntl_error                = 1&lt;/P&gt;&lt;P&gt;      cntl_system_error         = 2&lt;/P&gt;&lt;P&gt;      illegal_event_combination = 3.&lt;/P&gt;&lt;P&gt;  if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    message x208(00) with 'ERROR'.                          "#EC NOTEXT&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Creating the Object of Tree Event Receiver CLass&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  create object l_event_receiver.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Setting the Handler for the Events Used.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  set handler l_event_receiver-&amp;gt;handle_node_double_click for tree.&lt;/P&gt;&lt;P&gt;  set handler l_event_receiver-&amp;gt;handle_node_cm_req for tree.&lt;/P&gt;&lt;P&gt;  set handler l_event_receiver-&amp;gt;handle_node_cm_sel for tree.&lt;/P&gt;&lt;P&gt;  set handler l_event_receiver-&amp;gt;handle_checkbox_changed for tree.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.                    " register_events&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  Change_Toolbar&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;form change_toolbar .&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Declaring the Refrence Variable to the Toolbar Event Receiver Class.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  data : toolbar_event_receiver type ref to lcl_toolbar_event_receiver.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;get toolbar control&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  call method tree-&amp;gt;get_toolbar_object&lt;/P&gt;&lt;P&gt;    importing&lt;/P&gt;&lt;P&gt;      er_toolbar = mr_toolbar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  check not mr_toolbar is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;add seperator to toolbar&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  call method mr_toolbar-&amp;gt;add_button&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      fcode     = ''&lt;/P&gt;&lt;P&gt;      icon      = ''&lt;/P&gt;&lt;P&gt;      butn_type = cntb_btype_sep&lt;/P&gt;&lt;P&gt;      text      = ''&lt;/P&gt;&lt;P&gt;      quickinfo = 'This is a Seperator'.                    "#EC NOTEXT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;add Standard Button to toolbar (for Delete Subtree)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  call method mr_toolbar-&amp;gt;add_button&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      fcode     = 'DELETE'&lt;/P&gt;&lt;P&gt;      icon      = '@18@'&lt;/P&gt;&lt;P&gt;      butn_type = cntb_btype_button&lt;/P&gt;&lt;P&gt;      text      = ''&lt;/P&gt;&lt;P&gt;      quickinfo = 'Delete subtree'.                         "#EC NOTEXT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;add Dropdown Button to toolbar (for Insert Line)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  call method mr_toolbar-&amp;gt;add_button&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      fcode     = 'INSERT_LC'&lt;/P&gt;&lt;P&gt;      icon      = '@17@'&lt;/P&gt;&lt;P&gt;      butn_type = cntb_btype_dropdown&lt;/P&gt;&lt;P&gt;      text      = ''&lt;/P&gt;&lt;P&gt;      quickinfo = 'Insert Line'.                            "#EC NOTEXT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;add Dropdown Button to toolbar (for Insert Line)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  call method mr_toolbar-&amp;gt;add_button&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      fcode     = 'SELECT_ALL'&lt;/P&gt;&lt;P&gt;      icon      = '@4B@'&lt;/P&gt;&lt;P&gt;      butn_type = ''   "cntb_btype_dropdown&lt;/P&gt;&lt;P&gt;      text      = ''&lt;/P&gt;&lt;P&gt;      quickinfo = 'SELECT ALL'.                             "#EC NOTEXT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;add Dropdown Button to toolbar (for Insert Line)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  call method mr_toolbar-&amp;gt;add_button&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      fcode     = 'DESELECT_ALL'&lt;/P&gt;&lt;P&gt;      icon      = '@4D@'&lt;/P&gt;&lt;P&gt;      butn_type = ''  "CNTB_BTYPE_CHECK&lt;/P&gt;&lt;P&gt;      text      = ''&lt;/P&gt;&lt;P&gt;      quickinfo = 'DESELECT ALL'.                           "#EC NOTEXT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Creating the Object of the Toolbar Events Receiver CLass.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  create object toolbar_event_receiver.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;set event-handler for toolbar-control&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  set handler toolbar_event_receiver-&amp;gt;on_function_selected&lt;/P&gt;&lt;P&gt;                                                      for mr_toolbar.&lt;/P&gt;&lt;P&gt;  set handler toolbar_event_receiver-&amp;gt;on_toolbar_dropdown&lt;/P&gt;&lt;P&gt;                                                      for mr_toolbar.&lt;/P&gt;&lt;P&gt;endform.                    " Change_Toolbar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Vivek Gaur&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2008 07:42:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/tree-structure/m-p/4336775#M1033086</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-29T07:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: Tree structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/tree-structure/m-p/4336776#M1033087</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for answering to my question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Aug 2008 12:09:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/tree-structure/m-p/4336776#M1033087</guid>
      <dc:creator>giridhar_padaraju</dc:creator>
      <dc:date>2008-08-29T12:09:33Z</dc:date>
    </item>
  </channel>
</rss>

