<?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: Handle stack navigation in control framework application development. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/handle-stack-navigation-in-control-framework-application-development/m-p/3973209#M949010</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Roberto,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure if this will help you, but I use SAPCOLUMN_TREE_CONTROL_DEMO to create a menu, but it easily could have been changed to display like SE80.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I nearly totaly rewrote there include module COLUMN_TREE_CONTROL_DEMOF01 for it and did as follows.   You could easily get the info to fill the tree from tables to do as you prefer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*-------------------------------------------------------------------
***INCLUDE column_tree_control_demoF01 .
*-------------------------------------------------------------------

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  CREATE_AND_INIT_TREE
*&amp;amp;---------------------------------------------------------------------*
FORM create_and_init_tree.
*  DATA: NODE_TABLE TYPE TREEV_NTAB,
*        ITEM_TABLE TYPE ITEM_TABLE_TYPE,
  DATA: event TYPE cntl_simple_event,
        events TYPE cntl_simple_events,
        hierarchy_header TYPE treev_hhdr.

* create a container for the tree control
  CREATE OBJECT g_custom_container
    EXPORTING
      " the container is linked to the custom control with the
      " name 'TREE_CONTAINER' on the dynpro
      container_name = 'TREE_CONTAINER'
    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 a000.
  ENDIF.


* setup the hierarchy header
  hierarchy_header-heading = 'System'.                      "#EC NOTEXT
  " heading
  hierarchy_header-width = 40.         " width: 30 characters

* create a tree control

* After construction, the control contains one column in the
* hierarchy area. The name of this column
* is defined via the constructor parameter HIERACHY_COLUMN_NAME.
  CREATE OBJECT g_tree
    EXPORTING
      parent              = g_custom_container
      node_selection_mode = cl_gui_column_tree=&amp;gt;node_sel_mode_single
      item_selection = 'X'
      hierarchy_column_name = 'Column1'
      hierarchy_header = hierarchy_header
    EXCEPTIONS
      cntl_system_error           = 1
      create_error                = 2
      failed                      = 3
      illegal_node_selection_mode = 4
      illegal_column_name         = 5
      lifetime_error              = 6.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE a000.
  ENDIF.

* define the events which will be passed to the backend
  " node double click
  event-eventid = cl_gui_column_tree=&amp;gt;eventid_node_double_click.
  event-appl_event = 'X'. " process PAI if event occurs
  APPEND event TO events.

  " item double click
  event-eventid = cl_gui_column_tree=&amp;gt;eventid_item_double_click.
  event-appl_event = 'X'.
  APPEND event TO events.

  " expand no children
  event-eventid = cl_gui_column_tree=&amp;gt;eventid_expand_no_children.
  event-appl_event = 'X'.
  APPEND event TO events.

  " link click
  event-eventid = cl_gui_column_tree=&amp;gt;eventid_link_click.
  event-appl_event = 'X'.
  APPEND event TO events.

  " button click
  event-eventid = cl_gui_column_tree=&amp;gt;eventid_button_click.
  event-appl_event = 'X'.
  APPEND event TO events.

  " checkbox change
  event-eventid = cl_gui_column_tree=&amp;gt;eventid_checkbox_change.
  event-appl_event = 'X'.
  APPEND event TO events.

  " header click
  event-eventid = cl_gui_column_tree=&amp;gt;eventid_header_click.
  event-appl_event = 'X'.
  APPEND event TO events.

  CALL METHOD g_tree-&amp;gt;set_registered_events
    EXPORTING
      events = events
    EXCEPTIONS
      cntl_error                = 1
      cntl_system_error         = 2
      illegal_event_combination = 3.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE a000.
  ENDIF.

* assign event handlers in the application class to each desired event
  SET HANDLER g_application-&amp;gt;handle_node_double_click FOR g_tree.
  SET HANDLER g_application-&amp;gt;handle_item_double_click FOR g_tree.
  SET HANDLER g_application-&amp;gt;handle_expand_no_children FOR g_tree.
*  SET HANDLER G_APPLICATION-&amp;gt;HANDLE_LINK_CLICK FOR G_TREE.
*  SET HANDLER G_APPLICATION-&amp;gt;HANDLE_BUTTON_CLICK FOR G_TREE.
*  SET HANDLER G_APPLICATION-&amp;gt;HANDLE_CHECKBOX_CHANGE FOR G_TREE.
  SET HANDLER g_application-&amp;gt;handle_header_click FOR g_tree.

* insert two additional columns

  perform add_a_column using 'Column2'      "col_name.
                             '50'           "col_width
                             'Description'. "col_text
  perform add_a_column using 'Column3'      "col_name.
                             '21'           "col_width.
                             'Tran Code'.   "col_text


* add some nodes to the tree control
* NOTE: the tree control does not store data at the backend. If an
* application wants to access tree data later, it must store the
* tree data itself.

  PERFORM build_node_and_item_table USING node_table item_table.

  CALL METHOD g_tree-&amp;gt;add_nodes_and_items
    EXPORTING
      node_table = node_table
      item_table = item_table
      item_table_structure_name = 'MTREEITM'
    EXCEPTIONS
      failed = 1
      cntl_system_error = 3
      error_in_tables = 4
      dp_error = 5
      table_structure_name_not_found = 6.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE a000.
  ENDIF.

  PERFORM expand_the_root USING 'Root'.
  PERFORM expand_the_root USING 'Root2'.
*  PERFORM expand_the_root USING 'Root3'.
*  PERFORM expand_the_root USING 'Root4'.
*  PERFORM expand_the_root USING 'Root5'.


ENDFORM.                    " CREATE_AND_INIT_TREE

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  build_node_and_item_table
*&amp;amp;---------------------------------------------------------------------*

FORM build_node_and_item_table
  USING
    node_table TYPE treev_ntab
    item_table TYPE item_table_type.
* Root 1
  PERFORM add_root USING node_table 'Root'.
  PERFORM add_item_info USING item_table
                              'Root'                        "node_key
                              'Column1'                     "col1_name
                              'Account'                     "col1_text
                              'Column2'                     "col2_name
                              ' '                           "col2_text
                              'Column3'                     "col3_name
                              ' '.                          "col3_text.

  PERFORM add_child USING node_table 'Root' 'Child1'.
  PERFORM add_item_info USING item_table
                              'Child1'                      "node_key
                              'Column1'                     "col1_name
                              'Add Lead'                    "col1_text
                              'Column2'                     "col2_name
                              'Add New Lead'                "col2_text
                              'Column3'                     "col3_name
                              'ZLM01'.                      "col3_text.

  PERFORM add_child USING node_table 'Root' 'Child2'.
  PERFORM add_item_info USING item_table
                              'Child2'                      "node_key
                              'Column1'                     "col1_name
                              'Modify Lead'                 "col1_text
                              'Column2'                     "col2_name
                              'Modify Existing Lead'        "col2_text
                              'Column3'                     "col3_name
                              'ZLM02'.                      "col3_text.

  PERFORM add_child USING node_table 'Root' 'Child3'.
  PERFORM add_item_info USING item_table
                              'Child3'                      "node_key
                              'Column1'                     "col1_name
                              'Display Lead'                "col1_text
                              'Column2'                     "col2_name
                              'Display Existing Lead'       "col2_text
                              'Column3'                     "col3_name
                              'ZLM03'.                      "col3_text.

  PERFORM add_child USING node_table 'Root' 'Child4'.
  PERFORM add_item_info USING item_table
                              'Child4'                      "node_key
                              'Column1'                     "col1_name
                              'Search Help'                 "col1_text
                              'Column2'                     "col2_name
                              'Search Help'                 "col2_text
                              'Column3'                     "col3_name
                              'ZLMR5'.                      "col3_text.

* Root 2
  PERFORM add_root USING node_table 'Root2'.
  PERFORM add_item_info USING item_table
                              'Root2'                       "node_key
                              'Column1'                     "col1_name
                              'Reports'                     "col1_text
                              'Column2'                     "col2_name
                              ' '                           "col2_text
                              'Column3'                     "col3_name
                              ' '.                          "col3_text.
  PERFORM add_child USING node_table 'Root2' 'Child21'.
  PERFORM add_item_info USING item_table
                              'Child21'                     "node_key
                              'Column1'                     "col1_name
                              'Lead Detail'                 "col1_text
                              'Column2'                     "col2_name
                              'Selection List'              "col2_text
                              'Column3'                     "col3_name
                              'ZLMR4'.                      "col3_text.

  PERFORM add_child USING node_table 'Root2' 'Child22'.
  PERFORM add_item_info USING item_table
                              'Child22'                     "node_key
                              'Column1'                     "col1_name
                              'Unassigned Leads'            "col1_text
                              'Column2'                     "col2_name
                              'Unassigned Leads'            "col2_text
                              'Column3'                     "col3_name
                              'ZLMR2'.                      "col3_text.

  PERFORM add_child USING node_table 'Root2' 'Child23'.
  PERFORM add_item_info USING item_table
                              'Child23'                     "node_key
                              'Column1'                     "col1_name
                              'Follow Up Required'          "col1_text
                              'Column2'                     "col2_name
                              'Follow Up Required'          "col2_text
                              'Column3'                     "col3_name
                              'ZLMR3'.                      "col3_text.

  PERFORM add_child USING node_table 'Root2' 'Child24'.
  PERFORM add_item_info USING item_table
                              'Child24'                     "node_key
                              'Column1'                     "col1_name
                              'Birthday Report'             "col1_text
                              'Column2'                     "col2_name
                              'Select Contacts by Birthdate' "col2_text
                              'Column3'                     "col3_name
                              'ZLMR6'.                      "col3_text.

  PERFORM add_child USING node_table 'Root2' 'Child25'.
  PERFORM add_item_info USING item_table
                              'Child25'                     "node_key
                              'Column1'                     "col1_name
                              'Mailing Labels'              "col1_text
                              'Column2'                     "col2_name
                              'Mailing Labels'              "col2_text
                              'Column3'                     "col3_name
                              'ZLMR8'.                      "col3_text.

  PERFORM add_child USING node_table 'Root2' 'Child26'.
  PERFORM add_item_info USING item_table
                              'Child26'                     "node_key
                              'Column1'                     "col1_name
                              'Pipeline'                    "col1_text
                              'Column2'                     "col2_name
                              'Pipeline'                    "col2_text
                              'Column3'                     "col3_name
                              'ZLMR9'.                      "col3_text.

** Root 3
*  PERFORM add_root USING node_table 'Root3'.
*  PERFORM add_item_info USING item_table
*                              'Root3'                       "node_key
*                              'Column1'                     "col1_name
*                              'Utilities'                   "col1_text
*                              'Column2'                     "col2_name
*                              ' '                           "col2_text
*                              'Column3'                     "col3_name
*                              ' '.                          "col3_text.
*
*  PERFORM add_child USING node_table 'Root3' 'Child31'.
*  PERFORM add_item_info USING item_table
*                              'Child31'                     "node_key
*                              'Column1'                     "col1_name
*                              'Maintain'                    "col1_text
*                              'Column2'                     "col2_name
*                              'Homes File'                  "col2_text
*                              'Column3'                     "col3_name
*                              'ZLMX3'.                      "col3_text.

ENDFORM.                    " build_node_and_item_table

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  add_root
*&amp;amp;---------------------------------------------------------------------*
FORM add_root   USING
    node_table TYPE treev_ntab
    root_name.
  node-node_key = root_name.
  " Key of the node
  CLEAR node-relatkey.      " Special case: A root node has no parent
  CLEAR node-relatship.     " node.

  node-hidden = ' '.        " The node is visible,
  node-disabled = ' '.      " selectable,
  node-isfolder = 'X'.      " a folder.
  CLEAR node-n_image.       " Folder-/ Leaf-Symbol in state "closed":
  " use default.
  CLEAR node-exp_image.     " Folder-/ Leaf-Symbol in state "open":
  " use default
  CLEAR node-expander.      " see below.
  APPEND node TO node_table.
ENDFORM.                    " add_root
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  add_child
*&amp;amp;---------------------------------------------------------------------*
FORM add_child USING
    node_table TYPE treev_ntab
    root_name
    child_name.

  node-node_key = child_name.
  " Key of the node
  " Node is inserted as child of the node with key 'Root'.
  node-relatkey = root_name.
  node-relatship = cl_gui_column_tree=&amp;gt;relat_last_child.

  node-hidden = ' '.
  node-disabled = ' '.
  node-isfolder = ' '.
  CLEAR node-n_image.
  CLEAR node-exp_image.
  node-expander = ' '. " The node is marked with a '+', although
  " it has no children. When the user clicks on the
  " + to open the node, the event expand_nc is
  " fired. The programmerr can
  " add the children of the
  " node within the event handler of the expand_nc
  " event  (see callback handle_expand_nc).
  APPEND node TO node_table.
ENDFORM.                    " add_child
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  expand_the_root
*&amp;amp;---------------------------------------------------------------------*
FORM expand_the_root USING    root_name.
* expand the node with key 'Root'
  CALL METHOD g_tree-&amp;gt;expand_node
    EXPORTING
      node_key = root_name
    EXCEPTIONS
      failed              = 1
      illegal_level_count = 2
      cntl_system_error   = 3
      node_not_found      = 4
      cannot_expand_leaf  = 5.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE a000.
  ENDIF.
ENDFORM.                    " expand_the_root
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  add_item_info
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      --&amp;gt;P_ITEM_TABLE  text
*      --&amp;gt;P_ROOT_NAME  text
*      --&amp;gt;P_COL1_NAME  text
*      --&amp;gt;P_COL1_TEXT  text
*      --&amp;gt;P_COL2_NAME  text
*      --&amp;gt;P_COL2_TEXT  text
*      --&amp;gt;P_COL3_NAME  text
*      --&amp;gt;P_COL3_TEXT  text
*----------------------------------------------------------------------*
FORM add_item_info USING item_table TYPE item_table_type
                         node_key
                         col1_name
                         col1_text
                         col2_name
                         col2_text
                         col3_name
                         col3_text.

  CLEAR item.
  item-node_key = node_key.
  item-item_name = col1_name.     " Item of Column 'Column1'
  item-class = cl_gui_column_tree=&amp;gt;item_class_text. " Text Item
  item-text = col1_text.
  APPEND item TO item_table.

  CLEAR item.
  item-node_key = node_key.
  item-item_name = col2_name.     " Item of Column 'Column2'
  item-class = cl_gui_column_tree=&amp;gt;item_class_text.
  item-text = col2_text.
  APPEND item TO item_table.

  CLEAR item.
  item-node_key = node_key.
  item-item_name = col3_name.     " Item of Column 'Column3'
  " Item is a link (click on link fires event LINK_CLICK)
  item-class = cl_gui_column_tree=&amp;gt;item_class_text.
  item-text = col3_text.             "
  APPEND item TO item_table.

ENDFORM.                    " add_item_info
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  add_a_column
*&amp;amp;---------------------------------------------------------------------*
form add_a_column using    col_name
                           col_width
                           col_text.
  CALL METHOD g_tree-&amp;gt;add_column
    EXPORTING
      name = col_name
      width = col_width
      header_text = col_text
    EXCEPTIONS
      column_exists                 = 1
      illegal_column_name           = 2
      too_many_columns              = 3
      illegal_alignment             = 4
      different_column_types        = 5
      cntl_system_error             = 6
      failed                        = 7
      predecessor_column_not_found  = 8.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE a000.
  ENDIF.
endform.                    " add_a_column
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 23 Jun 2008 18:36:30 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-06-23T18:36:30Z</dc:date>
    <item>
      <title>Handle stack navigation in control framework application development.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handle-stack-navigation-in-control-framework-application-development/m-p/3973208#M949009</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;  Let me know if anyone has implemented in any application using OO controls as ALV-GRID, TREE, HTML, TextEdit, etc., using a stack of navigation similar to transaction SE80.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If anyone could implement an stack navigation, please share its experience in this forum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Roberto Rodríguez on Jun 20, 2008 9:49 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Roberto Rodríguez on Jun 20, 2008 9:50 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2008 19:44:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handle-stack-navigation-in-control-framework-application-development/m-p/3973208#M949009</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-20T19:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: Handle stack navigation in control framework application development.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handle-stack-navigation-in-control-framework-application-development/m-p/3973209#M949010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Roberto,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure if this will help you, but I use SAPCOLUMN_TREE_CONTROL_DEMO to create a menu, but it easily could have been changed to display like SE80.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I nearly totaly rewrote there include module COLUMN_TREE_CONTROL_DEMOF01 for it and did as follows.   You could easily get the info to fill the tree from tables to do as you prefer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*-------------------------------------------------------------------
***INCLUDE column_tree_control_demoF01 .
*-------------------------------------------------------------------

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  CREATE_AND_INIT_TREE
*&amp;amp;---------------------------------------------------------------------*
FORM create_and_init_tree.
*  DATA: NODE_TABLE TYPE TREEV_NTAB,
*        ITEM_TABLE TYPE ITEM_TABLE_TYPE,
  DATA: event TYPE cntl_simple_event,
        events TYPE cntl_simple_events,
        hierarchy_header TYPE treev_hhdr.

* create a container for the tree control
  CREATE OBJECT g_custom_container
    EXPORTING
      " the container is linked to the custom control with the
      " name 'TREE_CONTAINER' on the dynpro
      container_name = 'TREE_CONTAINER'
    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 a000.
  ENDIF.


* setup the hierarchy header
  hierarchy_header-heading = 'System'.                      "#EC NOTEXT
  " heading
  hierarchy_header-width = 40.         " width: 30 characters

* create a tree control

* After construction, the control contains one column in the
* hierarchy area. The name of this column
* is defined via the constructor parameter HIERACHY_COLUMN_NAME.
  CREATE OBJECT g_tree
    EXPORTING
      parent              = g_custom_container
      node_selection_mode = cl_gui_column_tree=&amp;gt;node_sel_mode_single
      item_selection = 'X'
      hierarchy_column_name = 'Column1'
      hierarchy_header = hierarchy_header
    EXCEPTIONS
      cntl_system_error           = 1
      create_error                = 2
      failed                      = 3
      illegal_node_selection_mode = 4
      illegal_column_name         = 5
      lifetime_error              = 6.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE a000.
  ENDIF.

* define the events which will be passed to the backend
  " node double click
  event-eventid = cl_gui_column_tree=&amp;gt;eventid_node_double_click.
  event-appl_event = 'X'. " process PAI if event occurs
  APPEND event TO events.

  " item double click
  event-eventid = cl_gui_column_tree=&amp;gt;eventid_item_double_click.
  event-appl_event = 'X'.
  APPEND event TO events.

  " expand no children
  event-eventid = cl_gui_column_tree=&amp;gt;eventid_expand_no_children.
  event-appl_event = 'X'.
  APPEND event TO events.

  " link click
  event-eventid = cl_gui_column_tree=&amp;gt;eventid_link_click.
  event-appl_event = 'X'.
  APPEND event TO events.

  " button click
  event-eventid = cl_gui_column_tree=&amp;gt;eventid_button_click.
  event-appl_event = 'X'.
  APPEND event TO events.

  " checkbox change
  event-eventid = cl_gui_column_tree=&amp;gt;eventid_checkbox_change.
  event-appl_event = 'X'.
  APPEND event TO events.

  " header click
  event-eventid = cl_gui_column_tree=&amp;gt;eventid_header_click.
  event-appl_event = 'X'.
  APPEND event TO events.

  CALL METHOD g_tree-&amp;gt;set_registered_events
    EXPORTING
      events = events
    EXCEPTIONS
      cntl_error                = 1
      cntl_system_error         = 2
      illegal_event_combination = 3.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE a000.
  ENDIF.

* assign event handlers in the application class to each desired event
  SET HANDLER g_application-&amp;gt;handle_node_double_click FOR g_tree.
  SET HANDLER g_application-&amp;gt;handle_item_double_click FOR g_tree.
  SET HANDLER g_application-&amp;gt;handle_expand_no_children FOR g_tree.
*  SET HANDLER G_APPLICATION-&amp;gt;HANDLE_LINK_CLICK FOR G_TREE.
*  SET HANDLER G_APPLICATION-&amp;gt;HANDLE_BUTTON_CLICK FOR G_TREE.
*  SET HANDLER G_APPLICATION-&amp;gt;HANDLE_CHECKBOX_CHANGE FOR G_TREE.
  SET HANDLER g_application-&amp;gt;handle_header_click FOR g_tree.

* insert two additional columns

  perform add_a_column using 'Column2'      "col_name.
                             '50'           "col_width
                             'Description'. "col_text
  perform add_a_column using 'Column3'      "col_name.
                             '21'           "col_width.
                             'Tran Code'.   "col_text


* add some nodes to the tree control
* NOTE: the tree control does not store data at the backend. If an
* application wants to access tree data later, it must store the
* tree data itself.

  PERFORM build_node_and_item_table USING node_table item_table.

  CALL METHOD g_tree-&amp;gt;add_nodes_and_items
    EXPORTING
      node_table = node_table
      item_table = item_table
      item_table_structure_name = 'MTREEITM'
    EXCEPTIONS
      failed = 1
      cntl_system_error = 3
      error_in_tables = 4
      dp_error = 5
      table_structure_name_not_found = 6.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE a000.
  ENDIF.

  PERFORM expand_the_root USING 'Root'.
  PERFORM expand_the_root USING 'Root2'.
*  PERFORM expand_the_root USING 'Root3'.
*  PERFORM expand_the_root USING 'Root4'.
*  PERFORM expand_the_root USING 'Root5'.


ENDFORM.                    " CREATE_AND_INIT_TREE

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  build_node_and_item_table
*&amp;amp;---------------------------------------------------------------------*

FORM build_node_and_item_table
  USING
    node_table TYPE treev_ntab
    item_table TYPE item_table_type.
* Root 1
  PERFORM add_root USING node_table 'Root'.
  PERFORM add_item_info USING item_table
                              'Root'                        "node_key
                              'Column1'                     "col1_name
                              'Account'                     "col1_text
                              'Column2'                     "col2_name
                              ' '                           "col2_text
                              'Column3'                     "col3_name
                              ' '.                          "col3_text.

  PERFORM add_child USING node_table 'Root' 'Child1'.
  PERFORM add_item_info USING item_table
                              'Child1'                      "node_key
                              'Column1'                     "col1_name
                              'Add Lead'                    "col1_text
                              'Column2'                     "col2_name
                              'Add New Lead'                "col2_text
                              'Column3'                     "col3_name
                              'ZLM01'.                      "col3_text.

  PERFORM add_child USING node_table 'Root' 'Child2'.
  PERFORM add_item_info USING item_table
                              'Child2'                      "node_key
                              'Column1'                     "col1_name
                              'Modify Lead'                 "col1_text
                              'Column2'                     "col2_name
                              'Modify Existing Lead'        "col2_text
                              'Column3'                     "col3_name
                              'ZLM02'.                      "col3_text.

  PERFORM add_child USING node_table 'Root' 'Child3'.
  PERFORM add_item_info USING item_table
                              'Child3'                      "node_key
                              'Column1'                     "col1_name
                              'Display Lead'                "col1_text
                              'Column2'                     "col2_name
                              'Display Existing Lead'       "col2_text
                              'Column3'                     "col3_name
                              'ZLM03'.                      "col3_text.

  PERFORM add_child USING node_table 'Root' 'Child4'.
  PERFORM add_item_info USING item_table
                              'Child4'                      "node_key
                              'Column1'                     "col1_name
                              'Search Help'                 "col1_text
                              'Column2'                     "col2_name
                              'Search Help'                 "col2_text
                              'Column3'                     "col3_name
                              'ZLMR5'.                      "col3_text.

* Root 2
  PERFORM add_root USING node_table 'Root2'.
  PERFORM add_item_info USING item_table
                              'Root2'                       "node_key
                              'Column1'                     "col1_name
                              'Reports'                     "col1_text
                              'Column2'                     "col2_name
                              ' '                           "col2_text
                              'Column3'                     "col3_name
                              ' '.                          "col3_text.
  PERFORM add_child USING node_table 'Root2' 'Child21'.
  PERFORM add_item_info USING item_table
                              'Child21'                     "node_key
                              'Column1'                     "col1_name
                              'Lead Detail'                 "col1_text
                              'Column2'                     "col2_name
                              'Selection List'              "col2_text
                              'Column3'                     "col3_name
                              'ZLMR4'.                      "col3_text.

  PERFORM add_child USING node_table 'Root2' 'Child22'.
  PERFORM add_item_info USING item_table
                              'Child22'                     "node_key
                              'Column1'                     "col1_name
                              'Unassigned Leads'            "col1_text
                              'Column2'                     "col2_name
                              'Unassigned Leads'            "col2_text
                              'Column3'                     "col3_name
                              'ZLMR2'.                      "col3_text.

  PERFORM add_child USING node_table 'Root2' 'Child23'.
  PERFORM add_item_info USING item_table
                              'Child23'                     "node_key
                              'Column1'                     "col1_name
                              'Follow Up Required'          "col1_text
                              'Column2'                     "col2_name
                              'Follow Up Required'          "col2_text
                              'Column3'                     "col3_name
                              'ZLMR3'.                      "col3_text.

  PERFORM add_child USING node_table 'Root2' 'Child24'.
  PERFORM add_item_info USING item_table
                              'Child24'                     "node_key
                              'Column1'                     "col1_name
                              'Birthday Report'             "col1_text
                              'Column2'                     "col2_name
                              'Select Contacts by Birthdate' "col2_text
                              'Column3'                     "col3_name
                              'ZLMR6'.                      "col3_text.

  PERFORM add_child USING node_table 'Root2' 'Child25'.
  PERFORM add_item_info USING item_table
                              'Child25'                     "node_key
                              'Column1'                     "col1_name
                              'Mailing Labels'              "col1_text
                              'Column2'                     "col2_name
                              'Mailing Labels'              "col2_text
                              'Column3'                     "col3_name
                              'ZLMR8'.                      "col3_text.

  PERFORM add_child USING node_table 'Root2' 'Child26'.
  PERFORM add_item_info USING item_table
                              'Child26'                     "node_key
                              'Column1'                     "col1_name
                              'Pipeline'                    "col1_text
                              'Column2'                     "col2_name
                              'Pipeline'                    "col2_text
                              'Column3'                     "col3_name
                              'ZLMR9'.                      "col3_text.

** Root 3
*  PERFORM add_root USING node_table 'Root3'.
*  PERFORM add_item_info USING item_table
*                              'Root3'                       "node_key
*                              'Column1'                     "col1_name
*                              'Utilities'                   "col1_text
*                              'Column2'                     "col2_name
*                              ' '                           "col2_text
*                              'Column3'                     "col3_name
*                              ' '.                          "col3_text.
*
*  PERFORM add_child USING node_table 'Root3' 'Child31'.
*  PERFORM add_item_info USING item_table
*                              'Child31'                     "node_key
*                              'Column1'                     "col1_name
*                              'Maintain'                    "col1_text
*                              'Column2'                     "col2_name
*                              'Homes File'                  "col2_text
*                              'Column3'                     "col3_name
*                              'ZLMX3'.                      "col3_text.

ENDFORM.                    " build_node_and_item_table

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  add_root
*&amp;amp;---------------------------------------------------------------------*
FORM add_root   USING
    node_table TYPE treev_ntab
    root_name.
  node-node_key = root_name.
  " Key of the node
  CLEAR node-relatkey.      " Special case: A root node has no parent
  CLEAR node-relatship.     " node.

  node-hidden = ' '.        " The node is visible,
  node-disabled = ' '.      " selectable,
  node-isfolder = 'X'.      " a folder.
  CLEAR node-n_image.       " Folder-/ Leaf-Symbol in state "closed":
  " use default.
  CLEAR node-exp_image.     " Folder-/ Leaf-Symbol in state "open":
  " use default
  CLEAR node-expander.      " see below.
  APPEND node TO node_table.
ENDFORM.                    " add_root
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  add_child
*&amp;amp;---------------------------------------------------------------------*
FORM add_child USING
    node_table TYPE treev_ntab
    root_name
    child_name.

  node-node_key = child_name.
  " Key of the node
  " Node is inserted as child of the node with key 'Root'.
  node-relatkey = root_name.
  node-relatship = cl_gui_column_tree=&amp;gt;relat_last_child.

  node-hidden = ' '.
  node-disabled = ' '.
  node-isfolder = ' '.
  CLEAR node-n_image.
  CLEAR node-exp_image.
  node-expander = ' '. " The node is marked with a '+', although
  " it has no children. When the user clicks on the
  " + to open the node, the event expand_nc is
  " fired. The programmerr can
  " add the children of the
  " node within the event handler of the expand_nc
  " event  (see callback handle_expand_nc).
  APPEND node TO node_table.
ENDFORM.                    " add_child
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  expand_the_root
*&amp;amp;---------------------------------------------------------------------*
FORM expand_the_root USING    root_name.
* expand the node with key 'Root'
  CALL METHOD g_tree-&amp;gt;expand_node
    EXPORTING
      node_key = root_name
    EXCEPTIONS
      failed              = 1
      illegal_level_count = 2
      cntl_system_error   = 3
      node_not_found      = 4
      cannot_expand_leaf  = 5.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE a000.
  ENDIF.
ENDFORM.                    " expand_the_root
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  add_item_info
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      --&amp;gt;P_ITEM_TABLE  text
*      --&amp;gt;P_ROOT_NAME  text
*      --&amp;gt;P_COL1_NAME  text
*      --&amp;gt;P_COL1_TEXT  text
*      --&amp;gt;P_COL2_NAME  text
*      --&amp;gt;P_COL2_TEXT  text
*      --&amp;gt;P_COL3_NAME  text
*      --&amp;gt;P_COL3_TEXT  text
*----------------------------------------------------------------------*
FORM add_item_info USING item_table TYPE item_table_type
                         node_key
                         col1_name
                         col1_text
                         col2_name
                         col2_text
                         col3_name
                         col3_text.

  CLEAR item.
  item-node_key = node_key.
  item-item_name = col1_name.     " Item of Column 'Column1'
  item-class = cl_gui_column_tree=&amp;gt;item_class_text. " Text Item
  item-text = col1_text.
  APPEND item TO item_table.

  CLEAR item.
  item-node_key = node_key.
  item-item_name = col2_name.     " Item of Column 'Column2'
  item-class = cl_gui_column_tree=&amp;gt;item_class_text.
  item-text = col2_text.
  APPEND item TO item_table.

  CLEAR item.
  item-node_key = node_key.
  item-item_name = col3_name.     " Item of Column 'Column3'
  " Item is a link (click on link fires event LINK_CLICK)
  item-class = cl_gui_column_tree=&amp;gt;item_class_text.
  item-text = col3_text.             "
  APPEND item TO item_table.

ENDFORM.                    " add_item_info
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  add_a_column
*&amp;amp;---------------------------------------------------------------------*
form add_a_column using    col_name
                           col_width
                           col_text.
  CALL METHOD g_tree-&amp;gt;add_column
    EXPORTING
      name = col_name
      width = col_width
      header_text = col_text
    EXCEPTIONS
      column_exists                 = 1
      illegal_column_name           = 2
      too_many_columns              = 3
      illegal_alignment             = 4
      different_column_types        = 5
      cntl_system_error             = 6
      failed                        = 7
      predecessor_column_not_found  = 8.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE a000.
  ENDIF.
endform.                    " add_a_column
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jun 2008 18:36:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handle-stack-navigation-in-control-framework-application-development/m-p/3973209#M949010</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-23T18:36:30Z</dc:date>
    </item>
    <item>
      <title>Re: Handle stack navigation in control framework application development.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handle-stack-navigation-in-control-framework-application-development/m-p/3973210#M949011</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not, but thanks!...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need implement an stack navigation for return to the previous state of an application to use Controls as ALV-GRID, TREE, and others controls when the user makes a F3 (BACK). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A clear example of a stack of navigation is implemented in the transaction SE80... But it's very complex to copy in an application for a client.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I looking for someone if ever did something similar, but in a less complex way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jun 2008 17:41:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handle-stack-navigation-in-control-framework-application-development/m-p/3973210#M949011</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-26T17:41:47Z</dc:date>
    </item>
  </channel>
</rss>

