Drag and drop ALV to table control

Hi all,
Does anyone know if it is possible to program the drag-and-drop functionality from an ALV list to a table control? I would like to have this feature to let the user enter data on 1 screen. On the left part the user sees an ALV list and on the right the user sees the online transaction. I would like the user to enter data simply by drag and drop instead of having to enter the data.
Does someone has a sample program for this?
Regards,
Kris

Hi Kris
I can download the programs and send them to you, but you should give me your e-mail.
Anyway you can use Drag and Drop if you build your table control by ALV, i.e. ALV GRID.
But I'm using 4.7 and I don't know how class CL_GUI_ALV_GRID is in your release, I believe the release 4.6B is one of first release whit this class.
Max

Similar Messages

  • NamedViewCriteria not working when drag and dropped as filtered table.

    Using JDev 11.1.2.1.0.
    I'm attempting to use NamedViewCriteria more and more because, well ... I keep reading it's the way to go. But I'm encountering an aggravating problem. I can't get them to work when I drag and drop as a filtered table onto a page. They work when I apply them in a managed bean, but simply dragging and dropping will not trigger the NamedViewCriteria to display the filtered items correctly.
    Creating a where clause manually works fine.
    Manual Where Clause & drag and drop ViewObject from data control
    (:pBpKey is null or upper(BP_KEY) like '%' || upper(:pBpKey) || '%') AND CinderBusinessPartners.BP_TYPE = 'C'NamedViewCriteria & drag and drop from ViewObject's NamedViewCriteria from data control
    ( ( (CinderBusinessPartners.BP_KEY LIKE ('%' || :pBpKey || '%') ) AND (CinderBusinessPartners.BP_TYPE = 'C' ) ) )There are three problems:
    1) The query pulls back all items. It doesn't retrieve only where BP_TYPE = 'C'.
    2) It is case sensitive. i.e. Enter in A will not pull back the customer Wal-Mart because Wal-mart contains lowercase a's.
    3) If I set the table's "Show Filter" attribute to true, the filter has the text "\*pBpKey\*" filled in by default. uhhh What?
    In the NamedViewCriteria's "UI Hints" tab, I have the "Query Automatically" checkbox selected.
    Any ideas why the NamedViewCriteria isn't "just working"?
    I'll be back with pictures after the break.
    Will

    I've rolled this into a bug post as seen here: BUG: NamedViewCriteria drag and drop as table SNAFU
    Pictures:
    Here is the NVC query
    http://www.williverstravels.com/JDev/Forums/Threads/2381120/Nvc1.jpg
    Here's that dang extra bind variable!
    http://www.williverstravels.com/JDev/Forums/Threads/2381120/Nvc3.jpg
    And just because I like awesome Paint.Net art.
    http://www.williverstravels.com/JDev/Forums/Threads/2381120/Nvc2.jpg
    Hope this helps someone down the road.
    Edited by: LovettWB on Apr 26, 2012 1:59 PM

  • New JNDI name created for each drag and drop of database table into table

    Hi All,
    I'm using Netbeans 5.5 with Visual Web Pack with Mysql as backend. Whenever I drag and drop a database table into table component it creates new JNDI (data source) name for each table. I want to use single JNDI name for all tables. If I change the JNDI name to default name then the design disappears and shows error . Is there any option to set the JNDI name unique for all tables?
    Thanks in advance.

    Hi again,
    Well I've tried using the MouseListener / MouseMotionListener approach but it doesn't quite seem to work, although it does get the events correctly. I think the reason is that it doesn't interact correctly with the Java DnD machinery which is something that V.V hinted at. It's something that I may need to look into if / when I have more time available.
    I have to say though that I haven't had any problems with scrollbars - we're making fairly heavy use of large tables and if you drag over a table with a scroll bar and move to the top or bottom then it scrolls as you would expect and allows you to drop the data where you like. For this situation I've used pretty much the same approach as for the toy example above except that I've implemented separate source and destination TransferHandlers (the source table is read-only, and it really doesn't make sense to allow people to drag from the destination table so I've essentially split the functionality of the example handler down the middle).
    I'm not actually particularly in favour of messing too much with the mechanics of DnD, more because of lack of time than anything else. Guess I'll just have to put up with this for the moment. Doesn't help that DnD is so poorly documented by Sun.
    Thanks for all your help.
    Bart

  • Drag & Drop, ALV or Table Control to Tree Control

    Hi Experts,
    If i want Drag & Drop feature in ALV or Table Control to Tree Control

    Hi,
      refer to the link below:
    http://help.sap.com/saphelp_46c/helpdata/fr/22/a3f5fbd2fe11d2b467006094192fe3/content.htm
    With luck,
    Pritam.

  • Drag and Drop rows between tables in JSP

    I have to convert a swing application into a web project. One of the screens in my swing application uses drag and drop of records between two tables. The key is that when one of the rows is picked and dropped in the other table values get allocated to each column accordingly. I need to bring this functionality into a JSP. There is no constraint on using Javascripts. Please help me asap.
    Regards,
    KK

    Yes it is possible, but not so easy. If you'll be at OOW this year, you can come to my session (S301752, Monday 13:00-14:00) - I will show something similar there. If you're not so lucky, you can read the excellent blogpost of my colleague at [http://rutgerderuiter.blogspot.com/2008/07/drag-planboard.html]
    Cheers
    Roel

  • Drag and drop data from Numeric Control or Numeric Array to excel file

    I have two inquirries about drag and drop:
    1. How to drag and drop data from a Numeric Array or Numeric control to excel file
    2. How to drag and drop data from a Numeric Array or Numeric control to an Numeric array Indicator?
    The item 2, I tried it with the event structure, but it didnt work.
    Please do reply.
    mytestautomation.com
    ...unleashed the power, explore and share ideas on power supply testing
    nissanskyline.org
    ...your alternative nissan skyline information site

    There are very good drag and drop examples that ship with LabVIEW.  Have you looked these over to see if they can be modified for your needs?
    Matthew Fitzsimons
    Certified LabVIEW Architect
    LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison

  • Drag and drop ALV Row

    HI All,
         My requirement is that " user should be able to drag and drop one row position to another row position( example: if the user select row 2 and drag and drop it to row5 then the row 2 should move to the row 5 ).
    Can anybody knows how to achieve this functionality in WD application
    Thanks & Regards,
    Ruchi Tiwari

    hi ,
    refer Thomas quote in the thread :
    Re: Drag And Drop
    on NetWeaver 7.0 Enhancement Package 1. On this release we have a DragSourceInfo UI element:
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/e0a9f17e483c84e10000000a42189c/frameset.htm
    and a DropTargetInfo UI element:
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/e0aa477e483c84e10000000a42189c/frameset.htm
    We also have the DropTarget UI element:
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/e4/a9f9a9b52742d3b0c43b6c671b8f60/frameset.htm
    and an onDrop event built into several of the standard UI elements. These new events and new UI elements make Drag and Drop possible. For an overview on Drag and Drop in WDA, read this link:
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/a5/bf47414eca430794189fbb5919cc2f/frameset.htm
    refer the standard WD component WDR_TEST_DRAG_AND_DROP .
    regards,
    amit
    Edited by: amit saini on Jan 15, 2010 5:13 AM

  • Drag and Drop in ALV

    Hi All,
    I have the latest version configured. In the ALV, I have new feature to drag and drop the column
    in the ALV table so that it's position can be changed.
    Because of this my columns settings are getting disturbed.
    How to disable this feature.
    I have already coded as
    lr_model->SET_COLUMN_SELECTION_ALLOWED( abap_false ).
    lr_model->set_fixed_cols_left_allowed( abap_false ).
    lr_model->set_fixed_cols_right_allowed( abap_false ).
    Earliest replies are highly appreciated.
    Thomas: Any way to do this.
    Regards,
    Lekha.

    Hi Lekha,
    Please refer to the link below. This link elaborates how to enable Drag and Drop functionality in tables. I hope reversing those settings and properties will disable drag n drop feature.
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d0760510-a2d5-2b10-de9f-d897679696e3
    I hope this will help your cause.
    Regards,
    Sumit

  • Drag and Drop via Data Control doesn't seem to bind input parameter.

    Hi Everyone,
    I've followed the 'how to drag and drop a webservice data control' excercise in my current application to bring back complex data on the basis of one parameter(appId). However, when running the application, the server logs indicate that 'The value of appId cannot be null'. I have definitely bound the appId to the requestIterator, and the button that calls the webservice has been bound accordingly too. The response tables have been bound to the responseIterator. The webservice definitely works, and brings back data as I've tested it with SoapUI for this appId.
    Is there something I'm missing?
    Any suggestions will be helpful.
    Thanks,
    Preethi.

    Hi Sarojamaly,
    According to your description, when you create a Data Source View in BIDS/SSDT, you can't see the tables in the pane. Right?
    In this scenario, when creating data source, please make sure you select a correct data provider. For example, it you connect to SQL Server database, you should use
    Native OLE DB\SQL Server Native Client. Then please test your connection to the data source.
    If the tables still can't be displayed, please make sure you select proper database and the check tables existence in the database.
    Best Regards,
    Simon Hou
    TechNet Community Support

  • Reordering of rows - issue with drag and drop of editable columns in table

    JDeveloper: 11.1.1.6.0
    ADF Faces - Drag and Drop for reordering of rows within the same af:table
    I have a requirement for reordering rows in a table using drag and drop. This table is loaded using a list and I am able to programmatically do the reordering of the rows based on the events of drag and drop by manipulating the list. Reordering of rows is working fine if all the columns are read only. For all the input text and input date columns the values are not getting reordered. Anyone has any idea on what the issue may be with reordering of the rows for editable columns/rows (af:inputText and af:inputDate) in af:table. Below is what Iam doing on drop event which is a collection drop target.
    public DnDAction dropCollection(DropEvent dropEvent) {
    try
    Object dropSite = dropEvent.getDropSite();
    Transferable transferable = dropEvent.getTransferable();
    DataFlavor<RowKeySet> rowKeySetFlavor = DataFlavor.getDataFlavor(RowKeySet.class, "rowmove");
    RowKeySet rowKeySet = transferable.getData(rowKeySetFlavor);
    RichTable table = (RichTable) dropEvent.getDragComponent();
    if (rowKeySet != null)
    CollectionModel dragModel = transferable.getData(CollectionModel.class);
    Object dragM = dragModel.getRowData(0);
    Object currKey = rowKeySet.iterator().next();
    dragModel.setRowKey(currKey);
    table.setRowKey(currKey);
    OrderData orderData = (OrderData)this.prodReportTableData.get(Integer.parseInt(currKey.toString()));
    this.prodReportTableData.remove(Integer.parseInt(currKey.toString()));
    this.prodReportTableData.add(Integer.parseInt(dropSite.toString()), orderData);
    OrderData orderDataAdded = this.prodReportTableData.get(Integer.parseInt(dropSite.toString()));
    JSFUtils.addPartialTarget(this.getProdReportTableBinding());
    catch(Exception e)
    e.printStackTrace();
    return DnDAction.MOVE;
    Code snippet from UI:
    <af:table value="#{pageFlowScope.prodReportBackingBean.prodReportTableData}"
    var="row" styleClass="AFStretchWidth" rowBandingInterval="0"
    rows="40" emptyText="No data to display." id="t1"
    partialTriggers=":::cb1" columnStretching="column:c3"
    binding="#{pageFlowScope.prodReportBackingBean.prodReportTableBinding}" summary="PROD TABLE">
    <af:dragSource actions="MOVE" defaultAction="MOVE"
    discriminant="rowmove"
    dragDropEndListener="#{pageFlowScope.prodReportBackingBean.afterDragAndDrop}"/>
    <af:collectionDropTarget dropListener="#{pageFlowScope.prodReportBackingBean.dropCollection}"
    actions="MOVE"
    modelName="rowmove"/>

    Hi,
    not sure its the reason but you have huge bummer in your configuration.
    <af:table value="#{pageFlowScope.prodReportBackingBean.prodReportTableData}"
    var="row" styleClass="AFStretchWidth" rowBandingInterval="0"
    rows="40" emptyText="No data to display." id="t1"
    partialTriggers=":::cb1" columnStretching="column:c3"
    *binding="#{pageFlowScope.prodReportBackingBean.prodReportTableBinding}"* summary="PROD TABLE">
    JSF component bindings should not be to beans in a scope larger than request to avoid stale component instances.
    Frank

  • BUG: NamedViewCriteria drag and drop as table SNAFU

    I thought I had this beat, but no: NamedViewCriteria not working when drag and dropped as filtered table.
    The gist of the problem is that my NamedViewCriteria does not filter correctly unless the read only table's "Show Filter" attribute is set to "visible".
    Pictures:
    1) Normal drag and drop of named view criteria. All items are displayed.
    http://www.williverstravels.com/JDev/Forums/Threads/2381319/Nvc4.jpg
    2) Change nothing except set "Show Filter" table attribute to "visible". Everything then works.
    http://www.williverstravels.com/JDev/Forums/Threads/2381319/Nvc6.jpg
    3) Thought I would go to the table binding, enable filtering, and enter in the text I saw in the filter box. i.e. \*:pBpKey\* , which I was hoping would allow me to set "Show Filter" to invisible. That didn't work either.
    http://www.williverstravels.com/JDev/Forums/Threads/2381319/Nvc5.jpg
    Anybody know how to get around this?
    Will

    Here's something else that is a little off, but I can see why the behavior occurs.
    The iterators of the NamedViewCriteria (the tree table) and the ViewObject iterator aren't in sync on page load. While I can see why this would be so, it would be nice (at least at first glance) if there were some way to drag and drop the NVC as a form or somehow have an NVC iterator.
    http://www.williverstravels.com/JDev/Forums/Threads/2381319/Nvc11.jpg
    http://www.williverstravels.com/JDev/Forums/Threads/2381319/Nvc12.jpg
    I came back to this and thought it a better idea to do a method call as the default activity in my task flow.
      public void markInitialRow()
        ViewObjectImpl vo = this.getFilteredBp();
        vo.setApplyViewCriteriaName("VendorsVOCriteria");
        vo.executeQuery();
      }And viola, the iterator has been filtered as well. Plus, I didn't have to go to the Tree binding and enable filtering + set BpType = V.
    Edited by: LovettWB on Apr 28, 2012 8:45 AM

  • Why does not drag and drop work?!

    Hello,
    I am trying to implent a drag and drop from a table to an icon representing a trash.
    The drop handler fails in converting the selected rows to a list:
    com.sun.el.MethodExpressionImpl@87d9c00d javax.el.ELException: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.List
    Could you help me to understand why? Below are the details.
    This is the af:table:
    <af:table var="row" rowBandingInterval="0" id="t1"
    value="#{bindings.MyView1.collectionModel}"
    rowSelection="multiple"
    columnStretching="last"
    horizontalGridVisible="false"
    verticalGridVisible="false" fetchSize="-1"
    autoHeightRows="6" width="190"
    disableColumnReordering="true">
    <af:column sortable="true" headerText="Entry" id="c1"
    align="start">
    <af:outputText value="#{row.Description}" id="ot1"/>
    </af:column>
    <af:dragSource actions="MOVE" defaultAction="MOVE"
    discriminant="delete"/>
    </af:table>
    This is the drop area:
    <af:image source="Images/empty_trash_32.png" id="i2">
    <af:dropTarget dropListener="#{backingBeanScope.DropHandlerBean.dropHandler}"
    actions="MOVE">
    <af:dataFlavor flavorClass="org.apache.myfaces.trinidad.model.RowKeySet"
    discriminant="delete"/>
    </af:dropTarget>
    </af:image>
    This is the failing listener listener (the failing point is bold):
    public DnDAction dropHandler(DropEvent dropEvent) {
    DnDAction dnda = DnDAction.NONE;
    if (dropEvent.getProposedAction() == DnDAction.MOVE) { // delete
    RichTable table = (RichTable)dropEvent.getDragComponent();
    //determine the rows that are dragged over
    Transferable t = dropEvent.getTransferable();
    //when looking for data, use the same discriminator as defined
    //on the drag source
    DataFlavor<RowKeySet> df =
    DataFlavor.getDataFlavor(RowKeySet.class, "delete");
    RowKeySet rks = t.getData(df);
    if (rks == null) {
    return DnDAction.NONE;
    Iterator iter = rks.iterator();
    while (iter.hasNext()) {
    //get next selected row key
    System.out.println(rks.toArray().length); // the number of selected rows is ok
    List key = (List)iter.next(); // here gives: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.List
    //make row current so we can access it
    table.setRowKey(key);
    //the table model represents its row by the ADF binding class,
    //which is JUCtrlHierNodeBinding
    JUCtrlHierNodeBinding rowBinding =
    (JUCtrlHierNodeBinding)table.getRowData();
    Row row = (Row)rowBinding.getRow();
    //delete row;
    row.remove();
    //activate animation
    dnda = DnDAction.MOVE;
    return dnda;
    thanks.

    I did try, I obtained this:
    java.lang.NullPointerException
    Why NullPointerException?
    I don't know if this helps, but consider that the collection model comes from a ViewObject built on three EOs with many fields, although the table only shows one column.
    This is the Iterator in my pageDef:
    <table IterBinding="MyView1Iterator" id="MyView1">
    <AttrNames>
    <Item Value="Cod1"/>
    <Item Value="Cod2"/>
    <Item Value="Cod3"/>
    <Item Value="Cod4"/>
    <Item Value="Description"/>
    <Item Value="Cod5"/>
    </AttrNames>
    </table>
    Any idea?
    I will see the Key content with the debugger.

  • Tree node to respond to the drag and drop...

    I have to be able to drag a file into a tree node to drop.
    When I drop at the tree node, the file should be shown at the right side of panel. Just like MS Window Explorer.
    Drag and drop at the table to table is working but not drag into the tree and automatically moves into the tree... is...
    Any idea would be welcomded.

    You'll need to setDragEnabled and write a TransferHandler for the JTree. See Introduction to Drag and Drop and Data Transfer.

  • Is it possible to drag and drop files into flash?

    Hi,
    Im making an upload control that
    will upload files from the user computer to the server
    Right now the user choose the files with the 'Browse for
    files dialog'. I
    want that the user will be able to drag and drop files to the
    control
    instead.
    Is it possible?
    Thanks,
    Ehud

    Ehud Banai wrote:
    > Hi,
    >
    > Im making an upload control that
    > will upload files from the user computer to the server
    > Right now the user choose the files with the 'Browse for
    files dialog'. I
    > want that the user will be able to drag and drop files
    to the control
    > instead.
    Not possible.
    Best Regards
    Urami
    <urami>
    If you want to mail me - DO NOT LAUGH AT MY ADDRESS
    </urami>

  • 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

Maybe you are looking for