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

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

  • Handling event for Tree Control Collapse

    Hi,
    Can any one suggest how to handle an event for 'Tree Node Collapse' . I have checked with all the exised tree events.
    thanks,
    Venu

    Hi Venugopal,
        If you are doing tree control programmin then i can suggest you a approach for tree node collapse and expand.
    for doing this follow these steps.
    1. create a toolbar (use class cl_gui_toolbar), add a button and assign a FCODE to it.
    2. here you register the following the event for the toolbar.
    gs_event-eventid = cl_gui_toolbar=>m_id_function_selected.
    3. here you set the handler for the toolbar events
      SET HANDLER  gref_application->handle_function_selected
                FOR  gref_toolbar.
    4. now in your class for gref_application you write a definition and implementation.
    definition
    handle_function_selected FOR EVENT handle_function_selected OF cl_gui_toolbar IMPORTING fcode.
    implementation
    CASE fcode.
       when 'collapse'.
          CALL METHOD xref_tree->collapse_all_nodes.
    this method might change depending upon the class you use for creating the tree.
    i hope this will help you.
    in case of clarification do get back to me.
    regards,
    Kinshuk Saxena
    PS mark helpful answers

  • Items in Tree control move around when data is submitted using custom ItemRenderer

    I'm working on a Tree control with an XMLListCollection as
    its dataProvider.
    The dataProvider has information looking like this :
    quote:
    <?xml version='1.0' encoding='utf-8'?>
    <INFO>
    <FIELD label="STR_USER_NAME"
    type="text"
    value=""
    >
    </FIELD>
    <FIELD label="STR_USER_EMAIL"
    type="text"
    value=""
    >
    </FIELD>
    <FIELD label="STR_OPTIONAL"
    type="branch"
    value="0"
    >
    <FIELD label="STR_USER_ADDRESS"
    type="text"
    value=""
    >
    </FIELD>
    <FIELD label="STR_USER_POSTAL_CODE"
    type="text"
    value=""
    >
    </FIELD>
    </FIELD>
    </INFO>
    So in the Tree control I'd like the information to show up
    with a label and
    an
    editable textbox for each item :
    [Label] [textbox]
    To do this I made a tree like this :
    quote:
    <mx:Tree id="userTree"
    editable="true"
    rendererIsEditor="true"
    editorDataField="curVal"
    itemRenderer="{new ClassFactory(ItemRendererUser)}"
    itemEditEnd="e_ProcessData(event);"
    dataDescriptor="{new DataDescriptorUsers()}"
    showRoot="false"
    verticalScrollPolicy="{ScrollPolicy.AUTO}"
    />
    where the e_ProcessData() function looks like this (I used
    http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/js/html/wwhelp.htm?href=c
    elleditor_073_16.html#202105 as a guide) :
    quote:
    public function e_ProcessData(event:ListEvent):void
    event.preventDefault();
    userTree.editedItemRenderer.data.@value =
    ItemRendererUsers(event.currentTarget.itemEditorInstance).curVal;
    userTree.destroyItemEditor();
    userTree.dataProvider.notifyItemUpdate(userTree.editedItemRenderer);
    } // END OF e_ProcessData()
    I attached the rest of the files because they're a little
    bit longer.
    When I run the program, the data shows up fine when it is
    initialized the
    very
    first time, and I made a test button that just dumps the
    contents of the
    dataProvider in a trace statement to verify that the data has
    been set
    properly.
    The problem I've run into is whenever the textfield is
    edited, the item
    that
    I've selected jumps around the list.
    For example, if I edit the item "STR_USER_NAME" after I
    finish the edit, it
    will move from the very first position in the Tree to the
    bottom of the
    Tree.
    I traced the contents of the dataProvider and the
    dataProvider structure
    stays
    the same, with the "STR_USER_NAME" at the top, but if I look
    at the flex app
    in
    the web browser, its position is at the bottom of the Tree.
    This happens for every other item I try to edit... I read in
    the
    documentation
    that the ItemRenderers are recycled, so it means I should be
    checking to
    make
    sure the initial states are covered, but I'm not sure how
    this affects my
    application.
    Can anyone help me out with this ? Its very confusing - I've
    tried making
    an
    ItemRenderer using pure actionscript, mxml and the
    combination you see in
    this
    example and I always end up with the same behaviour - So I
    must be missing
    something critical...
    // ItemRendererUsers.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:mx="
    http://www.adobe.com/2006/mxml"
    verticalScrollPolicy="{ScrollPolicy.OFF}"
    horizontalScrollPolicy="{ScrollPolicy.OFF}"
    creationComplete="initItemRendererUsers();"
    >
    From my FAQ:
    Q: I've created a custom itemRenderer component to use in a
    List
    based component (Datagrid, TileList, HorizontalList, etc.).
    When my List
    first displays, everything looks fine, but when I scroll it
    or change the
    dataProvider, some of the itemRenderers show values or
    formatting that
    aren't right. How do I fix this?
    A: List-based components don't draw a renderer for every item
    in the
    dataProvider. Instead, they create enough to display what is
    on screen now,
    plus one or two more waiting in the wings. This means they
    recycle the
    renderers rather than creating new ones when you change
    dataProvider or
    scroll up and down. When you use a creationComplete event to
    set up the
    itemRenderer, that event doesn't happen again when the
    renderer is used for
    a different set of data. The solution to this is to override
    the set data
    protected function that most components have.
    For more information, check out the following resources:
    http://www.adobe.com/devnet/flex/articles/itemrenderers_pt1.html?devcon=f1
    http://blogs.adobe.com/aharui/2007/03/thinking_about_item_renderers_1.html
    Please note, I post this FAQ weekly, and you can find a
    permanent copy of it
    here
    http://www.magnoliamultimedia.com/flex_examples/Amys_Flex_FAQ.pdf

    "peterh8234" <[email protected]> wrote in
    message
    news:gaqttd$kft$[email protected]..
    > Yes - the set and get functions are listed down below.
    But the quirky
    > behaviour
    > is the same regardless of whether I override the set and
    get functions or
    > not.
    >
    > I noticed there was another variable called listData -
    should I be using
    > that
    > one or the data variable to read and write to the
    dataProvider ?
    >
    > // _data
    > [Bindable] public var _data:Object;
    > [Bindable("dataChange")]
    > //
    > override public function get data():Object
    > {
    > trace('[ItemRendererDefault.GET data()] called for {' +
    > _data.attribute("label") + '}.');
    > return _data;
    > } // END OF get data()
    >
    > //
    > override public function set data(value:Object):void
    > {
    > _data.@value = inputText.text;
    > trace('[ItemRendererDefault.SET data()] called for {' +
    > _data.attribute("label") + '}.');
    >
    > invalidateProperties();
    > } // END OF set data()
    Your set data needs to set a flag that gets picked up in
    commitProperties()
    and does your thing that you were doing before in
    creationComplete. You
    should see examples of this in the links I posted. Instead of
    this:
    _data.@value = inputText.text;
    you should look at implementing IDropInListItemRenderer,
    which will allow
    you to dynamically determine which field to look at, instead
    of hardcoding
    it. You also might wind up overwriting the stored value with
    a null value
    when the List passes the stored value in. I'd encourage you
    to really go
    through those links I posted and make sure you understand
    what they're
    saying. The itemRenderer life cycle is one of the hardest
    things to
    understand, but once you understand it, it makes many things
    in Flex much
    easier. It's worth investing the time.

  • Re-create Tree control drag and drop move

    Hello,
    Ive got a tree control where dragEnabled=true and I have
    custom handlers for dragEnter, dragOver, and dragDrop so that I can
    drag/drop from datagrid's to the tree and it works fine.
    The issue is now the built in tree functionality for moving
    nodes around within the tree is gone. When I set dropEnabled=true
    it breaks the ability to drop from the datagrid to the tree.
    How can i keep the ability to move tree nodes within the tree
    and also be able to drag and drop from a datagrid onto the tree?
    Thanks for any help!

    While doing more testing I found the solution.. seriously...
    dont know how I should have known this one...
    on Tree dragOver handler:
    if( from.id == 'data_grid' ) event.preventDefault();

  • 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

  • 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.

  • 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

  • Object Object displaying in my tree control

    I verified that my arrarycollection is being returned from
    the database correctly but my tree control displays object Object.
    Can anyone offer any suggestions?

    "madhooper" <[email protected]> wrote in
    message
    news:ghrctr$egn$[email protected]..
    >I attached the code for the tree and below is a sample of
    the array that is
    > returned.
    > Object)#0
    > hierarchy = (Object)#1
    > 0000001 = (Object)#2
    > id = "0000001"
    > image = "0000001.png"
    > label = "ENGINE GROUP (1/2)"
    > level = "1"
    > sections = (Object)#3
    > 1101 = (Object)#4
    > id = "1101"
    > image = "1101.png"
    > label = "1101 ENGINE ASSY"
    > level = "2"
    > sections = (Object)#5
    > 1101002A = (Object)#6
    > id = "1101002A"
    > image = "1101002A.gif"
    > label = "1101002A 1101 ENGINE ASSY (9202-9704)5K [ASSY]"
    > level = "3"
    > sections = (Array)#7
    > 1101006 = (Object)#8
    > id = "1101006"
    > image = "1101006.gif"
    > label = "1101006 1101 ENGINE ASSY (9202-9704)5K [SHORT
    BLOCK
    > ASSY]"
    > level = "3"
    > sections = (Array)#9
    > 1101078B = (Object)#10
    > id = "1101078B"
    > image = "1101078B.gif"
    > label = "1101078B 1101 ENGINE ASSY (9202-9704)5K [KIT]"
    > level = "3"
    > sections = (Array)#11
    > 1101093 = (Object)#12
    > id = "1101093"
    > image = "1101093.gif"
    > label = "1101093 1101 ENGINE ASSY (8104-9704)"
    > level = "3"
    > sections = (Array)#13
    >
    >
    > <mx:Panel label="Index"
    >
    icon="@Embed(source='../assets/images/icons/Alpha_Index.png')">
    > <mx:Canvas label="Index" width="100%" height="100%"
    > backgroundColor="0xbFFFFFF"
    > borderColor="0xFFFFFF" borderThickness="5"
    > borderStyle="solid">
    > <mx:RadioButton x="8" y="3" label="Expand All"/>
    > <mx:RadioButton x="104" y="2" label="Collapse"/>
    > <mx:RadioButton x="202" y="3" label="Restore"/>
    > <mx:Label x="0" y="30" text="Filter by Section"/>
    > <mx:TextInput x="101" y="28" width="219"/>
    > <mx:Tree id="partsTree" labelField="sections" x="10"
    y="56"
    > width="354" height="239" dataProvider="{tree}">
    > </mx:Tree>
    > </mx:Canvas>
    > </mx:Panel>
    Since sections always seems to be an array in your hierarchy,
    exactly what
    label did you think you were going to see by specifying that
    field as a
    labelField?

  • 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

  • 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

  • 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).

  • Tree control double click default behavior

    Hi all,
    Tree control have default behavior that expand/ collapse item when double click event occurs on parent item.
    How do I to avoid this behavior to use custom double click event without open close nodes?
    Thanks,
    regards
    Solved!
    Go to Solution.

    Hi,
    I was not able to disable the default event however I realized a VI that could be useful for you.
    I've used a method to force all the tree items to be collapsed.
    Take a look at the attached image.
    Regards,
    Alex
    Attachments:
    treecontrol.png ‏15 KB

  • Embedding Tree control in TableView

    Hi all,
    I want to create a table which rows can be collapsed, looks like a tree embedded into a table.
    But we do not know how to implement it using Portal Applications. Can anyone send an example to do it?
    If I use CellRenderer to render tree control,After expanding the tree node,the subnodes are displayed in the same cell.But what I need is ,on expansion of tree the rows also should be expanded and collapsed accordingly.
    Thanks in Advance,
    Santhosh

    Hi Santhosh,
    Actually there is no need to use div tag. I am giving a sample code below. Try it and make the necessary modifications.
    <html>
         <head>
              <title>
                   Expand/Collapse
              </title>
              <script language='javascript'>
                   function toggle(divid)
                        obj=document.getElementById(divid);
                        visible=(obj.style.display!="none");
                        if(visible)
                             obj.style.display="none";
                        else
                             obj.style.display="block";
              </script>
         </head>
         <body>
              <table border=1>
                   <tr>
                        <td><a href=javascript:toggle("first")>First</a></td>
                   </tr>
                   <tr id="first" style="display: none;">
                        <td><b>This is the first text</b></td>
                   </tr>
                   <tr>
                        <td><a href=javascript:toggle("second")>Second</a></td>
                   </tr>
                   <tr id="second" style="display: none;">
                        <td><b>This is the second text</b></td>
                   </tr>
              </table>
         </body>
    </html>
    Hope this solves your problem.
    Ranjith

Maybe you are looking for

  • How do I transfer old photos to the newer computer?

    I am trying to transfer my older pictures from my older computer that isn't getting much use these days to the newer one that I use more. My older computer is a Acer IBM laptop, I used that computer like ages ago, but I'm hardly using it much now, bu

  • E-Filing on Business Connector version 4.8

    Hello We are currently running Business Connector (BC) 4.7 (which is out of support) & need to move to BC 4.8.  I have installed this on a new server & now need to get E-filing running.  Our database is at R/3 4.7 The only document I can find re: E-F

  • [svn:bz-trunk] 20609: Change the default max object nest level from 1024 to 512.

    Revision: 20609 Revision: 20609 Author:   [email protected] Date:     2011-03-04 10:23:41 -0800 (Fri, 04 Mar 2011) Log Message: Change the default max object nest level from 1024 to 512. A max object nest level of 512 should be more than enough for m

  • Send email as PDF to Purchasing group & the vendor

    Requirement : To send PO as PDF through email to the Vendor's email address & the purchasing group at the time of saving. Is there an Exit for this ? Or How do I go about it ? Thanks SMS

  • Clear printer memory

    I have a Deskjet 4480 which is great but I cannot figure out how to clear the memory. There has to be a simple way. It's so frustrating when the printer goes on printing stuff that I don't want anymore. Thanks for any suggestions.