Expand Tree Control

I now have a Tree Control populated from an ArrayCollection
and using the defaultDataDescriptor.
At this point in the program the data exists only in the
myTree.dataProvider and the root node is at myTree.dataProvider[0]
or myTree.dataProvider.source[0] and I can see from the variables
window that the correct data is located here.
What do I have to put for 'item' in
myTree.expandChildrenOf(??item??, true). Everything I can think of
returns:
"Cannot access a property or method of a null object
reference."
Does anyone have any idea how to make this work.
Doug

The error occurs in the Flex file Tree.as at line 1383.
I can now see that the null object is not item -
dataProvider[0], this contains the correct data. The problem is
that iterator is null and therefore iterator.view is a null
reference.
Is there any way to solve this problem?
My ArrayCollection is built in pretty much the same way as
shown in:
Flex 2 Developer's Guide > Building User Interfaces for
Flex Applications > Using Data Providers and Collections
> Using hierarchical data providers > Data descriptors and
hierarchical data provider structure > Creating a custom data
descriptor
But I have used the defaultDataDescriptor and my arrays are
not built from literals.
Doug

Similar Messages

  • Af:tree control expand is not working

    Hi all ,
    af:tree control expansion is not working if I click on the + sign. But it is working thru context menu "Expand All Below" option.
    Can any one help me.
    Thanks
    Kristi
    Message was edited by:
    Kristi(user576892)

    Hi,
    not with this little information
    - which technology
    - which browser version (if applicable)
    - how to reproduce
    - does it reproduce on other machines / browsers
    Frank

  • Move collapsed group in tree control expands it

    In LV 2010, I have a tree control.  If I collapse a group and move it to a new location in the tree, it is expanded when I drop it in its new location.  Is this a configurable option?  A bug?

    Attached is a VI that shows what I'm talking about.  You collapse the group, drag and drop it to a new place in the tree, and it is automatically expanded.
    I believe I have the settings you specified.
    Attachments:
    tree control example.vi ‏6 KB

  • How can I save the all the values of a tree control ?

    I have a problem, in run time, I adds new items on a tree control, but i don´t know how I can save the values of the child text of each item in a file.
    Thanks.

    I'm no expert on the tree control, but I made a small example to save all items to a textfile, including item tag, item string, and indent level. One drawback of this method is that it fully expands the tree regardless how the user left it. To go the other direction, you'd have to write a routine to go through the text file and programmatically build the tree.
    To master the tree control, I think you have to resort to creating a control reference for it and using the Invoke Node to do some operations. For another approach to traversing and operating on a tree, check out the "Traversing Tree Controls and Setting Custom Symbols" (search the NI Developer Zone site).
    Best of luck,
    John
    Attachments:
    Save Tree Structure to Textfile.vi ‏32 KB

  • Tree-control for data input?

    Hi,
    I need to program an input screen for values that have hierarchical dependencies (e.g. sums). I feel, the most adequate user-interface would be a tree control, because of the data dependencies and also because the users asked for a possibility to collapse/expand parts of the data during input.
    I had a look at CL_GUI_COLUMN_TREE, but I'm not sure, if it can be used for data input. Has anyone done something like this before or can anybody direct me to some additional sample coding? (the sample coding in the reuse library didn't do it...)
    Thanks for your help, greetings, Kathrin!

    Hello Kathrin,
    Since you say that the user's input is hierarchical in nature, it is nice to have a tree-control for input. But, the choice of using a custom-control-version of the tree is a cause for some concern. I cannot recollect any of the SAP screens where the input can be given through such a tree framework (please do let me know if you have come across one). The problem with such a tree would be in the areas of even-handling. Filling the tree with appropriate data at the right times would be another challenge.
    However, there's one alternative that I would like to direct your attention to. You must have observed another kind of tree, when you select an application component from the APPLICATION HIERARCHY, which is just like a list. Also, the <i>Transport Organizer (SE09)</i>, <i>Menu Painter (SE41)</i> etc., have this kind of a tree. You can use this if you (or rather your users) are very particular on having a tree display. For more information, you can see the Function Group <b>SEUT</b>, which has the required function modules to accomplish the same. The Function Group is well documented, and you might have to work a little on the function modules themselves.
    Please do let me know if this is a suitable option to meet your requirement. All the best,
    Regards,
    Anand Mandalika.

  • Report with Dynamic tree control

    I have a report with a TREE CONTROL.
    <p>
    A Tree is referenced to: CL_GUI_ALV_TREE_SIMPLE and is located on the left side of the screen.
    <p>
    See diagram below.  The Tree has MULTI-LEVEL nodes and the user can click on any of the nodes which will
    trigger a report (rellevant for that node) to appear in the REPORT container.
    <p>
    Everythign is working fine. 
    <p>
    I now have a requirement to add a TREE ON/OFF functionality.  I have added this by 'Freeing' TREE
    container and by initializing when the user Turns ON the TREE.  It is working fine, HOWEVER, when
    it initilizes the TREE it is COLLAPSED and obviously does not point to the NODE that was clicked.
    <p>
    My goal is to retain the value of the NODE that was pressed and EXPAND the tree to that node and
    highlight it...  Please note that I have MULTI-LEVEL nodes and the user can double click on NODES
    and ITEMS. 
    <p>
    I tried using GET_SELECTED_NODES, but it only works if the user selects the LOWEST level node/item.
    <p>
    Any advise will be appreciated.
    <p>
    Also, as an alternative, I was thinking of resizing TREE container to WIDTH of 1 when the user PRESSES
    TREE OFF and resizing back to width 200 when the user presses TREE ON.  I could not find any methods
    that would work with CL_GUI_DOCKING_CONTAINER. 
    Please help! Thank you in advance.
    <br>
    <br>
    <img src="http://img237.imageshack.us/img237/6684/bdccz3.jpg" border="0"/></a>
    <p>
    <p>

    I have a report with a TREE CONTROL.
    <p>
    A Tree is referenced to: CL_GUI_ALV_TREE_SIMPLE and is located on the left side of the screen.
    <p>
    See diagram below.  The Tree has MULTI-LEVEL nodes and the user can click on any of the nodes which will
    trigger a report (rellevant for that node) to appear in the REPORT container.
    <p>
    Everythign is working fine. 
    <p>
    I now have a requirement to add a TREE ON/OFF functionality.  I have added this by 'Freeing' TREE
    container and by initializing when the user Turns ON the TREE.  It is working fine, HOWEVER, when
    it initilizes the TREE it is COLLAPSED and obviously does not point to the NODE that was clicked.
    <p>
    My goal is to retain the value of the NODE that was pressed and EXPAND the tree to that node and
    highlight it...  Please note that I have MULTI-LEVEL nodes and the user can double click on NODES
    and ITEMS. 
    <p>
    I tried using GET_SELECTED_NODES, but it only works if the user selects the LOWEST level node/item.
    <p>
    Any advise will be appreciated.
    <p>
    Also, as an alternative, I was thinking of resizing TREE container to WIDTH of 1 when the user PRESSES
    TREE OFF and resizing back to width 200 when the user presses TREE ON.  I could not find any methods
    that would work with CL_GUI_DOCKING_CONTAINER. 
    Please help! Thank you in advance.
    <br>
    <br>
    <img src="http://img237.imageshack.us/img237/6684/bdccz3.jpg" border="0"/></a>
    <p>
    <p>

  • How to use Tree control like a Tree in SAP HANA Live Browser?

    Hello SDN!
    I need a Tree control such as following:
    As I understand, there is no such standard control in SAPUI5 control library. Is it possible to use this control? If yes, how I can embed it in my app?
    Regards,
    Lev

    Hi Sandip!
    Thanks for your tip. I've applied this example to my app. Tree is working now, but this is a little problem - on each expand/collapse and click on treeItem the onAfterRendering() method called. It means that the complete rerender of tree executed which looks not good. How I can avoid this?
    Lev

  • Add multiple elements to a tree control at once

    I am using a Tree Control to display customer and certificate information. However, adding 500 customer names or certificate numbers to the tree control one at a time takes for ever (well, 30000 ms). Is there any way to add multiple elements to a tree all at once, or is the only solution to use a listbox with 'forward' and 'back' buttons ?
    thanks,
    michael

    Hi Michael
    I don’t believe there is a way to supply a list of child items to a parent item, they have to be added incrementally. One way that you could speed this process up is to design your code such that only when you expand an item does it add the child items.
    If you want an even higher update rate have a look at using the ActiveX TreeView control, you will find an example called Family Tree.vi in the LV examples.
    I'll do up some code that makes using both of the controls more efficient if enough people want it.
    Kurt Friday
    www.sciware.com.au

  • Flex tree control expanditem dynamically..?

    Hi All.,
               I have using tree control using to display. when i pass the data with folder id dynamically  to expanding particular child node of tree.
        How to extarct tree with dynamic...?
    Below sample coding.....
    <mx:tree id="folderTree" />
    folderid=2618;
         callLater(expandTree, [folderid]);
         private function expandTree(folderid: Object) : void
                    folderTree.expandChildrenOf(folderTree.getChildAt(0), true);
                    folderTree.selectedItem = folderid;
    but not extracting tree.
    anyone help this problem
    With Regards.,
    Lings

    Thanks buddy for the answer.
    Unfortunately the answer came after quite long time of posting the message. Anyway I was able to open a tree on demand using HttpService and due to my new requirement I changed it to RemoteObject.
    I my latest change I am able to populate tree nodes on demand and also the same solution if getting update from server via JMS using Consumer object.
    I kind a like this solution because it took me good amount of effort to find the right solution.
    If any one is intersted the he/she can reply to the post and I can provide code here or may at some location so that it can be easily downloaded.
    The solution is Flex-Grails combination.
    Thanks everybody.

  • Drag and Drop between two ALV Tree Controls

    Hello all,
    I have designed a spilt control of two ALV Trees using CL_GUI_ALV_TREE.
    I have a top node as the Sales order Number and the child node as the items belonging to that sales order number.
    Now i need to drag and drop the lines from one sales order to another.
    Also these drag drop can take place between the nodes of the two different trees.
    Can someone provide with a detail example as i need to complete the same urgently.
    Regards,
    Arun

    Once check the Below code For tree to tree drag an drop
    *       CLASS lcl_main DEFINITION
    CLASS lcl_main  DEFINITION.
      PUBLIC SECTION.
    * Types
        TYPES:
                BEGIN OF  t_ekpo,
                  ebeln TYPE ebeln,
                  ebelp TYPE ebelp,
                END OF    t_ekpo.
        TYPES:
                BEGIN OF  t_vbap,
                  vbeln TYPE vbeln,
                  posnr TYPE vbelp,
                END OF    t_vbap.
    * Internal Tables
        DATA:
              i_ekpo        TYPE STANDARD TABLE OF t_ekpo,
              i_ekpo_op     TYPE STANDARD TABLE OF t_ekpo,
              i_vbap        TYPE STANDARD TABLE OF t_vbap,
              i_vbap_op     TYPE STANDARD TABLE OF t_vbap,
              i_fcat_ekpo   TYPE                   lvc_t_fcat,
              i_fcat_vbap   TYPE                   lvc_t_fcat.
    * Work Areas
        DATA:
              wa_ekpo   TYPE t_ekpo,
              wa_ekpo1  TYPE t_ekpo,
              wa_vbap   TYPE t_vbap,
              wa_vbap1  TYPE t_vbap.
    * Data Declarations
        DATA:
              g_ebeln TYPE ebeln,
              g_vbeln TYPE vbeln_va.
        DATA: g_variant          TYPE disvariant,
              g_hierarchy_header TYPE treev_hhdr,
              g_handle_drag      TYPE i,
              g_handle_drop      TYPE i.
    * Class data
        DATA:
              splitter    TYPE REF TO cl_gui_splitter_container,
              container   TYPE REF TO cl_gui_custom_container,
              container_1 TYPE REF TO cl_gui_container,
              container_2 TYPE REF TO cl_gui_container,
              tree1       TYPE REF TO cl_gui_alv_tree,
              tree2       TYPE REF TO cl_gui_alv_tree,
              g_drag      TYPE REF TO cl_dragdrop,
              g_drop      TYPE REF TO cl_dragdrop.
    * Constants
        CONSTANTS:
                  c_30(2) TYPE c VALUE '30'.
    * Methods
        METHODS:
                  get_data,                          " Data Fatch
                  build_display,                     " Display Container
                  display_ekpo,                      " Ekpo table display
                  display_vbap,                      " Vbap table display
                  add_node_ekpo                      " Add node to Ekpo
                    IMPORTING table  TYPE t_ekpo
                              key    TYPE lvc_nkey
                              text   TYPE lvc_value
                              flag   TYPE c
                    CHANGING  i_key  TYPE lvc_nkey,
                  add_node_vbap                      " Add node to vbap
                    IMPORTING table  TYPE t_vbap
                              key    TYPE lvc_nkey
                              text   TYPE lvc_value
                              flag   TYPE c
                    CHANGING  i_key  TYPE lvc_nkey,
                  dnd_behaviour,                     " Drag and drop behavour
                  register_events_ekpo,              " Register Events Ekpo
                  register_events_vbap,              " Register events vbap
                  handle_drag_multiple               " Drag Multiple Values
                     FOR EVENT on_drag_multiple
                     OF cl_gui_alv_tree
                     IMPORTING sender node_key_table fieldname drag_drop_object,
                  handle_drop                        " Drop the values
                     FOR EVENT on_drop
                     OF cl_gui_alv_tree
                     IMPORTING sender node_key drag_drop_object,
                  add_node_drop                      " Add node to Drop Node
                    IMPORTING table  TYPE t_ekpo
                              key    TYPE lvc_nkey
                              text   TYPE lvc_value
                    CHANGING  i_key  TYPE lvc_nkey.
    ENDCLASS.                                        " Lcl_main DEFINITION
    *       CLASS LCL_DRAGOBJ DEFINITION
    * Drag And drop Structure
    CLASS lcl_dragobj DEFINITION INHERITING FROM lcl_main FINAL.
      PUBLIC SECTION.
    * Types
        TYPES: BEGIN OF t_node_info,
                  l_ekpo      TYPE t_ekpo,
                  l_node_text TYPE lvc_value,
                  l_node_key  TYPE lvc_nkey,
               END OF t_node_info.
    * Data
        DATA: i_node_info  TYPE TABLE OF t_node_info,
              wa_node_info TYPE t_node_info.
    ENDCLASS.                                        " LCL_DRAGOBJ DEFINITION
    * Object Declarations
    DATA  obj_main  TYPE REF TO lcl_main.
    * Initialization                                                     *
    INITIALIZATION.
      CREATE OBJECT obj_main.
    * Selection Screen                                                   *
      SELECTION-SCREEN  BEGIN OF BLOCK  block1  WITH FRAME.
      SELECT-OPTIONS:
                      s_ebeln FOR obj_main->g_ebeln,
                      s_vbeln FOR obj_main->g_vbeln MATCHCODE OBJECT  cs_vbeln.
      SELECTION-SCREEN  END OF   BLOCK  block1.
    * Start of Selection                                                 *
    START-OF-SELECTION.
    * Call Screen
      CALL SCREEN 100.
    *       CLASS lcl_main IMPLEMENTATION
    * Local class Implementation
    CLASS lcl_main  IMPLEMENTATION.
    * Get Data                                                           *
      METHOD  get_data.
    * Data from Ekpo
        SELECT  ebeln
                ebelp
          FROM  ekpo
          UP TO 100 ROWS
          INTO  TABLE i_ekpo
         WHERE  ebeln IN  s_ebeln.
    * Data from Vbap
        SELECT  vbeln
                posnr
          FROM  vbap
          UP TO 100 ROWS
          INTO  TABLE i_vbap
         WHERE  vbeln IN  s_vbeln.
      ENDMETHOD.                                     " Get_data
    * Build Display                                                      *
      METHOD  build_display.
    * Create Container
        CREATE OBJECT container
          EXPORTING
            container_name = 'CUST_CONT'.
    * Split the container
        CREATE OBJECT splitter
          EXPORTING
            parent  = container
            rows    = 1
            columns = 2.
        CALL METHOD splitter->get_container
          EXPORTING
            row       = 1
            column    = 1
          RECEIVING
            container = container_1.
        CALL METHOD splitter->get_container
          EXPORTING
            row       = 1
            column    = 2
          RECEIVING
            container = container_2.
    * create tree control
        CREATE OBJECT tree1
          EXPORTING
            parent                      = container_1
            node_selection_mode         = cl_gui_column_tree=>node_sel_mode_multiple
            item_selection              = 'X'
            no_html_header              = 'X'
            no_toolbar                  = 'X'
          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 NE 0.
          CLEAR sy-subrc.
        ENDIF.                                       " IF sy-subrc NE 0.
        CREATE OBJECT tree2
          EXPORTING
            parent                      = container_2
            node_selection_mode         = cl_gui_column_tree=>node_sel_mode_multiple
            item_selection              = 'X'
            no_html_header              = 'X'
            no_toolbar                  = 'X'
          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 NE 0.
          CLEAR sy-subrc.
        ENDIF.                                       " IF sy-subrc NE 0.
        g_variant-report      = sy-repid.
        g_variant-handle      = space.
        g_variant-log_group   = space.
        g_variant-username    = space.
        g_variant-text        = space.
        g_variant-dependvars  = space.
    * Call method for get data
        CALL METHOD get_data.
    * Drap And Drop behaviour method
        CALL METHOD dnd_behaviour.
    * Display the Ekpo table
        CALL METHOD obj_main->display_ekpo.
    * Diaplay the vbap table
        CALL METHOD obj_main->display_vbap.
        CALL METHOD tree1->frontend_update.
        CALL METHOD tree2->frontend_update.
      ENDMETHOD.                                     " Build_display
    * Display EKPO                                                       *
      METHOD  display_ekpo.
    * Data
        DATA:
              l_key1 TYPE lvc_nkey,
              l_key2 TYPE lvc_nkey,
              l_key3 TYPE lvc_nkey,
              l_node_text TYPE lvc_value.
    * ALV control service modules
        CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
          EXPORTING
            i_buffer_active        = 'X'
            i_structure_name       = 'EKPO'
            i_client_never_display = 'X'
            i_bypassing_buffer     = space
          CHANGING
            ct_fieldcat            = i_fcat_ekpo
          EXCEPTIONS
            inconsistent_interface = 1
            program_error          = 2
            OTHERS                 = 3.
        IF sy-subrc EQ 0.
          DELETE i_fcat_ekpo FROM 4.
        ENDIF.                                       " IF sy-subrc EQ 0.
        g_hierarchy_header-heading = 'Purchase Order Details'(001).
        g_hierarchy_header-tooltip = 'Purchase Order'(002).
        g_hierarchy_header-width = c_30.
        g_hierarchy_header-width_pix = ' '.
    * Diaply
        CALL METHOD tree1->set_table_for_first_display
          EXPORTING
            is_hierarchy_header = g_hierarchy_header
            is_variant          = g_variant
          CHANGING
            it_outtab           = obj_main->i_ekpo_op
            it_fieldcatalog     = i_fcat_ekpo.
        LOOP AT i_ekpo  INTO  wa_ekpo1.
          MOVE wa_ekpo1 TO wa_ekpo.
          l_key1  = ''.
          AT NEW  ebeln.
            MOVE wa_ekpo-ebeln  TO l_node_text.
    * Call method for Add Node to Ekpo
            CALL METHOD add_node_ekpo
              EXPORTING
                table = wa_ekpo
                key   = l_key1
                text  = l_node_text
                flag  = space
              CHANGING
                i_key = l_key2.
          ENDAT.
          CLEAR l_node_text.
          MOVE wa_ekpo-ebelp  TO l_node_text.
    * Call method for Add Node to Ekpo
          CALL METHOD add_node_ekpo
            EXPORTING
              table = wa_ekpo
              key   = l_key2
              text  = l_node_text
              flag  = 'X'
            CHANGING
              i_key = l_key3.
        ENDLOOP.                                     " LOOP AT i_ekpo  INTO  wa_ekpo1.
    * Call method For Register events
        CALL METHOD register_events_ekpo.
      ENDMETHOD.                                     " Display_ekpo
    * Display VBAP                                                       *
      METHOD  display_vbap.
    *  Data
        DATA:
           l_key1 TYPE lvc_nkey,
           l_key2 TYPE lvc_nkey,
           l_key3 TYPE lvc_nkey,
           l_node_text TYPE lvc_value.
        REFRESH i_fcat_vbap.
    * ALV control service modules
        CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
          EXPORTING
            i_buffer_active        = 'X'
            i_structure_name       = 'VBAP'
            i_client_never_display = 'X'
            i_bypassing_buffer     = space
          CHANGING
            ct_fieldcat            = i_fcat_vbap
          EXCEPTIONS
            inconsistent_interface = 1
            program_error          = 2
            OTHERS                 = 3.
        IF sy-subrc EQ 0.
          DELETE i_fcat_vbap FROM 4.
        ENDIF.                                       " IF sy-subrc EQ 0.
        g_hierarchy_header-heading = 'Sales Order Details'(003).
        g_hierarchy_header-tooltip = 'Sales Order'(004).
        g_hierarchy_header-width = c_30.
        g_hierarchy_header-width_pix = ' '.
    * Display
        CALL METHOD tree2->set_table_for_first_display
          EXPORTING
            is_hierarchy_header = g_hierarchy_header
            is_variant          = g_variant
          CHANGING
            it_outtab           = obj_main->i_vbap_op
            it_fieldcatalog     = i_fcat_vbap.
        LOOP AT i_vbap  INTO  wa_vbap1.
          MOVE wa_vbap1 TO wa_vbap.
          l_key1  = ''.
          AT NEW  vbeln.
            MOVE wa_vbap-vbeln  TO l_node_text.
    * Call method for Add Node to vbap
            CALL METHOD add_node_vbap
              EXPORTING
                table = wa_vbap
                key   = l_key1
                text  = l_node_text
                flag  = 'X'
              CHANGING
                i_key = l_key2.
          ENDAT.
          CLEAR l_node_text.
          MOVE wa_vbap-posnr  TO l_node_text.
    * Call method for Add Node to vbap
          CALL METHOD add_node_vbap
            EXPORTING
              table = wa_vbap
              key   = l_key2
              text  = l_node_text
              flag  = space
            CHANGING
              i_key = l_key3.
        ENDLOOP.                                     " LOOP AT i_vbap  INTO  wa_vbap1.
    * Call method For Register events
        CALL METHOD register_events_vbap.
      ENDMETHOD.                                     " Display_vbap
    * Add Node to Ekko                                                   *
      METHOD  add_node_ekpo.
    * Data
        DATA: l_layout_node TYPE lvc_s_layn.
        IF flag = 'X'.
          l_layout_node-dragdropid = g_handle_drag.
        ENDIF.                                       " IF flag = 'X'.
    *   Add node to tree1
        CALL METHOD tree1->add_node
          EXPORTING
            i_relat_node_key     = key
            i_relationship       = cl_gui_column_tree=>relat_last_child
            is_outtab_line       = table
            i_node_text          = text
            is_node_layout       = l_layout_node
          IMPORTING
            e_new_node_key       = i_key
          EXCEPTIONS
            relat_node_not_found = 1
            node_not_found       = 2
            OTHERS               = 3.
        IF sy-subrc NE 0.
          CLEAR sy-subrc.
        ENDIF.                                       " IF sy-subrc NE 0.
      ENDMETHOD.                                     " Add_node_ekpo
    * Add Node to Vbap                                                   *
      METHOD  add_node_vbap.
    * Data
        DATA: l_layout_node TYPE lvc_s_layn.
        IF flag = 'X'.
          l_layout_node-dragdropid = g_handle_drop.
        ENDIF.                                       " IF flag = 'X'.
    * Add node for tree2
        CALL METHOD tree2->add_node
          EXPORTING
            i_relat_node_key     = key
            i_relationship       = cl_gui_column_tree=>relat_last_child
            is_outtab_line       = table
            i_node_text          = text
            is_node_layout       = l_layout_node
          IMPORTING
            e_new_node_key       = i_key
          EXCEPTIONS
            relat_node_not_found = 1
            node_not_found       = 2
            OTHERS               = 3.
        IF sy-subrc NE 0.
          CLEAR sy-subrc.
        ENDIF.                                       " IF sy-subrc NE 0.
      ENDMETHOD.                                     " Add_node_vbap
    * Dnd behaviour                                                      *
      METHOD  dnd_behaviour.
    * Data
        DATA: effect TYPE i,
              l_flavor TYPE c VALUE 'f'.
    * For drag
        CREATE OBJECT g_drag.
        effect = cl_dragdrop=>copy.
        CALL METHOD g_drag->add
          EXPORTING
            flavor         = l_flavor
            dragsrc        = 'X'
            droptarget     = ' '
            effect         = effect
            effect_in_ctrl = effect.
        CALL METHOD g_drag->get_handle
          IMPORTING
            handle = g_handle_drag.
    * For Drop
        CREATE OBJECT g_drop.
        effect = cl_dragdrop=>copy.
        CALL METHOD g_drop->add
          EXPORTING
            flavor         = l_flavor
            dragsrc        = ' '
            droptarget     = 'X'
            effect         = effect
            effect_in_ctrl = effect.
        CALL METHOD g_drop->get_handle
          IMPORTING
            handle = g_handle_drop.
      ENDMETHOD.                                     " Dnd_behaviour
    * register events                                                    *
      METHOD  register_events_ekpo.
    * Data
        DATA: lt_events TYPE cntl_simple_events.
    * Tree events registers ALV Tree
        CALL METHOD tree1->get_registered_events
          IMPORTING
            events = lt_events.
    * Register events on frontend
        CALL METHOD tree1->set_registered_events
          EXPORTING
            events                    = lt_events
          EXCEPTIONS
            cntl_error                = 1
            cntl_system_error         = 2
            illegal_event_combination = 3.
        IF sy-subrc NE 0.
          CLEAR sy-subrc.
        ENDIF.                                       " IF sy-subrc NE 0.
    * Event Handling
        SET HANDLER obj_main->handle_drag_multiple FOR tree1.
      ENDMETHOD.                                     " Register_events_ekpo
    * register events                                                    *
      METHOD  register_events_vbap.
    * Data
        DATA: lt_events TYPE cntl_simple_events.
    * Tree events registers ALV Tree
        CALL METHOD tree2->get_registered_events
          IMPORTING
            events = lt_events.
    * Register events on frontend
        CALL METHOD tree2->set_registered_events
          EXPORTING
            events                    = lt_events
          EXCEPTIONS
            cntl_error                = 1
            cntl_system_error         = 2
            illegal_event_combination = 3.
        IF sy-subrc NE 0.
          CLEAR sy-subrc.
        ENDIF.                                       " IF sy-subrc NE 0.
    * Event
        SET HANDLER obj_main->handle_drop FOR tree2.
      ENDMETHOD.                                     " Register_events_vbap
    * Handle drag multiple Values                                        *
      METHOD handle_drag_multiple.
    * Data
        DATA: dataobj       TYPE REF TO lcl_dragobj,
              l_node_key    TYPE lvc_nkey,
              l_ekpo        TYPE t_ekpo,
              l_node_text   TYPE lvc_value,
              l_node_layout TYPE lvc_s_layn.
    * Create and fill dataobject for event ON_DROP.
        CREATE OBJECT dataobj.
    * Loop the Node key Table
        LOOP AT node_key_table INTO l_node_key.
          CALL METHOD sender->get_outtab_line
            EXPORTING
              i_node_key     = l_node_key
            IMPORTING
              e_outtab_line  = l_ekpo
              e_node_text    = l_node_text
              es_node_layout = l_node_layout.
          IF l_node_layout-isfolder NE 'X'.
            dataobj->wa_node_info-l_node_key  = l_node_key.
            dataobj->wa_node_info-l_ekpo      = l_ekpo.
            dataobj->wa_node_info-l_node_text = l_node_text.
            APPEND dataobj->wa_node_info TO dataobj->i_node_info.
          ENDIF.                                     " IF l_node_layout-isfolder NE 'X'.
        ENDLOOP.                                     " LOOP AT node_key_table INTO l_node_key
        drag_drop_object->object = dataobj.
      ENDMETHOD.                                     " Handle_drag_multiple
    * Handle drop multiple Values                                        *
      METHOD handle_drop.
        DATA: dataobj TYPE REF TO lcl_dragobj,
              l_new_key TYPE lvc_nkey,
              l_node_text TYPE lvc_value.
        CATCH SYSTEM-EXCEPTIONS move_cast_error = 1.
    * ON_DROP
          dataobj ?= drag_drop_object->object.
          LOOP AT dataobj->i_node_info INTO dataobj->wa_node_info.
            MOVE dataobj->wa_node_info-l_node_text  TO l_node_text.
    * Call method for Add Node to vbap
            CALL METHOD add_node_drop
              EXPORTING
                table = dataobj->wa_node_info-l_ekpo
                key   = node_key
                text  = l_node_text
              CHANGING
                i_key = l_new_key.
          ENDLOOP.                                   " LOOP AT dataobj->i_node_info INTO dataobj->wa_node_inf
    * Expand the node
          CALL METHOD sender->expand_node
            EXPORTING
              i_node_key = node_key
          CALL METHOD sender->frontend_update.
        ENDCATCH.
        IF sy-subrc NE 0.
          CALL METHOD drag_drop_object->abort.
        ENDIF.                                       " IF sy-subrc NE 0
      ENDMETHOD.                                     " Handle_drop
    * Add Node to drop                                                   *
      METHOD  add_node_drop.
    * Add node to drop tree
        CALL METHOD tree2->add_node
          EXPORTING
            i_relat_node_key     = key
            i_relationship       = cl_gui_column_tree=>relat_last_child
            is_outtab_line       = table
            i_node_text          = text
    *       is_node_layout       = l_layout_node
          IMPORTING
            e_new_node_key       = i_key
          EXCEPTIONS
            relat_node_not_found = 1
            node_not_found       = 2
            OTHERS               = 3.
        IF sy-subrc NE 0.
          CLEAR sy-subrc.
        ENDIF.                                       " IF sy-subrc NE 0
      ENDMETHOD.                                     " Add_node_drop
    ENDCLASS.                                        " lcl_main IMPLEMENTATION
    *&      Module  STATUS_0100  OUTPUT
    *  Screen 100 Pbo
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'BACK'.
    *  SET TITLEBAR 'xxx'.
      CALL METHOD obj_main->build_display.
    ENDMODULE.                                       " Status_0100 OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *  Screen 100 Pai
    MODULE user_command_0100 INPUT.
      IF sy-ucomm EQ 'BACK'.
        LEAVE TO SCREEN 0.
      ENDIF.                                         " IF sy-ucomm EQ 'BACK'
    ENDMODULE.                                       " USER_COMMAND_0100  INPUT
    *& Report  ZBPS_TREE_DRAG_DROP
    REPORT  zbps_tree_drag_drop.
    *       CLASS lcl_main DEFINITION
    CLASS lcl_main  DEFINITION.
      PUBLIC SECTION.
    * Types
        TYPES:
                BEGIN OF  t_ekpo,
                  ebeln TYPE ebeln,
                  ebelp TYPE ebelp,
                END OF    t_ekpo.
        TYPES:
                BEGIN OF  t_vbap,
                  vbeln TYPE vbeln,
                  posnr TYPE vbelp,
                END OF    t_vbap.
    * Internal Tables
        DATA:
              i_ekpo        TYPE STANDARD TABLE OF t_ekpo,
              i_ekpo_op     TYPE STANDARD TABLE OF t_ekpo,
              i_vbap        TYPE STANDARD TABLE OF t_vbap,
              i_vbap_op     TYPE STANDARD TABLE OF t_vbap,
              i_fcat_ekpo   TYPE                   lvc_t_fcat,
              i_fcat_vbap   TYPE                   lvc_t_fcat.
    * Work Areas
        DATA:
              wa_ekpo   TYPE t_ekpo,
              wa_ekpo1  TYPE t_ekpo,
              wa_vbap   TYPE t_vbap,
              wa_vbap1  TYPE t_vbap.
    * Data Declarations
        DATA:
              g_ebeln TYPE ebeln,
              g_vbeln TYPE vbeln_va.
        DATA: g_variant          TYPE disvariant,
              g_hierarchy_header TYPE treev_hhdr,
              g_handle_drag      TYPE i,
              g_handle_drop      TYPE i.
    * Class data
        DATA:
              splitter    TYPE REF TO cl_gui_splitter_container,
              container   TYPE REF TO cl_gui_custom_container,
              container_1 TYPE REF TO cl_gui_container,
              container_2 TYPE REF TO cl_gui_container,
              tree1       TYPE REF TO cl_gui_alv_tree,
              tree2       TYPE REF TO cl_gui_alv_tree,
              g_drag      TYPE REF TO cl_dragdrop,
              g_drop      TYPE REF TO cl_dragdrop.
    * Constants
        CONSTANTS:
                  c_30(2) TYPE c VALUE '30'.
    * Methods
        METHODS:
                  get_data,                          " Data Fatch
                  build_display,                     " Display Container
                  display_ekpo,                      " Ekpo table display
                  display_vbap,                      " Vbap table display
                  add_node_ekpo                      " Add node to Ekpo
                    IMPORTING table  TYPE t_ekpo
                              key    TYPE lvc_nkey
                              text   TYPE lvc_value
                              flag   TYPE c
                    CHANGING  i_key  TYPE lvc_nkey,
                  add_node_vbap                      " Add node to vbap
                    IMPORTING table  TYPE t_vbap
                              key    TYPE lvc_nkey
                              text   TYPE lvc_value
                              flag   TYPE c
                    CHANGING  i_key  TYPE lvc_nkey,
                  dnd_behaviour,                     " Drag and drop behavour
                  register_events_ekpo,              " Register Events Ekpo
                  register_events_vbap,              " Register events vbap
                  handle_drag_multiple               " Drag Multiple Values
                     FOR EVENT on_drag_multiple
                     OF cl_gui_alv_tree
                     IMPORTING sender node_key_table fieldname drag_drop_object,
                  handle_drop                        " Drop the values
                     FOR EVENT on_drop
                     OF cl_gui_alv_tree
                     IMPORTING sender node_key drag_drop_object,
                  add_node_drop                      " Add node to Drop Node
                    IMPORTING table  TYPE t_ekpo
                              key    TYPE lvc_nkey
                              text   TYPE lvc_value
                    CHANGING  i_key  TYPE lvc_nkey.
    ENDCLASS.                                        " Lcl_main DEFINITION
    *       CLASS LCL_DRAGOBJ DEFINITION
    * Drag And drop Structure
    CLASS lcl_dragobj DEFINITION INHERITING FROM lcl_main FINAL.
      PUBLIC SECTION.
    * Types
        TYPES: BEGIN OF t_node_info,
                  l_ekpo      TYPE t_ekpo,
                  l_node_text TYPE lvc_value,
                  l_node_key  TYPE lvc_nkey,
               END OF t_node_info.
    * Data
        DATA: i_node_info  TYPE TABLE OF t_node_info,
              wa_node_info TYPE t_node_info.
    ENDCLASS.                                        " LCL_DRAGOBJ DEFINITION
    * Object Declarations
    DATA  obj_main  TYPE REF TO lcl_main.
    * Initialization                                                     *
    INITIALIZATION.
      CREATE OBJECT obj_main.
    * Selection Screen                                                   *
      SELECTION-SCREEN  BEGIN OF BLOCK  block1  WITH FRAME.
      SELECT-OPTIONS:
                      s_ebeln FOR obj_main->g_ebeln,
                      s_vbeln FOR obj_main->g_vbeln MATCHCODE OBJECT  cs_vbeln.
      SELECTION-SCREEN  END OF   BLOCK  block1.
    * Start of Selection                                                 *
    START-OF-SELECTION.
    * Call Screen
      CALL SCREEN 100.
    *       CLASS lcl_main IMPLEMENTATION
    * Local class Implementation
    CLASS lcl_main  IMPLEMENTATION.
    * Get Data                                                           *
      METHOD  get_data.
    * Data from Ekpo
        SELECT  ebeln
                ebelp
          FROM  ekpo
          UP TO 100 ROWS
          INTO  TABLE i_ekpo
         WHERE  ebeln IN  s_ebeln.
    * Data from Vbap
        SELECT  vbeln
                posnr
          FROM  vbap
          UP TO 100 ROWS
          INTO  TABLE i_vbap
         WHERE  vbeln IN  s_vbeln.
      ENDMETHOD.                                     " Get_data
    * Build Display                                                      *
      METHOD  build_display.
    * Create Container
        CREATE OBJECT container
          EXPORTING
            container_name = 'CUST_CONT'.
    * Split the container
        CREATE OBJECT splitter
          EXPORTING
            parent  = container
            rows    = 1
            columns = 2.
        CALL METHOD splitter->get_container
          EXPORTING
            row       = 1
            column    = 1
          RECEIVING
            container = container_1.
        CALL METHOD splitter->get_container
          EXPORTING
            row       = 1
            column    = 2
          RECEIVING
            container = container_2.
    * create tree control
        CREATE OBJECT tree1
          EXPORTING
            parent                      = container_1
            node_selection_mode         = cl_gui_column_tree=>node_sel_mode_multiple
            item_selection              = 'X'
            no_html_header              = 'X'
            no_toolbar                  = 'X'
          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 NE 0.
          CLEAR sy-subrc.
        ENDIF.                                       " IF sy-subrc NE 0.
        CREATE OBJECT tree2
          EXPORTING
            parent                      = container_2
            node_selection_mode         = cl_gui_column_tree=>node_sel_mode_multiple
            item_selection              = 'X'
            no_html_header              = 'X'
            no_toolbar                  = 'X'
          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 NE 0.
          CLEAR sy-subrc.
        ENDIF.                                       " IF sy-subrc NE 0.
        g_variant-report      = sy-repid.
        g_variant-handle      = space.
        g_variant-log_group   = space.
        g_variant-username    = space.
        g_variant-text        = space.
        g_variant-dependvars  = space.
    * Call method for get data
        CALL METHOD get_data.
    * Drap And Drop behaviour method
        CALL METHOD dnd_behaviour.
    * Display the Ekpo table
        CALL METHOD obj_main->display_ekpo.
    * Diaplay the vbap table
        CALL METHOD obj_main->display_vbap.
        CALL METHOD tree1->frontend_update.
        CALL METHOD tree2->frontend_update.
      ENDMETHOD.                                     " Build_display
    * Display EKPO                                                       *
      METHOD  display_ekpo.
    * Data
        DATA:
              l_key1 TYPE lvc_nkey,
              l_key2 TYPE lvc_nkey,
              l_key3 TYPE lvc_nkey,
              l_node_text TYPE lvc_value.
    * ALV control service modules
        CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
          EXPORTING
            i_buffer_active        = 'X'
            i_structure_name       = 'EKPO'
            i_client_never_display = 'X'
            i_bypassing_buffer     = space
          CHANGING
            ct_fieldcat            = i_fcat_ekpo
          EXCEPTIONS
            inconsistent_interface = 1
            program_error          = 2
            OTHERS                 = 3.
        IF sy-subrc EQ 0.
          DELETE i_fcat_ekpo FROM 4.
        ENDIF.                                       " IF sy-subrc EQ 0.
        g_hierarchy_header-heading = 'Purchase Order Details'(001).
        g_hierarchy_header-tooltip = 'Purchase Order'(002).
        g_hierarchy_header-width = c_30.
        g_hierarchy_header-width_pix = ' '.
    * Diaply
        CALL METHOD tree1->set_table_for_first_display
          EXPORTING
            is_hierarchy_header = g_hierarchy_header
            is_variant          = g_variant
          CHANGING
            it_outtab           = obj_main->i_ekpo_op
            it_fieldcatalog     = i_fcat_ekpo.
        LOOP AT i_ekpo  INTO  wa_ekpo1.
          MOVE wa_ekpo1 TO wa_ekpo.
          l_key1  = ''.
          AT NEW  ebeln.
            MOVE wa_ekpo-ebeln  TO l_node_text.
    * Call method for Add Node to Ekpo
            CALL METHOD add_node_ekpo
              EXPORTING
                table = wa_ekpo
                key   = l_key1
                text  = l_node_text
                flag  = space
              CHANGING
                i_key = l_key2.
          ENDAT.
          CLEAR l_node_text.
          MOVE wa_ekpo-ebelp  TO l_node_text.
    * Call method for Add Node to Ekpo
          CALL METHOD add_node_ekpo
            EXPORTING
              table = wa_ekpo
              key   = l_key2
              text  = l_node_text
              flag  = 'X'
            CHANGING
              i_key = l_key3.
        ENDLOOP.                                     " LOOP AT i_ekpo  INTO  wa_ekpo1.
    * Call method For Register events
        CALL METHOD register_events_ekpo.
      ENDMETHOD.                                     " Display_ekpo
    * Display VBAP                                                       *
      METHOD  display_vbap.
    *  Data
        DATA:
           l_key1 TYPE lvc_nkey,
           l_key2 TYPE lvc_nkey,
           l_key3 TYPE lvc_nkey,
           l_node_text TYPE lvc_value.
        REFRESH i_fcat_vbap.
    * ALV control service modules
        CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
          EXPORTING
            i_buffer_active        = 'X'
            i_structure_name       = 'VBAP'
            i_client_never_display = 'X'
            i_bypassing_buffer     = space
          CHANGING
            ct_fieldcat            = i_fcat_vbap
          EXCEPTIONS
            inconsistent_interface = 1
            program_error          = 2
            OTHERS                 = 3.
        IF sy-subrc EQ 0.
          DELETE i_fcat_vbap FROM 4.
        ENDIF.                                       " IF sy-subrc EQ 0.
        g_hierarchy_header-heading = 'Sales Order Details'(003).
        g_hierarchy_header-tooltip = 'Sales Order'(004).
        g_hierarchy_header-width = c_30.
        g_hierarchy_header-width_pix = ' '.
    * Display
        CALL METHOD tree2->set_table_for_first_display
          EXPORTING
            is_hierarchy_header = g_hierarchy_header
            is_variant          = g_variant
          CHANGING
            it_outtab           = obj_main->i_vbap_op
            it_fieldcatalog     = i_fcat_vbap.
        LOOP AT i_vbap  INTO  wa_vbap1.
          MOVE wa_vbap1 TO wa_vbap.
          l_key1  = ''.
          AT NEW  vbeln.
            MOVE wa_vbap-vbeln  TO l_node_text.
    * Call method for Add Node to vbap
            CALL METHOD add_node_vbap
              EXPORTING
                table = wa_vbap
                key   = l_key1
                text  = l_node_text
                flag  = 'X'
              CHANGING
                i_key = l_key2.
          ENDAT.
          CLEAR l_node_text.
          MOVE wa_vbap-posnr  TO l_node_text.
    * Call method for Add Node to vbap
          CALL METHOD add_node_vbap
            EXPORTING
              table = wa_vbap
              key   = l_key2
              text  = l_node_text
              flag  = space
            CHANGING
              i_key = l_key3.
        ENDLOOP.                                     " LOOP AT i_vbap  INTO  wa_vbap1.
    * Call method For Register events
        CALL METHOD register_events_vbap.
      ENDMETHOD.                                     " Display_vbap
    * Add Node to Ekko                                                   *
      METHOD  add_node_ekpo.
    * Data
        DATA: l_layout_node TYPE lvc_s_layn.
        IF flag = 'X'.
          l_layout_node-dragdropid = g_handle_drag.
        ENDIF.                                       " IF flag = 'X'.
    *   Add node to tree1
        CALL METHOD tree1->add_node
          EXPORTING
            i_relat_node_key     = key
            i_relationship       = cl_gui_column_tree=>relat_last_child
            is_outtab_line       = table
            i_node_text          = text
            is_node_layout       = l_layout_node
          IMPORTING
            e_new_node_key       = i_key
          EXCEPTIONS
            relat_node_not_found = 1
            node_not_found       = 2
            OTHERS               = 3.
        IF sy-subrc NE 0.
          CLEAR sy-subrc.
        ENDIF.                                       " IF sy-subrc NE 0.
      ENDMETHOD.                                     " Add_node_ekpo
    * Add Node to Vbap                                                   *
      METHOD  add_node_vbap.
    * Data
        DATA: l_layout_node TYPE lvc_s_layn.
        IF flag = 'X'.
          l_layout_node-dragdropid = g_handle_drop.
        ENDIF.                                       " IF flag = 'X'.
    * Add node for tree2
        CALL METHOD t

  • Control Framework tree control event not trigerring

    The event handle_node_double_click is not trigerring on the tree controls . I want to display the contents of the nodes on the text editor on trigerring of this event
    *& Report  ZCONTROLS_TREE_TEDIT_SPITTER
    REPORT  zcontrols_tree_tedit_spitter.
    DATA : editor TYPE REF TO cl_gui_textedit,
           tree   TYPE REF TO cl_gui_simple_tree.
    DATA : container TYPE REF TO cl_gui_custom_container,
           splitter  TYPE REF TO cl_gui_easy_splitter_container,
           right     TYPE REF TO cl_gui_container,
           left      TYPE REF TO cl_gui_container.
    DATA : node_itab LIKE node_str OCCURS 0.
          CLASS EVENT_HANDLER DEFINITION
    CLASS event_handler DEFINITION.
      PUBLIC SECTION.
        METHODS : handle_node_double_click
                  FOR EVENT NODE_DOUBLE_CLICK OF cl_gui_simple_tree
                  IMPORTING node_key.
    ENDCLASS.                    "EVENT_HANDLER DEFINITION
          CLASS EVENT_HANDLER IMPLEMENTATION
    CLASS event_handler IMPLEMENTATION.
      METHOD handle_node_double_click.
      perform node_double_click using node_key.
      ENDMETHOD.                    "HANDLE_NODE_DOUBLE_CLICK
    ENDCLASS.                    "EVENT_HANDLER IMPLEMENTATION
    data : handler1 type ref to event_handler.
    START-OF-SELECTION.
      CALL SCREEN 9001.
    *&      Module  start  OUTPUT
          text
    MODULE start OUTPUT.
      SET PF-STATUS 'ZSTAT1'.
      IF container IS INITIAL.
        CREATE OBJECT container
          EXPORTING
             container_name              = 'CONTAINER_NAME'
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5
            OTHERS                      = 6
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        CREATE OBJECT splitter
          EXPORTING
            parent            = container
            orientation       = 1
            name              = 'Mohit'
          EXCEPTIONS
            cntl_error        = 1
            cntl_system_error = 2
            OTHERS            = 3
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        left  = splitter->top_left_container.
        right = splitter->bottom_right_container.
        CREATE OBJECT editor
          EXPORTING
            parent                 = right
            name                   = 'MohitEditor'
          EXCEPTIONS
            error_cntl_create      = 1
            error_cntl_init        = 2
            error_cntl_link        = 3
            error_dp_create        = 4
            gui_type_not_supported = 5
            OTHERS                 = 6
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        CREATE OBJECT tree
          EXPORTING
            parent                      = left
            node_selection_mode         = tree->node_sel_mode_single
            name                        = 'MohitTree'
          EXCEPTIONS
            lifetime_error              = 1
            cntl_system_error           = 2
            create_error                = 3
            failed                      = 4
            illegal_node_selection_mode = 5
            OTHERS                      = 6
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        PERFORM fill_tree.
        CALL METHOD tree->add_nodes
          EXPORTING
            table_structure_name           = 'NODE_STR'
            node_table                     = node_itab
          EXCEPTIONS
            error_in_node_table            = 1
            failed                         = 2
            dp_error                       = 3
            table_structure_name_not_found = 4
            OTHERS                         = 5.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      create object handler1.
      set handler handler1->handle_node_double_click for tree.
      ENDIF.
    ENDMODULE.                 " start  OUTPUT
    *&      Module  USER_COMMAND_9001  INPUT
          text
    MODULE user_command_9001 INPUT.
      CALL METHOD cl_gui_cfw=>dispatch.
    ENDMODULE.                 " USER_COMMAND_9001  INPUT
    *&      Form  fill_tree
          text
    -->  p1        text
    <--  p2        text
    FORM fill_tree .
      DATA : node LIKE node_str.
      CLEAR node.
      node-node_key = 'head_mohit'.
      node-isfolder = 'X'.
      node-text = 'Mohit'.
      APPEND node TO node_itab.
      CLEAR node.
      node-node_key = 'Child1'.
      node-relatkey = 'head_mohit'.
      node-relatship = cl_gui_simple_tree=>relat_last_child.
      node-text = 'Mohit is the best '.
      APPEND node TO node_itab.
      CLEAR node.
      node-node_key = 'Child2'.
      node-relatkey = 'head_mohit'.
      node-relatship = cl_gui_simple_tree=>relat_last_child.
      node-text = 'Mohit is the bestest '.
      APPEND node TO node_itab.
      CLEAR node.
      node-node_key = 'head_JAIN'.
      node-isfolder = 'X'.
      node-text = 'jAIN'.
      APPEND node TO node_itab.
      CLEAR node.
      node-node_key = 'Child3'.
      node-relatkey = 'head_JAIN'.
      node-relatship = cl_gui_simple_tree=>relat_next_sibling.
      node-text = 'cnh INDIA '.
      APPEND node TO node_itab.
      CLEAR node.
      node-node_key = 'Child4'.
      node-relatkey = 'head_JAIN'.
      node-relatship = cl_gui_simple_tree=>relat_last_child.
      node-text = 'SAP  '.
      APPEND node TO node_itab.
    ENDFORM.                    " fill_tree
    *&      Form  node_double_click
          text
         -->P_NODE_KEY  text
    form node_double_click  using  p_node_key type TV_NODEKEY.
    DATA : node LIKE node_str.
    DATA textline(256).
    DATA text_table LIKE STANDARD TABLE OF textline.
    READ TABLE node_itab WITH KEY node_key = p_node_key
                             INTO node.
    endform.                    " node_double_click
    *&      Module  exit  INPUT
          text
    module exit input.
    CASE sy-ucomm.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
    ENDCASE.
    endmodule.                 " exit  INPUT

    Hello Mohit
    Here is a sample routine (taken from BCALV_TREE_02) which you have to add and adapt for your report. It does two things:
    1. Register events that should be handled (required but not sufficient for event handling)
    2. Set event handler for registered events
    The first step is different from ALV grid controls because here all events are already registered with the control (not the control framework).
    Set the event handler (statement SET HANDLER) registers the event handling with the control framework.
    FORM register_events.
    *§4. Event registration: tell ALV Tree which events shall be passed
    *    from frontend to backend.
      DATA: lt_events TYPE cntl_simple_events,
            l_event TYPE cntl_simple_event,
            l_event_receiver TYPE REF TO lcl_tree_event_receiver.
    *§4a. Frontend registration(i):  get already registered tree events.
    * The following four tree events registers ALV Tree in the constructor
    * method itself.
    *    - cl_gui_column_tree=>eventid_expand_no_children
    * (needed to load data to frontend when a user expands a node)
    *    - cl_gui_column_tree=>eventid_header_context_men_req
    * (needed for header context menu)
    *    - cl_gui_column_tree=>eventid_header_click
    * (allows selection of columns (only when item selection activated))
    *   - cl_gui_column_tree=>eventid_item_keypress
    * (needed for F1-Help (only when item selection activated))
    * Nevertheless you have to provide their IDs again if you register
    * additional events with SET_REGISTERED_EVENTS (see below).
    * To do so, call first method  GET_REGISTERED_EVENTS (this way,
    * all already registered events remain registered, even your own):
    call method g_alv_tree->get_registered_events
          importing events = lt_events.
    * (If you do not these events will be deregistered!!!).
    * You do not have to register events of the toolbar again.
    *§4b. Frontend registration(ii): add additional event ids
      l_event-eventid = cl_gui_column_tree=>eventid_node_double_click.
      APPEND l_event TO lt_events.
    *§4c. Frontend registration(iii):provide new event table to alv tree
      CALL METHOD g_alv_tree->set_registered_events
        EXPORTING
          events = lt_events
        EXCEPTIONS
          cntl_error                = 1
          cntl_system_error         = 2
          illegal_event_combination = 3.
      IF sy-subrc <> 0.
        MESSAGE x208(00) WITH 'ERROR'.     "#EC NOTEXT
      ENDIF.
    *§4d. Register events on backend (ABAP Objects event handling)
      CREATE OBJECT l_event_receiver.
      SET HANDLER l_event_receiver->handle_node_double_click FOR g_alv_tree.
    ENDFORM.                               " register_events
    Regards
      Uwe

  • Scrollbar in Tree Control = wonky

    The TREE control scrollbar seems to have some ill-thought-out behavior.
    1... Run the example TREE ENHANCEMENTS (Examples - Building UIs - Displaying Data - General )
    2... Choose a folder on your machine with a few (3-5) folders in it but lots of files and folders contained within those folders.
    3... Select the PATTERN as appropriate.
    4... Run the VI.  Your files should show up in the list, then the list collapses.
    5... Expand the folders, so that there are more items in the list than it can display at one time.
    6... The scrollbar appears (that's sensible).
    7... Scroll down so that items disappear off the top.
    8... Right click and choose CLOSE ALL ITEMS
    --- I would expect the control to automatically move back up to the top, so you could see something, but it doesn't.
    9... Play with the scrollbar thumb.  Not exactly sensible.
    Here is a JING to watch, showing this behavior.
    The code that populates this tree is copied from the example (and modified to remove file extensions).
    Once the tree is populated, the code is doing nothing (except waiting for a QUIT button).
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

    Just run the example I mentioned.  It's not code that does it - it's the behavior of the tree control itself.
    But you need to structure the folders so that you have a few (< # lines in tree) root-level folders, and many (> #lines in tree) sub-folders/files, whatever.
    When you collapse the tree, I would expect the scrollbar to adapt to the new situation, and possibly disappear.  Instead, it's working on old information, I suppose.
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • S_ALR_87012284 -  List Output - ALV Tree Control

    Dear Friends,
    In Standard Financial statement report when I use List output  -> ALV Tree Control  lay out. In the display area is it possible to save the expanded folders  in lay out. So that next time when I run the report with the same ALV Tree Contorl lay out, I would like to see folders expanded.
    Thanks,
    Venky

    Hi Venky,
    There is no way to have expanded tree list. You must hit Expand tree button to.
    You can also use ttrasaction code F.01 for balance sheet.
    Best regards

  • UIX:Tree Control

    Hi,
    Has anybody used or know to use the UIX:Tree control part of the UIX Simple JSP Components? If so can you please tell me if this helps creating a DHTML Tree component?
    Thanks
    mn

    Hello there,
    You should check out the "Data Trees" chapter of the UIX Developer's Guide. It goes into a lengthy description of the tree component and how to code it in UIX. The tree component does not use DHTML, but rather rerenders based on its state (what is expanded and collapsed).

  • Single click on tree control navigation

    Hello I have a tree control where I have include the navigation, I know that there is a method
    HANDLE_NODE_DOUBLE_CLICK FOR G_TREE
    but is there an method for only one click, I want to change my alv grid data when I click on several nodes in my tree control

    Hello Muhammet
    I have re-written my sample report ZUS_SDN_TWO_ALV_GRIDS into ZUS_SDN_TREE_AND_GRID_CONTROL which is now display a tree control together with the ALV grid.
    When you analyze this new report you will see that every step of the program logic is as I described in my previous e-mails.
    *& Report  ZUS_SDN_TWO_ALV_GRIDS
    *& Screen '0100' contains no elements.
    *& ok_code -> assigned to GD_OKCODE
    *& Flow logic:
    *  PROCESS BEFORE OUTPUT.
    *    MODULE STATUS_0100.
    *  PROCESS AFTER INPUT.
    *    MODULE USER_COMMAND_0100.
    *& Thread: single click on tree control navigation
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1143770"></a>
    REPORT  zus_sdn_tree_and_grid_control.
    TYPE-POOLS: abap, cntl.
    TYPES: node_table_type LIKE STANDARD TABLE OF mtreesnode
             WITH DEFAULT KEY.
    * CAUTION: MTREESNODE is the name of the node structure which must
    * be defined by the programmer. DO NOT USE MTREESNODE!
    CONSTANTS:
      BEGIN OF c_nodekey,
        root   TYPE tv_nodekey VALUE 'Root',                    "#EC NOTEXT
        child1 TYPE tv_nodekey VALUE 'Child1',                  "#EC NOTEXT
    *    child2 type tv_nodekey value 'Child2',                  "#EC NOTEXT
        new1   TYPE tv_nodekey VALUE 'New1',                    "#EC NOTEXT
        new2   TYPE tv_nodekey VALUE 'New2',                    "#EC NOTEXT
    *    new3   type tv_nodekey value 'New3',                    "#EC NOTEXT
    *    new4   type tv_nodekey value 'New4',                    "#EC NOTEXT
      END OF c_nodekey.
    DATA:
      gd_okcode        TYPE ui_func,
      gd_repid         TYPE syst-repid,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_splitter      TYPE REF TO cl_gui_splitter_container,
      go_cell_left     TYPE REF TO cl_gui_container,
      go_cell_right    TYPE REF TO cl_gui_container,
      go_tree          TYPE REF TO cl_gui_simple_tree,
      go_grid1         TYPE REF TO cl_gui_alv_grid,
    **  go_grid2         TYPE REF TO cl_gui_alv_grid,
      gs_layout        TYPE lvc_s_layo.
    DATA:
      gt_knb1          TYPE STANDARD TABLE OF knb1,
      gt_knvv          TYPE STANDARD TABLE OF knvv.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
          handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
            IMPORTING
              e_row
              e_column
              es_row_no
              sender.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_double_click.
    *   define local data
        DATA:
          ls_knb1      TYPE knb1.
        CHECK ( sender = go_grid1 ).
        READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row-index.
        CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
    **    CALL METHOD go_grid1->set_current_cell_via_id
    **      EXPORTING
    ***        IS_ROW_ID    =
    ***        IS_COLUMN_ID =
    **        is_row_no    = es_row_no.
    *   Triggers PAI of the dynpro with the specified ok-code
        CALL METHOD cl_gui_cfw=>set_new_ok_code( 'DETAIL' ).
      ENDMETHOD.                    "handle_double_click
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    *       CLASS LCL_APPLICATION DEFINITION
    CLASS lcl_application DEFINITION.
      PUBLIC SECTION.
        CLASS-DATA:
          md_event       TYPE string     READ-ONLY,
          md_node_key    TYPE tv_nodekey READ-ONLY.
        CLASS-METHODS:
          handle_node_double_click
            FOR EVENT node_double_click
            OF cl_gui_simple_tree
            IMPORTING node_key,
          handle_expand_no_children
            FOR EVENT expand_no_children
            OF cl_gui_simple_tree
            IMPORTING node_key.
    ENDCLASS.                    "LCL_APPLICATION DEFINITION
    *       CLASS LCL_APPLICATION IMPLEMENTATION
    CLASS lcl_application IMPLEMENTATION.
      METHOD  handle_node_double_click.
        " this method handles the node double click event of the tree
        " control instance
        " show the key of the double clicked node in a dynpro field
        md_event = 'NODE_DOUBLE_CLICK'.
        md_node_key = node_key.
        " Trigger PAI and set ok-code = 'DETAIL'
        CALL METHOD cl_gui_cfw=>set_new_ok_code
          EXPORTING
            new_code = 'DETAIL'
    *      IMPORTING
    *        rc       =
        MESSAGE md_node_key TYPE 'I'.
      ENDMETHOD.                    "HANDLE_NODE_DOUBLE_CLICK
      METHOD handle_expand_no_children.
        " this method handles the expand no children event of the tree
        " control instance
        DATA: node_table TYPE node_table_type,
              node TYPE mtreesnode.
        " show the key of the double clicked node in a dynpro field
        md_event = 'EXPAND_NO_CHILDREN'.
        md_node_key = node_key.
        IF node_key = 'Child1'.
    * add two nodes to the tree control (the children of 'Child1')
    * Node with key 'New1'
          CLEAR node.
          node-node_key = c_nodekey-new1.
          node-relatkey = c_nodekey-child1.
          node-relatship = cl_gui_simple_tree=>relat_last_child.
          node-isfolder = ' '.
          node-text = 'New1'(ne1).
          APPEND node TO node_table.
    * Node with key 'New2'
          CLEAR node.
          node-node_key = c_nodekey-new2.
          node-relatkey = c_nodekey-child1.
          node-relatship = cl_gui_simple_tree=>relat_last_child.
          node-n_image = '@10@'.
          node-expander = ' '.
          node-text = 'New2'(ne2).
          APPEND node TO node_table.
          CALL METHOD go_tree->add_nodes
            EXPORTING
              table_structure_name           = 'MTREESNODE'
              node_table                     = node_table
            EXCEPTIONS
              failed                         = 1
              error_in_node_table            = 2
              dp_error                       = 3
              table_structure_name_not_found = 4
              OTHERS                         = 5.
          IF sy-subrc <> 0.
    **        MESSAGE A000.
          ENDIF.
        ENDIF.
      ENDMETHOD.                    "HANDLE_EXPAND_NO_CHILDREN
    ENDCLASS.                    "LCL_APPLICATION IMPLEMENTATION
    START-OF-SELECTION.
      SELECT        * FROM  knb1 INTO TABLE gt_knb1 UP TO 100 ROWS
             WHERE  bukrs  = '1000'.
      PERFORM init_controls.
    * Display data
      gs_layout-grid_title = 'Customers: Sales Areas'.
      CALL METHOD go_grid1->set_table_for_first_display
        EXPORTING
          i_structure_name = 'KNVV'
          is_layout        = gs_layout
        CHANGING
          it_outtab        = gt_knvv
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Link the docking container to the target dynpro
      gd_repid = syst-repid.
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = gd_repid
          dynnr                       = '0100'
    *      CONTAINER                   =
        EXCEPTIONS
          OTHERS                      = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * NOTE: dynpro does not contain any elements
      CALL SCREEN '0100'.
    * Flow logic of dynpro (does not contain any dynpro elements):
    *PROCESS BEFORE OUTPUT.
    *  MODULE STATUS_0100.
    *PROCESS AFTER INPUT.
    *  MODULE USER_COMMAND_0100.
    END-OF-SELECTION.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.  " contains push button "DETAIL"
    *  SET TITLEBAR 'xxx'.
    * Refresh display of detail ALV list
      CALL METHOD go_grid1->refresh_table_display
    *    EXPORTING
    *      IS_STABLE      =
    *      I_SOFT_REFRESH =
        EXCEPTIONS
          OTHERS         = 2.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      TRANSLATE gd_okcode TO UPPER CASE.
      CASE gd_okcode.
        WHEN 'BACK' OR
             'END'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
    *   User has pushed button "Display Details"
        WHEN 'DETAIL'.
          MESSAGE gd_okcode TYPE 'I'.
          PERFORM entry_show_details.
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  ENTRY_SHOW_DETAILS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM entry_show_details .
    * define local data
      DATA:
        ld_row      TYPE i,
        ls_knb1     TYPE knb1.
      IF ( gt_knvv IS INITIAL ).
        SELECT        * FROM  knvv INTO TABLE gt_knvv
        FOR ALL ENTRIES IN gt_knb1
           WHERE  kunnr  = gt_knb1-kunnr.
      ELSE.
        REFRESH: gt_knvv.
      ENDIF.
    ENDFORM.                    " ENTRY_SHOW_DETAILS
    *&      Form  INIT_CONTROLS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM init_controls .
    * Create docking container
      CREATE OBJECT go_docking
        EXPORTING
          parent = cl_gui_container=>screen0
          ratio  = 90
        EXCEPTIONS
          OTHERS = 6.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Create splitter container
      CREATE OBJECT go_splitter
        EXPORTING
          parent            = go_docking
          rows              = 1
          columns           = 2
    *      NO_AUTODEF_PROGID_DYNNR =
    *      NAME              =
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_error = 2
          OTHERS            = 3.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Get cell container
      CALL METHOD go_splitter->get_container
        EXPORTING
          row       = 1
          column    = 1
        RECEIVING
          container = go_cell_left.
      CALL METHOD go_splitter->get_container
        EXPORTING
          row       = 1
          column    = 2
        RECEIVING
          container = go_cell_right.
    * Create ALV grids
      CREATE OBJECT go_grid1
        EXPORTING
          i_parent = go_cell_right
        EXCEPTIONS
          OTHERS   = 5.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Set event handler
      SET HANDLER:
        lcl_eventhandler=>handle_double_click FOR go_grid1.
      PERFORM create_and_init_tree.
    ENDFORM.                    " INIT_CONTROLS
    *&      Form  CREATE_AND_INIT_TREE
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM create_and_init_tree .
      DATA: lt_node_table TYPE node_table_type,
            lt_events TYPE cntl_simple_events,
            ls_event TYPE cntl_simple_event.
    * create a tree control
      CREATE OBJECT go_tree
        EXPORTING
          parent                      = go_cell_left
          node_selection_mode         = cl_gui_simple_tree=>node_sel_mode_single      " single node selection is used
        EXCEPTIONS
          lifetime_error              = 1
          cntl_system_error           = 2
          create_error                = 3
          failed                      = 4
          illegal_node_selection_mode = 5.
      IF sy-subrc <> 0.
    **    MESSAGE a000.
      ENDIF.
    * define the events which will be passed to the backend
      " node double click
      ls_event-eventid = cl_gui_simple_tree=>eventid_node_double_click.
    **  ls_event-appl_event = 'X'. " process PAI if event occurs
      " NOTE: Do NOT register as application event !!!!!
      APPEND ls_event TO lt_events.
      CALL METHOD go_tree->set_registered_events
        EXPORTING
          events                    = lt_events
        EXCEPTIONS
          cntl_error                = 1
          cntl_system_error         = 2
          illegal_event_combination = 3.
      IF sy-subrc <> 0.
    **    MESSAGE a000.
      ENDIF.
      SET HANDLER:
        lcl_application=>handle_node_double_click   FOR go_tree,
        lcl_application=>handle_expand_no_children  FOR go_tree.
    * 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_table USING lt_node_table.
    * node_table_structure_name     = 'MTREESNODE'
    *   A programmer using the tree control must create a structure in the
    *   dictionary. This structure must include the structure TREEV_NODE
    *   and must contain a character field with the name 'TEXT'.
      CALL METHOD go_tree->add_nodes
        EXPORTING
          table_structure_name           = 'MTREESNODE'
          node_table                     = lt_node_table
        EXCEPTIONS
          failed                         = 1
          error_in_node_table            = 2
          dp_error                       = 3
          table_structure_name_not_found = 4
          OTHERS                         = 5.
      IF sy-subrc <> 0.
    **    MESSAGE a000.
      ENDIF.
    ENDFORM.                    " CREATE_AND_INIT_TREE
    *&      Form  build_node_table
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_node_table
      USING
        node_table TYPE node_table_type.
      DATA: node LIKE mtreesnode.
    * Build the node table.
    * Caution: The nodes are inserted into the tree according to the order
    * in which they occur in the table. In consequence, a node must not
    * occur in the node table before its parent node.
    * Node with key 'Root'
      node-node_key = c_nodekey-root.
      " 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.
      node-text = 'Root'(roo).
      APPEND node TO node_table.
    * Node with key 'Child1'
      node-node_key = c_nodekey-child1.
      " Key of the node
      " Node is inserted as child of the node with key 'Root'.
      node-relatkey = c_nodekey-root.
      node-relatship = cl_gui_simple_tree=>relat_last_child.
      node-hidden = ' '.
      node-disabled = ' '.
      node-isfolder = 'X'.
      CLEAR node-n_image.
      CLEAR node-exp_image.
      node-expander = 'X'. " The node is marked with a '+', although
      " it has no children. When the user clicks on the
      " + to open the node, the event
      " expand_no_children is fired. The programmer can
      " add the children of the
      " node within the event handler of the
      " expand_no_children event
      " (see method handle_expand_no_children
      " of class lcl_application)
      node-text = 'Child1'(ch1).
      node-style = cl_gui_simple_tree=>style_emphasized_positive.
      APPEND node TO node_table.
    ENDFORM.                    " build_node_table
    Regards
      Uwe

Maybe you are looking for