<?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 sample for cl_gui_column_tree in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-for-cl-gui-column-tree/m-p/2069258#M428416</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does somebody know how to create a &lt;/P&gt;&lt;P&gt;cl_gui_column_tree. It would be very helpful&lt;/P&gt;&lt;P&gt;if I could have a sample code. I need three&lt;/P&gt;&lt;P&gt;nodes. The top node fpr customer the second node for&lt;/P&gt;&lt;P&gt;QM-Nr and the last node for the Range of Date.&lt;/P&gt;&lt;P&gt;Maybe an example with SAP's standard Flightmodel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Ilhan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 Mar 2007 16:06:43 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-03-08T16:06:43Z</dc:date>
    <item>
      <title>sample for cl_gui_column_tree</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-for-cl-gui-column-tree/m-p/2069258#M428416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does somebody know how to create a &lt;/P&gt;&lt;P&gt;cl_gui_column_tree. It would be very helpful&lt;/P&gt;&lt;P&gt;if I could have a sample code. I need three&lt;/P&gt;&lt;P&gt;nodes. The top node fpr customer the second node for&lt;/P&gt;&lt;P&gt;QM-Nr and the last node for the Range of Date.&lt;/P&gt;&lt;P&gt;Maybe an example with SAP's standard Flightmodel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Ilhan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Mar 2007 16:06:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-for-cl-gui-column-tree/m-p/2069258#M428416</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-08T16:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: sample for cl_gui_column_tree</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-for-cl-gui-column-tree/m-p/2069259#M428417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check out any programs which start with BCALV_TREE*   &lt;/P&gt;&lt;P&gt;For example, program BCALV_TREE_SIMPLE_DEMO&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Mar 2007 16:10:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-for-cl-gui-column-tree/m-p/2069259#M428417</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2007-03-08T16:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: sample for cl_gui_column_tree</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-for-cl-gui-column-tree/m-p/2069260#M428418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;chk the demo porgrams:&lt;/P&gt;&lt;P&gt;SAPCOLUMN_TREE_CONTROL_DEMO&lt;/P&gt;&lt;P&gt;BCALV_TREE_DEMO&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;madhu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Mar 2007 16:10:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-for-cl-gui-column-tree/m-p/2069260#M428418</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-08T16:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: sample for cl_gui_column_tree</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-for-cl-gui-column-tree/m-p/2069261#M428419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;check this program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BCALV_TREE_DEMO&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check this link for sample program,&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_mainsetup.htm" target="test_blank"&gt;http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_mainsetup.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sruthi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Mar 2007 16:11:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-for-cl-gui-column-tree/m-p/2069261#M428419</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-08T16:11:12Z</dc:date>
    </item>
    <item>
      <title>Re: sample for cl_gui_column_tree</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-for-cl-gui-column-tree/m-p/2069262#M428420</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;There are standard demo examples provided by SAP .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Go to SE38.&lt;/P&gt;&lt;P&gt;Go to Environment(in the top menu)-&amp;gt;controls examples.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There you can find all kind of controls examples.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check Tree controls-&amp;gt;column tree&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;program SAPCOLUMN_TREE_CONTROL_DEMO uing controls&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BCALV_TREE_DEMO&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps&lt;/P&gt;&lt;P&gt;reward if useful&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Saumya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Mar 2007 16:18:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-for-cl-gui-column-tree/m-p/2069262#M428420</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-08T16:18:29Z</dc:date>
    </item>
    <item>
      <title>Re: sample for cl_gui_column_tree</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-for-cl-gui-column-tree/m-p/2069263#M428421</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;heres one sample prog:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;report z message-id tree_control_msg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&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;      Data declaration&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;constants c_width type i value 500.&lt;/P&gt;&lt;P&gt;class lcl_application definition deferred.&lt;/P&gt;&lt;P&gt;class cl_gui_cfw definition load.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types: item_table_type like standard table of mtreeitm&lt;/P&gt;&lt;P&gt;                       with default key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: g_application type ref to lcl_application,&lt;/P&gt;&lt;P&gt;      splitter_h type ref to cl_gui_splitter_container,&lt;/P&gt;&lt;P&gt;      g_gui_container type ref to cl_gui_container,&lt;/P&gt;&lt;P&gt;      g_gui_container_r type ref to cl_gui_container,&lt;/P&gt;&lt;P&gt;      g_tree type ref to cl_gui_column_tree,&lt;/P&gt;&lt;P&gt;*------node key = CCCCPPPPSSSS&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                \--/         Company          t001-bukrs&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                    \--/     Plant            t001k-bwkey&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                        \--/ Storage Location t001l-lgort&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      g_cntl type ref to cl_gui_toolbar,&lt;/P&gt;&lt;P&gt;      g_ok_code type sy-ucomm. "screen 100 field (only)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&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;      CLASS LCL_APPLICATION DEFINITION&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class lcl_application definition.&lt;/P&gt;&lt;P&gt;  public section.&lt;/P&gt;&lt;P&gt;*--- methods for nodes and items of tree&lt;/P&gt;&lt;P&gt;    methods:&lt;/P&gt;&lt;P&gt;      handle_node_double_click&lt;/P&gt;&lt;P&gt;        for event node_double_click&lt;/P&gt;&lt;P&gt;        of cl_gui_column_tree&lt;/P&gt;&lt;P&gt;        importing node_key,&lt;/P&gt;&lt;P&gt;      handle_header_click&lt;/P&gt;&lt;P&gt;        for event header_click&lt;/P&gt;&lt;P&gt;        of cl_gui_column_tree&lt;/P&gt;&lt;P&gt;        importing header_name,&lt;/P&gt;&lt;P&gt;      handle_expand_no_children&lt;/P&gt;&lt;P&gt;        for event expand_no_children&lt;/P&gt;&lt;P&gt;        of cl_gui_column_tree&lt;/P&gt;&lt;P&gt;        importing node_key,&lt;/P&gt;&lt;P&gt;      handle_item_double_click&lt;/P&gt;&lt;P&gt;        for event item_double_click&lt;/P&gt;&lt;P&gt;        of cl_gui_column_tree&lt;/P&gt;&lt;P&gt;        importing node_key item_name,&lt;/P&gt;&lt;P&gt;      handle_button_click&lt;/P&gt;&lt;P&gt;        for event button_click&lt;/P&gt;&lt;P&gt;        of cl_gui_column_tree&lt;/P&gt;&lt;P&gt;        importing node_key item_name,&lt;/P&gt;&lt;P&gt;      handle_link_click&lt;/P&gt;&lt;P&gt;        for event link_click&lt;/P&gt;&lt;P&gt;        of cl_gui_column_tree&lt;/P&gt;&lt;P&gt;        importing node_key item_name,&lt;/P&gt;&lt;P&gt;      handle_checkbox_change&lt;/P&gt;&lt;P&gt;        for event checkbox_change&lt;/P&gt;&lt;P&gt;        of cl_gui_column_tree&lt;/P&gt;&lt;P&gt;        importing node_key item_name checked,&lt;/P&gt;&lt;P&gt;*--- methods for sap toolbar&lt;/P&gt;&lt;P&gt;      handle_pushbutton_click&lt;/P&gt;&lt;P&gt;        for event function_selected&lt;/P&gt;&lt;P&gt;        of cl_gui_toolbar&lt;/P&gt;&lt;P&gt;        importing fcode,&lt;/P&gt;&lt;P&gt;*--- methods for context menus for nodes and items of tree&lt;/P&gt;&lt;P&gt;      handle_node_context_menu_req&lt;/P&gt;&lt;P&gt;        for event node_context_menu_request&lt;/P&gt;&lt;P&gt;        of cl_gui_column_tree&lt;/P&gt;&lt;P&gt;        importing node_key menu,&lt;/P&gt;&lt;P&gt;      handle_node_context_menu_sel&lt;/P&gt;&lt;P&gt;        for event node_context_menu_select&lt;/P&gt;&lt;P&gt;        of cl_gui_column_tree&lt;/P&gt;&lt;P&gt;        importing node_key fcode,&lt;/P&gt;&lt;P&gt;      handle_header_context_menu_req&lt;/P&gt;&lt;P&gt;        for event header_context_menu_request&lt;/P&gt;&lt;P&gt;        of cl_gui_column_tree&lt;/P&gt;&lt;P&gt;        importing header_name menu,&lt;/P&gt;&lt;P&gt;      handle_header_context_menu_sel&lt;/P&gt;&lt;P&gt;        for event header_context_menu_select&lt;/P&gt;&lt;P&gt;        of cl_gui_column_tree&lt;/P&gt;&lt;P&gt;        importing header_name fcode,&lt;/P&gt;&lt;P&gt;      handle_dft_context_menu_req&lt;/P&gt;&lt;P&gt;        for event default_context_menu_request&lt;/P&gt;&lt;P&gt;        of cl_gui_column_tree&lt;/P&gt;&lt;P&gt;        importing menu,&lt;/P&gt;&lt;P&gt;      handle_dft_context_menu_sel&lt;/P&gt;&lt;P&gt;        for event default_context_menu_select&lt;/P&gt;&lt;P&gt;        of cl_gui_column_tree&lt;/P&gt;&lt;P&gt;        importing fcode.&lt;/P&gt;&lt;P&gt;endclass.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&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;      CLASS LCL_APPLICATION IMPLEMENTATION&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class lcl_application implementation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  method  handle_node_double_click.&lt;/P&gt;&lt;P&gt;    data: text1 type string,&lt;/P&gt;&lt;P&gt;          text2 type string,&lt;/P&gt;&lt;P&gt;          text3 type string.&lt;/P&gt;&lt;P&gt;    if node_key(4) &amp;lt;&amp;gt; 'Root'.&lt;/P&gt;&lt;P&gt;      concatenate 'Company:' node_key(4) into text1 separated by space.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;    if node_key+4(4) &amp;lt;&amp;gt; space.&lt;/P&gt;&lt;P&gt;      concatenate 'Plant:' node_key+4(4) into text2 separated by space.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;    if node_key+8(4) &amp;lt;&amp;gt; space.&lt;/P&gt;&lt;P&gt;      concatenate 'Storage Location:' node_key+8(4) into text3&lt;/P&gt;&lt;P&gt;                  separated by space.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;    message i398(00) with 'Handle' text1 text2 text3.&lt;/P&gt;&lt;P&gt;  endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  method  handle_header_click.&lt;/P&gt;&lt;P&gt;    message i398(00) with 'Handle header:' header_name.&lt;/P&gt;&lt;P&gt;  endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  method  handle_item_double_click.&lt;/P&gt;&lt;P&gt;    data: text0 type string,&lt;/P&gt;&lt;P&gt;          text1 type string,&lt;/P&gt;&lt;P&gt;          text2 type string,&lt;/P&gt;&lt;P&gt;          text3 type string.&lt;/P&gt;&lt;P&gt;    case item_name.&lt;/P&gt;&lt;P&gt;      when 'Column1'. text0 = 'Handle code for'.&lt;/P&gt;&lt;P&gt;      when 'Column2'. text0 = 'Handle name for'.&lt;/P&gt;&lt;P&gt;      when 'Column3'. text0 = 'Handle city for'.&lt;/P&gt;&lt;P&gt;      when others. text0 = 'Handle'.&lt;/P&gt;&lt;P&gt;    endcase.&lt;/P&gt;&lt;P&gt;    if node_key(4) &amp;lt;&amp;gt; 'Root'.&lt;/P&gt;&lt;P&gt;      concatenate 'Company:' node_key(4) into text1 separated by space.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;    if node_key+4(4) &amp;lt;&amp;gt; space.&lt;/P&gt;&lt;P&gt;      concatenate 'Plant:' node_key+4(4) into text2 separated by space.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;    if node_key+8(4) &amp;lt;&amp;gt; space.&lt;/P&gt;&lt;P&gt;      concatenate 'Storage Location:' node_key+8(4) into text3&lt;/P&gt;&lt;P&gt;                  separated by space.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;    message i398(00) with text0 text1 text2 text3.&lt;/P&gt;&lt;P&gt;  endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  method  handle_link_click.&lt;/P&gt;&lt;P&gt;  endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  method  handle_button_click.&lt;/P&gt;&lt;P&gt;  endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  method  handle_checkbox_change.&lt;/P&gt;&lt;P&gt;  endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  method handle_expand_no_children.&lt;/P&gt;&lt;P&gt;    data: node_table type treev_ntab,&lt;/P&gt;&lt;P&gt;          node type treev_node,&lt;/P&gt;&lt;P&gt;          item_table type item_table_type,&lt;/P&gt;&lt;P&gt;          item type mtreeitm,&lt;/P&gt;&lt;P&gt;          wa_t001l type t001l.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    select lgort lgobe from t001l&lt;/P&gt;&lt;P&gt;           into (wa_t001l-lgort, wa_t001l-lgobe)&lt;/P&gt;&lt;P&gt;           where werks = node_key+4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      clear node.&lt;/P&gt;&lt;P&gt;      node-node_key   = node_key.&lt;/P&gt;&lt;P&gt;      node-node_key+8 = wa_t001l-lgort.&lt;/P&gt;&lt;P&gt;      node-relatkey   = node_key.&lt;/P&gt;&lt;P&gt;      node-relatship  = cl_gui_column_tree=&amp;gt;relat_last_child.&lt;/P&gt;&lt;P&gt;      append node to node_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      clear item.&lt;/P&gt;&lt;P&gt;      item-node_key = node-node_key.&lt;/P&gt;&lt;P&gt;      item-item_name = 'Column1'.&lt;/P&gt;&lt;P&gt;      item-class = cl_gui_column_tree=&amp;gt;item_class_text.&lt;/P&gt;&lt;P&gt;      item-font = cl_gui_column_tree=&amp;gt;item_font_default.&lt;/P&gt;&lt;P&gt;      item-text = wa_t001l-lgort.&lt;/P&gt;&lt;P&gt;      item-t_image = '@AC@'.&lt;/P&gt;&lt;P&gt;      item-usebgcolor = 'X'.&lt;/P&gt;&lt;P&gt;      append item to item_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      clear item.&lt;/P&gt;&lt;P&gt;      item-node_key = node-node_key.&lt;/P&gt;&lt;P&gt;      item-item_name = 'Column2'.&lt;/P&gt;&lt;P&gt;      item-class = cl_gui_column_tree=&amp;gt;item_class_text.&lt;/P&gt;&lt;P&gt;      item-font = cl_gui_column_tree=&amp;gt;item_font_default.&lt;/P&gt;&lt;P&gt;      item-text = wa_t001l-lgobe.&lt;/P&gt;&lt;P&gt;      append item to item_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    endselect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    call method g_tree-&amp;gt;add_nodes_and_items&lt;/P&gt;&lt;P&gt;      exporting&lt;/P&gt;&lt;P&gt;        node_table = node_table&lt;/P&gt;&lt;P&gt;        item_table = item_table&lt;/P&gt;&lt;P&gt;        item_table_structure_name = 'MTREEITM'&lt;/P&gt;&lt;P&gt;      exceptions&lt;/P&gt;&lt;P&gt;        failed = 1&lt;/P&gt;&lt;P&gt;        cntl_system_error = 3&lt;/P&gt;&lt;P&gt;        error_in_tables = 4&lt;/P&gt;&lt;P&gt;        dp_error = 5&lt;/P&gt;&lt;P&gt;        table_structure_name_not_found = 6.&lt;/P&gt;&lt;P&gt;    if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;      message a000.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;  endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  method  handle_pushbutton_click.&lt;/P&gt;&lt;P&gt;    data level type i.&lt;/P&gt;&lt;P&gt;    case fcode.&lt;/P&gt;&lt;P&gt;      when 'COMPANY'.  level = 0.&lt;/P&gt;&lt;P&gt;      when 'PLANT'.    level = 1.&lt;/P&gt;&lt;P&gt;      when 'STORAGE'.  level = 2.&lt;/P&gt;&lt;P&gt;      when 'COLLAPSE'. level = -1.&lt;/P&gt;&lt;P&gt;    endcase.&lt;/P&gt;&lt;P&gt;    call method g_tree-&amp;gt;collapse_all_nodes.&lt;/P&gt;&lt;P&gt;    if level &amp;gt;= 0.&lt;/P&gt;&lt;P&gt;      call method g_tree-&amp;gt;expand_node exporting node_key = 'Root'&lt;/P&gt;&lt;P&gt;                                                level_count = level&lt;/P&gt;&lt;P&gt;                                                expand_subtree = space.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;  endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  method handle_node_context_menu_req.&lt;/P&gt;&lt;P&gt;    data: text type gui_text.&lt;/P&gt;&lt;P&gt;    if node_key(4) &amp;lt;&amp;gt; 'Root'.&lt;/P&gt;&lt;P&gt;      concatenate 'Company:' node_key(4) into text separated by space.&lt;/P&gt;&lt;P&gt;      call method menu-&amp;gt;add_function&lt;/P&gt;&lt;P&gt;        exporting text = text&lt;/P&gt;&lt;P&gt;        fcode = 'COMPANY'.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;    if node_key+4(4) &amp;lt;&amp;gt; space.&lt;/P&gt;&lt;P&gt;      concatenate 'Plant:' node_key+4(4) into text separated by space.&lt;/P&gt;&lt;P&gt;      call method menu-&amp;gt;add_function&lt;/P&gt;&lt;P&gt;        exporting text = text&lt;/P&gt;&lt;P&gt;        fcode = 'PLANT'.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;    if node_key+8(4) &amp;lt;&amp;gt; space.&lt;/P&gt;&lt;P&gt;      concatenate 'Storage Location:' node_key+8(4) into text&lt;/P&gt;&lt;P&gt;                  separated by space.&lt;/P&gt;&lt;P&gt;      call method menu-&amp;gt;add_function&lt;/P&gt;&lt;P&gt;        exporting text = text&lt;/P&gt;&lt;P&gt;        fcode = 'STORAGE'.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;    text = 'About...'.&lt;/P&gt;&lt;P&gt;    call method menu-&amp;gt;add_function&lt;/P&gt;&lt;P&gt;        exporting text = text&lt;/P&gt;&lt;P&gt;        fcode = 'ABOUT'.&lt;/P&gt;&lt;P&gt;  endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  method handle_node_context_menu_sel.&lt;/P&gt;&lt;P&gt;    data text type string.&lt;/P&gt;&lt;P&gt;    case fcode.&lt;/P&gt;&lt;P&gt;      when 'COMPANY'.&lt;/P&gt;&lt;P&gt;        concatenate 'Do something for company' node_key(4)&lt;/P&gt;&lt;P&gt;                    into text separated by space.&lt;/P&gt;&lt;P&gt;      when 'PLANT'.&lt;/P&gt;&lt;P&gt;        concatenate 'Do something for plant' node_key+4(4)&lt;/P&gt;&lt;P&gt;                    into text separated by space.&lt;/P&gt;&lt;P&gt;      when 'STORAGE'.&lt;/P&gt;&lt;P&gt;        concatenate 'Do something for storage location' node_key+8(4)&lt;/P&gt;&lt;P&gt;                    into text separated by space.&lt;/P&gt;&lt;P&gt;      when 'ABOUT'. text = 'Object Oriented Abap Demo'.&lt;/P&gt;&lt;P&gt;    endcase.&lt;/P&gt;&lt;P&gt;    message i398(00) with text.&lt;/P&gt;&lt;P&gt;  endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  method handle_header_context_menu_req.&lt;/P&gt;&lt;P&gt;    data: text type gui_text.&lt;/P&gt;&lt;P&gt;    concatenate 'Header:' header_name into text separated by space.&lt;/P&gt;&lt;P&gt;    call method menu-&amp;gt;add_function&lt;/P&gt;&lt;P&gt;        exporting text = text&lt;/P&gt;&lt;P&gt;        fcode = 'HEADER'.&lt;/P&gt;&lt;P&gt;    text = 'About...'.&lt;/P&gt;&lt;P&gt;    call method menu-&amp;gt;add_function&lt;/P&gt;&lt;P&gt;        exporting text = text&lt;/P&gt;&lt;P&gt;        fcode = 'ABOUT'.&lt;/P&gt;&lt;P&gt;  endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  method handle_header_context_menu_sel.&lt;/P&gt;&lt;P&gt;    data text type string.&lt;/P&gt;&lt;P&gt;    case fcode.&lt;/P&gt;&lt;P&gt;      when 'HEADER'.&lt;/P&gt;&lt;P&gt;        concatenate 'Do something for header' header_name&lt;/P&gt;&lt;P&gt;                    into text separated by space.&lt;/P&gt;&lt;P&gt;      when 'ABOUT'. text = 'Object Oriented Abap Demo'.&lt;/P&gt;&lt;P&gt;    endcase.&lt;/P&gt;&lt;P&gt;    message i398(00) with text.&lt;/P&gt;&lt;P&gt;  endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  method handle_dft_context_menu_req.&lt;/P&gt;&lt;P&gt;    data: text type gui_text.&lt;/P&gt;&lt;P&gt;    text = 'About...'.&lt;/P&gt;&lt;P&gt;    call method menu-&amp;gt;add_function&lt;/P&gt;&lt;P&gt;        exporting text = text&lt;/P&gt;&lt;P&gt;        fcode = 'ABOUT'.&lt;/P&gt;&lt;P&gt;    text = 'Exit...'.&lt;/P&gt;&lt;P&gt;    call method menu-&amp;gt;add_function&lt;/P&gt;&lt;P&gt;        exporting text = text&lt;/P&gt;&lt;P&gt;        fcode = 'BYE'.&lt;/P&gt;&lt;P&gt;  endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  method handle_dft_context_menu_sel.&lt;/P&gt;&lt;P&gt;    case fcode.&lt;/P&gt;&lt;P&gt;      when 'ABOUT'. message i398(00) with 'Object Oriented Abap Demo'.&lt;/P&gt;&lt;P&gt;      when 'BYE'.&lt;/P&gt;&lt;P&gt;        perform finish_program.&lt;/P&gt;&lt;P&gt;        leave program.&lt;/P&gt;&lt;P&gt;    endcase.&lt;/P&gt;&lt;P&gt;  endmethod.&lt;/P&gt;&lt;P&gt;endclass.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&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;      MODULE PBO_100 OUTPUT                                         *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;module pbo_100 output.&lt;/P&gt;&lt;P&gt;  set pf-status 'MAIN'.&lt;/P&gt;&lt;P&gt;  if g_tree is initial.&lt;/P&gt;&lt;P&gt;    perform create_and_init_tree.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;endmodule.                 " PBO_0100  OUTPUT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&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;      MODULE PAI_100 INPUT                                          *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;module pai_100 input.&lt;/P&gt;&lt;P&gt;  data: return_code type i.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;CL_GUI_CFW=&amp;gt;DISPATCH must be called if events are registered&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;that trigger PAI&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;this method calls the event handler method of an event&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;    importing return_code = return_code.&lt;/P&gt;&lt;P&gt;  if return_code &amp;lt;&amp;gt; cl_gui_cfw=&amp;gt;rc_noevent.&lt;/P&gt;&lt;P&gt;    " a control event occured =&amp;gt; exit PAI&lt;/P&gt;&lt;P&gt;    clear g_ok_code.&lt;/P&gt;&lt;P&gt;    exit.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  case g_ok_code.&lt;/P&gt;&lt;P&gt;    when 'BACK'. " Finish program&lt;/P&gt;&lt;P&gt;      perform finish_program.&lt;/P&gt;&lt;P&gt;      leave program.&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;CAUTION: clear ok code!&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  clear g_ok_code.&lt;/P&gt;&lt;P&gt;endmodule.                 " PAI_0100  INPUT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&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;     Form  CREATE_AND_INIT_TREE&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form create_and_init_tree.&lt;/P&gt;&lt;P&gt;  data: node_table type treev_ntab,&lt;/P&gt;&lt;P&gt;        item_table type item_table_type,&lt;/P&gt;&lt;P&gt;        events type cntl_simple_events,&lt;/P&gt;&lt;P&gt;        event type cntl_simple_event,&lt;/P&gt;&lt;P&gt;        hierarchy_header type treev_hhdr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  create object splitter_h&lt;/P&gt;&lt;P&gt;           exporting&lt;/P&gt;&lt;P&gt;           parent = cl_gui_container=&amp;gt;screen0&lt;/P&gt;&lt;P&gt;           rows = 1&lt;/P&gt;&lt;P&gt;           columns = 2.&lt;/P&gt;&lt;P&gt;  call method splitter_h-&amp;gt;set_border&lt;/P&gt;&lt;P&gt;         exporting border = cl_gui_cfw=&amp;gt;false.&lt;/P&gt;&lt;P&gt;  call method splitter_h-&amp;gt;set_column_mode&lt;/P&gt;&lt;P&gt;         exporting mode = splitter_h-&amp;gt;mode_absolute.&lt;/P&gt;&lt;P&gt;  call method splitter_h-&amp;gt;set_column_width&lt;/P&gt;&lt;P&gt;         exporting id = 1&lt;/P&gt;&lt;P&gt;         width = c_width.&lt;/P&gt;&lt;P&gt;  g_gui_container   = splitter_h-&amp;gt;get_container( row = 1 column = 1 ).&lt;/P&gt;&lt;P&gt;  g_gui_container_r = splitter_h-&amp;gt;get_container( row = 1 column = 2 ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;setup the hierarchy header&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  hierarchy_header-heading = 'Company/Plant/Storage Location'.&lt;/P&gt;&lt;P&gt;  hierarchy_header-width = 35.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;create a column tree control&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  create object g_tree&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      parent              = g_gui_container&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;      item_selection     = 'X'&lt;/P&gt;&lt;P&gt;      hierarchy_column_name = 'Column1'&lt;/P&gt;&lt;P&gt;      hierarchy_header = hierarchy_header&lt;/P&gt;&lt;P&gt;    exceptions&lt;/P&gt;&lt;P&gt;      cntl_system_error           = 1&lt;/P&gt;&lt;P&gt;      create_error                = 2&lt;/P&gt;&lt;P&gt;      failed                      = 3&lt;/P&gt;&lt;P&gt;      illegal_node_selection_mode = 4&lt;/P&gt;&lt;P&gt;      illegal_column_name         = 5&lt;/P&gt;&lt;P&gt;      lifetime_error              = 6.&lt;/P&gt;&lt;P&gt;  if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    message a000.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;insert two additional columns&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  call method g_tree-&amp;gt;add_column&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      name = 'Column2'&lt;/P&gt;&lt;P&gt;      width = 40&lt;/P&gt;&lt;P&gt;      header_text = 'Name'&lt;/P&gt;&lt;P&gt;    exceptions&lt;/P&gt;&lt;P&gt;      column_exists                 = 1&lt;/P&gt;&lt;P&gt;      illegal_column_name           = 2&lt;/P&gt;&lt;P&gt;      too_many_columns              = 3&lt;/P&gt;&lt;P&gt;      illegal_alignment             = 4&lt;/P&gt;&lt;P&gt;      different_column_types        = 5&lt;/P&gt;&lt;P&gt;      cntl_system_error             = 6&lt;/P&gt;&lt;P&gt;      failed                        = 7&lt;/P&gt;&lt;P&gt;      predecessor_column_not_found  = 8.&lt;/P&gt;&lt;P&gt;  if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    message a000.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;  call method g_tree-&amp;gt;add_column&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      name = 'Column3'&lt;/P&gt;&lt;P&gt;      width = 30&lt;/P&gt;&lt;P&gt;      header_text = 'City'&lt;/P&gt;&lt;P&gt;    exceptions&lt;/P&gt;&lt;P&gt;      column_exists                 = 1&lt;/P&gt;&lt;P&gt;      illegal_column_name           = 2&lt;/P&gt;&lt;P&gt;      too_many_columns              = 3&lt;/P&gt;&lt;P&gt;      illegal_alignment             = 4&lt;/P&gt;&lt;P&gt;      different_column_types        = 5&lt;/P&gt;&lt;P&gt;      cntl_system_error             = 6&lt;/P&gt;&lt;P&gt;      failed                        = 7&lt;/P&gt;&lt;P&gt;      predecessor_column_not_found  = 8.&lt;/P&gt;&lt;P&gt;  if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    message a000.&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;create a tool bar control&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  create object g_cntl&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      parent       = g_gui_container_r&lt;/P&gt;&lt;P&gt;      display_mode = cl_gui_toolbar=&amp;gt;m_mode_vertical&lt;/P&gt;&lt;P&gt;    exceptions&lt;/P&gt;&lt;P&gt;      cntl_install_error          = 1&lt;/P&gt;&lt;P&gt;      cntl_error                  = 2.&lt;/P&gt;&lt;P&gt;  if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    message a000.   "not very appropriate msg, but...&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;define the events which will be passed to the backend&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;from tree&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  event-appl_event = 'X'.                                   "&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  event-eventid = cl_gui_column_tree=&amp;gt;eventid_node_double_click.&lt;/P&gt;&lt;P&gt;  append event to events.&lt;/P&gt;&lt;P&gt;  event-eventid = cl_gui_column_tree=&amp;gt;eventid_header_click.&lt;/P&gt;&lt;P&gt;  append event to events.&lt;/P&gt;&lt;P&gt;  event-eventid = cl_gui_column_tree=&amp;gt;eventid_item_double_click.&lt;/P&gt;&lt;P&gt;  append event to events.&lt;/P&gt;&lt;P&gt;  event-eventid = cl_gui_column_tree=&amp;gt;eventid_expand_no_children.&lt;/P&gt;&lt;P&gt;  append event to events.&lt;/P&gt;&lt;P&gt;  event-eventid = cl_gui_column_tree=&amp;gt;eventid_link_click.&lt;/P&gt;&lt;P&gt;  append event to events.&lt;/P&gt;&lt;P&gt;  event-eventid = cl_gui_column_tree=&amp;gt;eventid_button_click.&lt;/P&gt;&lt;P&gt;  append event to events.&lt;/P&gt;&lt;P&gt;  event-eventid = cl_gui_column_tree=&amp;gt;eventid_checkbox_change.&lt;/P&gt;&lt;P&gt;  append event to events.&lt;/P&gt;&lt;P&gt;  event-eventid = cl_gui_column_tree=&amp;gt;eventid_node_context_menu_req.&lt;/P&gt;&lt;P&gt;  append event to events.&lt;/P&gt;&lt;P&gt;  event-eventid = cl_gui_column_tree=&amp;gt;eventid_header_context_men_req.&lt;/P&gt;&lt;P&gt;  append event to events.&lt;/P&gt;&lt;P&gt;  event-eventid = cl_gui_column_tree=&amp;gt;eventid_def_context_menu_req.&lt;/P&gt;&lt;P&gt;  append event to events.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call method g_tree-&amp;gt;set_registered_events&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      events = 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 a000.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;from toolbar&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  clear: event, events[].&lt;/P&gt;&lt;P&gt;  event-appl_event = 'X'.                                   "&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  event-eventid = cl_gui_toolbar=&amp;gt;m_id_function_selected.&lt;/P&gt;&lt;P&gt;  append event to events.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call method g_cntl-&amp;gt;set_registered_events&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      events = 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 a000.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;assign event handlers in the application class to each desired event&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  set handler g_application-&amp;gt;handle_node_double_click for g_tree.&lt;/P&gt;&lt;P&gt;  set handler g_application-&amp;gt;handle_header_click for g_tree.&lt;/P&gt;&lt;P&gt;  set handler g_application-&amp;gt;handle_item_double_click for g_tree.&lt;/P&gt;&lt;P&gt;  set handler g_application-&amp;gt;handle_expand_no_children for g_tree.&lt;/P&gt;&lt;P&gt;  set handler g_application-&amp;gt;handle_link_click for g_tree.&lt;/P&gt;&lt;P&gt;  set handler g_application-&amp;gt;handle_button_click for g_tree.&lt;/P&gt;&lt;P&gt;  set handler g_application-&amp;gt;handle_checkbox_change for g_tree.&lt;/P&gt;&lt;P&gt;  set handler g_application-&amp;gt;handle_pushbutton_click for g_cntl.&lt;/P&gt;&lt;P&gt;  set handler g_application-&amp;gt;handle_node_context_menu_req for g_tree.&lt;/P&gt;&lt;P&gt;  set handler g_application-&amp;gt;handle_node_context_menu_sel for g_tree.&lt;/P&gt;&lt;P&gt;  set handler g_application-&amp;gt;handle_header_context_menu_req for g_tree.&lt;/P&gt;&lt;P&gt;  set handler g_application-&amp;gt;handle_header_context_menu_sel for g_tree.&lt;/P&gt;&lt;P&gt;  set handler g_application-&amp;gt;handle_dft_context_menu_req for g_tree.&lt;/P&gt;&lt;P&gt;  set handler g_application-&amp;gt;handle_dft_context_menu_sel for g_tree.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;add some nodes to the tree control&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;NOTE: the tree control does not store data at the backend. If an&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;application wants to access tree data later, it must store the&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;tree data itself.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  perform build_node_and_item_table using node_table item_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call method g_tree-&amp;gt;add_nodes_and_items&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;      node_table = node_table&lt;/P&gt;&lt;P&gt;      item_table = item_table&lt;/P&gt;&lt;P&gt;      item_table_structure_name = 'MTREEITM'&lt;/P&gt;&lt;P&gt;    exceptions&lt;/P&gt;&lt;P&gt;      failed = 1&lt;/P&gt;&lt;P&gt;      cntl_system_error = 3&lt;/P&gt;&lt;P&gt;      error_in_tables = 4&lt;/P&gt;&lt;P&gt;      dp_error = 5&lt;/P&gt;&lt;P&gt;      table_structure_name_not_found = 6.&lt;/P&gt;&lt;P&gt;  if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    message a000.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;add some pushbuttons to the toolbar&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call method:&lt;/P&gt;&lt;P&gt;    g_cntl-&amp;gt;add_button exporting fcode = 'COMPANY'&lt;/P&gt;&lt;P&gt;                                 icon  = '@D9@'&lt;/P&gt;&lt;P&gt;                                 butn_type = cntb_btype_button&lt;/P&gt;&lt;P&gt;                                 text  = 'Expand Companies'&lt;/P&gt;&lt;P&gt;                       exceptions cntl_error = 1,&lt;/P&gt;&lt;P&gt;    g_cntl-&amp;gt;add_button exporting fcode = 'PLANT'&lt;/P&gt;&lt;P&gt;                                 icon  = '@A8@'&lt;/P&gt;&lt;P&gt;                                 butn_type = cntb_btype_button&lt;/P&gt;&lt;P&gt;                                 text  = 'Expand Plants'&lt;/P&gt;&lt;P&gt;                       exceptions cntl_error = 1,&lt;/P&gt;&lt;P&gt;    g_cntl-&amp;gt;add_button exporting fcode = 'STORAGE'&lt;/P&gt;&lt;P&gt;                                 icon  = '@AC@'&lt;/P&gt;&lt;P&gt;                                 butn_type = cntb_btype_button&lt;/P&gt;&lt;P&gt;         text  = 'Expand Storage Locations (viewed only)'&lt;/P&gt;&lt;P&gt;                       exceptions cntl_error = 1,&lt;/P&gt;&lt;P&gt;    g_cntl-&amp;gt;add_button exporting fcode = 'COLLAPSE'&lt;/P&gt;&lt;P&gt;                                 icon  = '@69@'&lt;/P&gt;&lt;P&gt;                                 butn_type = cntb_btype_button&lt;/P&gt;&lt;P&gt;                                 text  = 'Collapse All'&lt;/P&gt;&lt;P&gt;                       exceptions cntl_error = 1.&lt;/P&gt;&lt;P&gt;  if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    message a000.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.                               " CREATE_AND_INIT_TREE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&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;     Form  build_node_and_item_table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form build_node_and_item_table&lt;/P&gt;&lt;P&gt;  using&lt;/P&gt;&lt;P&gt;    node_table type treev_ntab&lt;/P&gt;&lt;P&gt;    item_table type item_table_type.&lt;/P&gt;&lt;P&gt;&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;        wa_t001  like t001,&lt;/P&gt;&lt;P&gt;        wa_t001l like t001l,&lt;/P&gt;&lt;P&gt;        wa_t001w like t001w,&lt;/P&gt;&lt;P&gt;        wa_t001k like t001k.&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;Caution: The nodes are inserted into the tree according to the order&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;in which they occur in the table. In consequence, a node must not&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;must not occur in the node table before its parent node.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&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;  node-isfolder = 'X'.&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;  clear 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;  clear item.&lt;/P&gt;&lt;P&gt;  item-node_key = node-node_key.&lt;/P&gt;&lt;P&gt;  item-item_name = 'Column1'.&lt;/P&gt;&lt;P&gt;  item-class = cl_gui_column_tree=&amp;gt;item_class_text.&lt;/P&gt;&lt;P&gt;  item-font = cl_gui_column_tree=&amp;gt;item_font_default.&lt;/P&gt;&lt;P&gt;  item-text = 'Companies'.&lt;/P&gt;&lt;P&gt;  append item to item_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  select bukrs butxt ort01 from t001&lt;/P&gt;&lt;P&gt;         into (wa_t001-bukrs, wa_t001-butxt, wa_t001-ort01).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    clear node.&lt;/P&gt;&lt;P&gt;    node-node_key = wa_t001-bukrs.&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-isfolder = 'X'.&lt;/P&gt;&lt;P&gt;    append node to node_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    clear item.&lt;/P&gt;&lt;P&gt;    item-node_key = node-node_key.&lt;/P&gt;&lt;P&gt;    item-item_name = 'Column1'.&lt;/P&gt;&lt;P&gt;    item-class = cl_gui_column_tree=&amp;gt;item_class_text.&lt;/P&gt;&lt;P&gt;    item-font = cl_gui_column_tree=&amp;gt;item_font_default.&lt;/P&gt;&lt;P&gt;    item-text = wa_t001-bukrs.&lt;/P&gt;&lt;P&gt;    item-t_image = '@D9@'.&lt;/P&gt;&lt;P&gt;    item-usebgcolor = 'X'.&lt;/P&gt;&lt;P&gt;    append item to item_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    clear item.&lt;/P&gt;&lt;P&gt;    item-node_key = node-node_key.&lt;/P&gt;&lt;P&gt;    item-item_name = 'Column2'.&lt;/P&gt;&lt;P&gt;    item-class = cl_gui_column_tree=&amp;gt;item_class_text.&lt;/P&gt;&lt;P&gt;    item-length = 30.&lt;/P&gt;&lt;P&gt;    item-font = cl_gui_column_tree=&amp;gt;item_font_default.&lt;/P&gt;&lt;P&gt;    item-text = wa_t001-butxt.&lt;/P&gt;&lt;P&gt;    append item to item_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    clear item.&lt;/P&gt;&lt;P&gt;    item-node_key = node-node_key.&lt;/P&gt;&lt;P&gt;    item-item_name = 'Column3'.&lt;/P&gt;&lt;P&gt;    item-class = cl_gui_column_tree=&amp;gt;item_class_text.&lt;/P&gt;&lt;P&gt;    item-font = cl_gui_column_tree=&amp;gt;item_font_default.&lt;/P&gt;&lt;P&gt;    item-text = wa_t001-ort01.&lt;/P&gt;&lt;P&gt;    append item to item_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    select bwkey bukrs from t001k&lt;/P&gt;&lt;P&gt;           into (wa_t001k-bwkey, wa_t001k-bukrs)&lt;/P&gt;&lt;P&gt;           where bukrs = wa_t001-bukrs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      clear node.&lt;/P&gt;&lt;P&gt;      node-node_key   = wa_t001-bukrs.&lt;/P&gt;&lt;P&gt;      node-node_key+4 = wa_t001k-bwkey.&lt;/P&gt;&lt;P&gt;      node-relatkey = wa_t001-bukrs.&lt;/P&gt;&lt;P&gt;      node-relatship = cl_gui_column_tree=&amp;gt;relat_last_child.&lt;/P&gt;&lt;P&gt;      node-isfolder = 'X'.&lt;/P&gt;&lt;P&gt;      node-expander = 'X'. " The node is marked with a '+', although&lt;/P&gt;&lt;P&gt;              " it has no children. When the user clicks on the&lt;/P&gt;&lt;P&gt;              " + to open the node, the event expand_nc is&lt;/P&gt;&lt;P&gt;              " fired. The programmer can&lt;/P&gt;&lt;P&gt;              " add the children of the&lt;/P&gt;&lt;P&gt;              " node within the event handler of the expand_nc&lt;/P&gt;&lt;P&gt;              " event  (see callback handle_expand_nc).&lt;/P&gt;&lt;P&gt;      append node to node_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      select single name1 from t001w into wa_t001w-name1&lt;/P&gt;&lt;P&gt;             where werks = wa_t001k-bwkey.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      clear item.&lt;/P&gt;&lt;P&gt;      item-node_key = node-node_key.&lt;/P&gt;&lt;P&gt;      item-item_name = 'Column1'.&lt;/P&gt;&lt;P&gt;      item-class = cl_gui_column_tree=&amp;gt;item_class_text.&lt;/P&gt;&lt;P&gt;      item-font = cl_gui_column_tree=&amp;gt;item_font_default.&lt;/P&gt;&lt;P&gt;      item-text = wa_t001k-bwkey.&lt;/P&gt;&lt;P&gt;      item-t_image = '@A8@'.&lt;/P&gt;&lt;P&gt;      item-usebgcolor = 'X'.&lt;/P&gt;&lt;P&gt;      append item to item_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      clear item.&lt;/P&gt;&lt;P&gt;      item-node_key = node-node_key.&lt;/P&gt;&lt;P&gt;      item-item_name = 'Column2'.&lt;/P&gt;&lt;P&gt;      item-class = cl_gui_column_tree=&amp;gt;item_class_text.&lt;/P&gt;&lt;P&gt;      item-font = cl_gui_column_tree=&amp;gt;item_font_default.&lt;/P&gt;&lt;P&gt;      item-text = wa_t001w-name1.&lt;/P&gt;&lt;P&gt;      append item to item_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    endselect.&lt;/P&gt;&lt;P&gt;  endselect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.                               " build_node_and_item_table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&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;     Form  finish_program&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form finish_program.&lt;/P&gt;&lt;P&gt;  if not g_gui_container is initial.&lt;/P&gt;&lt;P&gt;    " destroy tree container (detroys contained tree control, too)&lt;/P&gt;&lt;P&gt;    call method g_gui_container-&amp;gt;free&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 &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;      message a000.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;    clear: g_gui_container, g_tree.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;  if not g_gui_container_r is initial.&lt;/P&gt;&lt;P&gt;    " destroy right container (detroys contained toolbar, too)&lt;/P&gt;&lt;P&gt;    call method g_gui_container_r-&amp;gt;free&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 &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;      message a000.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;    clear: g_gui_container_r, g_cntl.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;endform.                    " finish_program&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&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;      Start of selection&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;create the application object&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;this object is needed to handle the ABAP Objects Events of&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Controls&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  create object g_application.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  set screen 100.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;madhu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Mar 2007 16:21:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-for-cl-gui-column-tree/m-p/2069263#M428421</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-08T16:21:58Z</dc:date>
    </item>
  </channel>
</rss>

