<?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: ALV Tree using Function Modules in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-tree-using-function-modules/m-p/964972#M68327</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ramesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check the post.&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="33029"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Vinod&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Jul 2005 07:44:05 GMT</pubDate>
    <dc:creator>Vinod_Chandran</dc:creator>
    <dc:date>2005-07-22T07:44:05Z</dc:date>
    <item>
      <title>ALV Tree using Function Modules</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-tree-using-function-modules/m-p/964971#M68326</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;I want a simple example of ALV Tree using Function Modules which can display multiple Columns in the Hierarchically arranged fashion along with nodes &amp;amp; icons.&lt;/P&gt;&lt;P&gt;Also should be able to handle the events.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in Advance..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jul 2005 07:01:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-tree-using-function-modules/m-p/964971#M68326</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-22T07:01:00Z</dc:date>
    </item>
    <item>
      <title>Re: ALV Tree using Function Modules</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-tree-using-function-modules/m-p/964972#M68327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ramesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check the post.&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="33029"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Vinod&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jul 2005 07:44:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-tree-using-function-modules/m-p/964972#M68327</guid>
      <dc:creator>Vinod_Chandran</dc:creator>
      <dc:date>2005-07-22T07:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: ALV Tree using Function Modules</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-tree-using-function-modules/m-p/964973#M68328</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 this.&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_basic.htm" target="test_blank"&gt;http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_basic.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jul 2005 07:51:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-tree-using-function-modules/m-p/964973#M68328</guid>
      <dc:creator>jayanthi_jayaraman</dc:creator>
      <dc:date>2005-07-22T07:51:06Z</dc:date>
    </item>
    <item>
      <title>Re: ALV Tree using Function Modules</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-tree-using-function-modules/m-p/964974#M68329</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;I will mail u the documents.&lt;/P&gt;&lt;P&gt;Hope it will help u, also u can refer the Downlaods &amp;gt; codesamples &amp;gt;.. there will be some sample codes available.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can u give me ur mail id?&lt;/P&gt;&lt;P&gt;Refer&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/ge002.htm" target="test_blank"&gt;http://www.sap-img.com/ge002.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/tree-type-report-in-abap.htm" target="test_blank"&gt;http://www.sap-img.com/abap/tree-type-report-in-abap.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;This is for ALV tree&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapdevelopment.co.uk/reporting/alv/alvtree.htm" target="test_blank"&gt;http://www.sapdevelopment.co.uk/reporting/alv/alvtree.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Judith.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jul 2005 07:53:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-tree-using-function-modules/m-p/964974#M68329</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-22T07:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: ALV Tree using Function Modules</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-tree-using-function-modules/m-p/964975#M68330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ramesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a example of alv tree &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  BCALV_TREE_DEMO                                             *
*&amp;amp;                                                                     *
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;                                                                     *
*&amp;amp;                                                                     *
*&amp;amp;---------------------------------------------------------------------*

report  bcalv_tree_demo.

class cl_gui_column_tree definition load.
class cl_gui_cfw definition load.

data tree1  type ref to cl_gui_alv_tree.
data mr_toolbar type ref to cl_gui_toolbar.

include &amp;lt;icon&amp;gt;.
include bcalv_toolbar_event_receiver.
include bcalv_tree_event_receiver.

data: toolbar_event_receiver type ref to lcl_toolbar_event_receiver.

data: gt_sflight      type sflight occurs 0,      "Output-Table
      gt_fieldcatalog type lvc_t_fcat, "Fieldcatalog
      ok_code like sy-ucomm.           "OK-Code

start-of-selection.

end-of-selection.

  call screen 100.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  PBO  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*       process before output
*----------------------------------------------------------------------*
module pbo output.

  set pf-status 'MAIN100'.
  if tree1 is initial.
    perform init_tree.
  endif.
  call method cl_gui_cfw=&amp;gt;flush.
endmodule.                             " PBO  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  PAI  INPUT
*&amp;amp;---------------------------------------------------------------------*
*       process after input
*----------------------------------------------------------------------*
module pai input.

  case ok_code.
    when 'EXIT' or 'BACK' or 'CANC'.
      perform exit_program.

    when others.
      call method cl_gui_cfw=&amp;gt;dispatch.
  endcase.
  clear ok_code.
  call method cl_gui_cfw=&amp;gt;flush.
endmodule.                             " PAI  INPUT

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  build_fieldcatalog
*&amp;amp;---------------------------------------------------------------------*
*       build fieldcatalog for structure sflight
*----------------------------------------------------------------------*
form build_fieldcatalog.

* get fieldcatalog
  call function 'LVC_FIELDCATALOG_MERGE'
       exporting
            i_structure_name = 'SFLIGHT'
       changing
            ct_fieldcat      = gt_fieldcatalog.

* change fieldcatalog
  data: ls_fieldcatalog type lvc_s_fcat.
  loop at gt_fieldcatalog into ls_fieldcatalog.
    case ls_fieldcatalog-fieldname.
      when 'CARRID' or 'CONNID' or 'FLDATE'.
        ls_fieldcatalog-no_out = 'X'.
        ls_fieldcatalog-key    = ''.
      when 'PRICE' or 'SEATSOCC' or 'SEATSMAX' or 'PAYMENTSUM'.
        ls_fieldcatalog-do_sum = 'X'.
    endcase.
    modify gt_fieldcatalog from ls_fieldcatalog.
  endloop.
endform.                               " build_fieldcatalog
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  build_hierarchy_header
*&amp;amp;---------------------------------------------------------------------*
*       build hierarchy-header-information
*----------------------------------------------------------------------*
*      --&amp;gt;P_L_HIERARCHY_HEADER  strucxture for hierarchy-header
*----------------------------------------------------------------------*
form build_hierarchy_header changing
                               p_hierarchy_header type treev_hhdr.

  p_hierarchy_header-heading = 'Hierarchy Header'.         "#EC NOTEXT
  p_hierarchy_header-tooltip =
                         'This is the Hierarchy Header !'. "#EC NOTEXT
  p_hierarchy_header-width = 30.
  p_hierarchy_header-width_pix = ''.

endform.                               " build_hierarchy_header
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  exit_program
*&amp;amp;---------------------------------------------------------------------*
*       free object and leave program
*----------------------------------------------------------------------*
form exit_program.

  call method tree1-&amp;gt;free.
  leave program.

endform.                               " exit_program
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  build_header
*&amp;amp;---------------------------------------------------------------------*
*       build table for html_header
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
form build_comment using
      pt_list_commentary type slis_t_listheader
      p_logo             type sdydo_value.

  data: ls_line type slis_listheader.
*
* LIST HEADING LINE: TYPE H
  clear ls_line.
  ls_line-typ  = 'H'.
* LS_LINE-KEY:  NOT USED FOR THIS TYPE
  ls_line-info = 'ALV-tree-demo: flight-overview'.       "#EC NOTEXT
  append ls_line to pt_list_commentary.
* STATUS LINE: TYPE S
  clear ls_line.
  ls_line-typ  = 'S'.
  ls_line-key  = 'valid until'.                          "#EC NOTEXT
  ls_line-info = 'January 29 1999'.                      "#EC NOTEXT
  append ls_line to pt_list_commentary.
  ls_line-key  = 'time'.
  ls_line-info = '2.00 pm'.                              "#EC NOTEXT
  append ls_line to pt_list_commentary.
* ACTION LINE: TYPE A
  clear ls_line.
  ls_line-typ  = 'A'.
* LS_LINE-KEY:  NOT USED FOR THIS TYPE
  ls_line-info = 'actual data'.                          "#EC NOTEXT
  append ls_line to pt_list_commentary.

  p_logo = 'ENJOYSAP_LOGO'.
endform.
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  create_hierarchy
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
form create_hierarchy.

  data: ls_sflight type sflight,
        lt_sflight type sflight occurs 0.

* get data
  select * from sflight into table lt_sflight
                        UP TO 200 ROWS .


  sort lt_sflight by carrid connid fldate.

* add data to tree
  data: l_carrid_key type lvc_nkey,
        l_connid_key type lvc_nkey,
        l_last_key type lvc_nkey.
  loop at lt_sflight into ls_sflight.
    on change of ls_sflight-carrid.
      perform add_carrid_line using    ls_sflight
                                       ''
                              changing l_carrid_key.

    endon.
    on change of ls_sflight-connid.
      perform add_connid_line using    ls_sflight
                                       l_carrid_key
                              changing l_connid_key.

    endon.
    perform add_complete_line using  ls_sflight
                                     l_connid_key
                            changing l_last_key.
  endloop.

* calculate totals
  call method tree1-&amp;gt;update_calculations.

* this method must be called to send the data to the frontend
  call method tree1-&amp;gt;frontend_update.

endform.                               " create_hierarchy

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  add_carrid_line
*&amp;amp;---------------------------------------------------------------------*
*       add hierarchy-level 1 to tree
*----------------------------------------------------------------------*
*      --&amp;gt;P_LS_SFLIGHT  sflight
*      --&amp;gt;P_RELEATKEY   relatkey
*     &amp;lt;--&amp;gt;p_node_key    new node-key
*----------------------------------------------------------------------*
form add_carrid_line using     ps_sflight type sflight
                               p_relat_key type lvc_nkey
                     changing  p_node_key type lvc_nkey.

  data: l_node_text type lvc_value,
        ls_sflight type sflight.

* set item-layout
  data: lt_item_layout type lvc_t_layi,
        ls_item_layout type lvc_s_layi.
  ls_item_layout-t_image = '@3P@'.
  ls_item_layout-fieldname = tree1-&amp;gt;c_hierarchy_column_name.
  ls_item_layout-style   =
                        cl_gui_column_tree=&amp;gt;style_intensifd_critical.
  append ls_item_layout to lt_item_layout.

* add node
  l_node_text =  ps_sflight-carrid.
  call method tree1-&amp;gt;add_node
    exporting
          i_relat_node_key = p_relat_key
          i_relationship   = cl_gui_column_tree=&amp;gt;relat_last_child
          i_node_text      = l_node_text
          is_outtab_line   = ls_sflight
          it_item_layout   = lt_item_layout
       importing
          e_new_node_key = p_node_key.

endform.                               " add_carrid_line
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  add_connid_line
*&amp;amp;---------------------------------------------------------------------*
*       add hierarchy-level 2 to tree
*----------------------------------------------------------------------*
*      --&amp;gt;P_LS_SFLIGHT  sflight
*      --&amp;gt;P_RELEATKEY   relatkey
*     &amp;lt;--&amp;gt;p_node_key    new node-key
*----------------------------------------------------------------------*
form add_connid_line using     ps_sflight type sflight
                               p_relat_key type lvc_nkey
                     changing  p_node_key type lvc_nkey.

  data: l_node_text type lvc_value,
        ls_sflight type sflight.

* set item-layout
  data: lt_item_layout type lvc_t_layi,
        ls_item_layout type lvc_s_layi.
  ls_item_layout-t_image = '@3Y@'.
  ls_item_layout-style   =
                        cl_gui_column_tree=&amp;gt;style_intensified.
  ls_item_layout-fieldname = tree1-&amp;gt;c_hierarchy_column_name.
  append ls_item_layout to lt_item_layout.

* add node
  l_node_text =  ps_sflight-connid.
  call method tree1-&amp;gt;add_node
    exporting
          i_relat_node_key = p_relat_key
          i_relationship   = cl_gui_column_tree=&amp;gt;relat_last_child
          i_node_text      = l_node_text
          is_outtab_line   = ls_sflight
          it_item_layout   = lt_item_layout
       importing
          e_new_node_key = p_node_key.

endform.                               " add_connid_line
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  add_cmplete_line
*&amp;amp;---------------------------------------------------------------------*
*       add hierarchy-level 3 to tree
*----------------------------------------------------------------------*
*      --&amp;gt;P_LS_SFLIGHT  sflight
*      --&amp;gt;P_RELEATKEY   relatkey
*     &amp;lt;--&amp;gt;p_node_key    new node-key
*----------------------------------------------------------------------*
form add_complete_line using   ps_sflight type sflight
                               p_relat_key type lvc_nkey
                     changing  p_node_key type lvc_nkey.

  data: l_node_text type lvc_value.

* set item-layout
  data: lt_item_layout type lvc_t_layi,
        ls_item_layout type lvc_s_layi.
  ls_item_layout-fieldname = tree1-&amp;gt;c_hierarchy_column_name.
  ls_item_layout-class   = cl_gui_column_tree=&amp;gt;item_class_checkbox.
  ls_item_layout-editable = 'X'.
  append ls_item_layout to lt_item_layout.

  l_node_text =  ps_sflight-fldate.
  call method tree1-&amp;gt;add_node
    exporting
          i_relat_node_key = p_relat_key
          i_relationship   = cl_gui_column_tree=&amp;gt;relat_last_child
          is_outtab_line   = ps_sflight
          i_node_text      = l_node_text
          it_item_layout   = lt_item_layout
       importing
          e_new_node_key = p_node_key.

endform.                               " add_complete_line
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  register_events
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
form register_events.
* define the events which will be passed to the backend
  data: lt_events type cntl_simple_events,
        l_event type cntl_simple_event.

* define the events which will be passed to the backend
  l_event-eventid = cl_gui_column_tree=&amp;gt;eventid_expand_no_children.
  append l_event to lt_events.
  l_event-eventid = cl_gui_column_tree=&amp;gt;eventid_checkbox_change.
  append l_event to lt_events.
  l_event-eventid = cl_gui_column_tree=&amp;gt;eventid_header_context_men_req.
  append l_event to lt_events.
  l_event-eventid = cl_gui_column_tree=&amp;gt;eventid_node_context_menu_req.
  append l_event to lt_events.
  l_event-eventid = cl_gui_column_tree=&amp;gt;eventid_item_context_menu_req.
  append l_event to lt_events.
  l_event-eventid = cl_gui_column_tree=&amp;gt;eventid_header_click.
  append L_EVENT to lt_events.
  l_event-eventid = cl_gui_column_tree=&amp;gt;eventid_item_keypress.
  append L_EVENT to lt_events.

  call method tree1-&amp;gt;set_registered_events
    exporting
      events = lt_events
    exceptions
      cntl_error                = 1
      cntl_system_error         = 2
      illegal_event_combination = 3.
  if sy-subrc &amp;lt;&amp;gt; 0.
    message x208(00) with 'ERROR'.                       "#EC NOTEXT
  endif.



* set Handler
  data: l_event_receiver type ref to lcl_tree_event_receiver.
  create object l_event_receiver.
  set handler l_event_receiver-&amp;gt;handle_node_ctmenu_request
                                                        for tree1.
  set handler l_event_receiver-&amp;gt;handle_node_ctmenu_selected
                                                        for tree1.
  set handler l_event_receiver-&amp;gt;handle_item_ctmenu_request
                                                        for tree1.
  set handler l_event_receiver-&amp;gt;handle_item_ctmenu_selected
                                                        for tree1.
endform.                               " register_events
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  change_toolbar
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
form change_toolbar.

* get toolbar control
  call method tree1-&amp;gt;get_toolbar_object
          importing
              er_toolbar = mr_toolbar.

  check not mr_toolbar is initial.

* add seperator to toolbar
  call method mr_toolbar-&amp;gt;add_button
          exporting
              fcode     = ''
              icon      = ''
              butn_type = cntb_btype_sep
              text      = ''
              quickinfo = 'This is a Seperator'.         "#EC NOTEXT

* add Standard Button to toolbar (for Delete Subtree)
  call method mr_toolbar-&amp;gt;add_button
          exporting
              fcode     = 'DELETE'
              icon      = '@18@'
              butn_type = cntb_btype_button
              text      = ''
              quickinfo = 'Delete subtree'.              "#EC NOTEXT

* add Dropdown Button to toolbar (for Insert Line)
  call method mr_toolbar-&amp;gt;add_button
          exporting
              fcode     = 'INSERT_LC'
              icon      = '@17@'
              butn_type = cntb_btype_dropdown
              text      = ''
              quickinfo = 'Insert Line'.           "#EC NOTEXT

* set event-handler for toolbar-control
  create object toolbar_event_receiver.
  set handler toolbar_event_receiver-&amp;gt;on_function_selected
                                                      for mr_toolbar.
  set handler toolbar_event_receiver-&amp;gt;on_toolbar_dropdown
                                                      for mr_toolbar.

endform.                               " change_toolbar
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  init_tree
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
FORM init_tree.

* create fieldcatalog for structure sflight
  perform build_fieldcatalog.

* create container for alv-tree
  data: l_tree_container_name(30) type c,
        l_custom_container type ref to cl_gui_custom_container.
  l_tree_container_name = 'TREE1'.

  if sy-batch is initial.
    create object l_custom_container
      exporting
            container_name = l_tree_container_name
      exceptions
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5.
    if sy-subrc &amp;lt;&amp;gt; 0.
      message x208(00) with 'ERROR'.                       "#EC NOTEXT
    endif.
  endif.

* create tree control
  create object tree1
    exporting
        parent              = l_custom_container
        node_selection_mode = cl_gui_column_tree=&amp;gt;node_sel_mode_single
        item_selection      = 'X'
        no_html_header      = ''
        no_toolbar          = ''
    exceptions
        cntl_error                   = 1
        cntl_system_error            = 2
        create_error                 = 3
        lifetime_error               = 4
        illegal_node_selection_mode  = 5
        failed                       = 6
        illegal_column_name          = 7.
  if sy-subrc &amp;lt;&amp;gt; 0.
    message x208(00) with 'ERROR'.                       "#EC NOTEXT
  endif.

* create Hierarchy-header
  data l_hierarchy_header type treev_hhdr.
  perform build_hierarchy_header changing l_hierarchy_header.

* create info-table for html-header
  data: lt_list_commentary type slis_t_listheader,
        l_logo             type sdydo_value.
  perform build_comment using
                 lt_list_commentary
                 l_logo.

* repid for saving variants
  data: ls_variant type disvariant.
  ls_variant-report = sy-repid.

* create emty tree-control
  call method tree1-&amp;gt;set_table_for_first_display
     exporting
               is_hierarchy_header  = l_hierarchy_header
               it_list_commentary   = lt_list_commentary
               i_logo               = l_logo
               i_background_id      = 'ALV_BACKGROUND'
               i_save               = 'A'
               is_variant            = ls_variant
     changing
               it_outtab            = gt_sflight "table must be emty !!
               it_fieldcatalog      = gt_fieldcatalog.

* create hierarchy
  perform create_hierarchy.

* add own functioncodes to the toolbar
  perform change_toolbar.

* register events
  perform register_events.

* adjust column_width
  call method tree1-&amp;gt;COLUMN_OPTIMIZE.

ENDFORM.                    " init_tree


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;venu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jul 2005 08:27:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-tree-using-function-modules/m-p/964975#M68330</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-22T08:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: ALV Tree using Function Modules</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-tree-using-function-modules/m-p/964976#M68331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Judith,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can e-mail me at: rameshbabuc@india.com&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ramesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jul 2005 09:18:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-tree-using-function-modules/m-p/964976#M68331</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-22T09:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: ALV Tree using Function Modules</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-tree-using-function-modules/m-p/964977#M68332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ramesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have mailed u the documents.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it will help u.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jul 2005 10:14:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-tree-using-function-modules/m-p/964977#M68332</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-22T10:14:31Z</dc:date>
    </item>
  </channel>
</rss>

