Skip to Content
0
Apr 20, 2007 at 08:50 AM

Drag From cl_column_tree_model To cl_gui_alv_grid Is not Working ???

222 Views

Hi,

I have building a program that will have one split screen and one of them has cl_column_tree_mode at top, and the other has cl_gui_alv_grid at bottom.

I can Drag And Drop Lines From ALV GRID to TREE and i can use ONDRAG event of ALVGRID, DROP event of TREE Control and ONDROPCOMPLETE event of ALVGRID.

But when i try to reverse it as like that Drag From TREE to ALVGRID, just DRAG event of TREE is triggering.

I have implemented end registered ONDROP event for ALVGRID but it is no triggering.

Have i something which missed ? Some of code at the above.

*****************CODE****************************************

*I created Application Ocject, Custom Container and Spliiter in here
.
.
.
**       Definition of drag drop behaviour
    create object behaviour_top.
    call method behaviour_top->add
        exporting
              flavor = 'LINEFROM' "I dont know where i can use this
              dragsrc = 'X'
              droptarget = 'X'
              effect = cl_dragdrop=>move.
    call method behaviour_top->add
         exporting
               flavor = 'LINETO'   "I dont know where i can use this
               dragsrc = 'X'
               droptarget = 'X'
               effect = cl_dragdrop=>move.

    call method behaviour_top->get_handle
         importing handle = handle_top. "I am not sure that i can use this handle for both TREE Nodes and ALV Rows, But i am using it for both.
.
.
.
.
************************************************************************
******************************   TREE   ********************************
************************************************************************
*   CREATE TREE
    ls_treemhhdr-heading = 'Nakliye ve Makaralar'.
    ls_treemhhdr-width   =  35.

    create object gref_column_tree
     exporting
     node_selection_mode   = cl_column_tree_model=>node_sel_mode_single
     item_selection        = space
     hierarchy_column_name = 'NUMBER'
     hierarchy_header      = ls_treemhhdr.

    call method gref_column_tree->create_tree_control
      exporting
        parent                       = container_1    .

*   Events for tree control
    set handler g_application->handle_tree_drag for gref_column_tree.
    set handler g_application->handle_tree_drop for gref_column_tree.

*   Build TREE
    perform build_tree using gref_column_tree. "I use HANDLE_TOP in this when creating nodes.
************************************************************************
******************************   TREE   ********************************
************************************************************************

************************************************************************
****************************  ALV GRID  ********************************
************************************************************************
*   create ALV Grid
    create object alv_grid
                  exporting i_parent = container_2.

*   Events alv control
    set handler g_application->handle_alv_drag for alv_grid.
    set handler g_application->handle_alv_drop for alv_grid.
    set handler g_application->handle_alv_drop_complete for alv_grid.

    gs_layout-grid_title = 'İs Listesi'.
    gs_layout-s_dragdrop-row_ddid = handle_top. "I think this is a important thing

    call method alv_grid->set_table_for_first_display
         exporting is_layout        = gs_layout
         changing  it_fieldcatalog  = gt_fieldcat
                   it_outtab        = i_tabout[].
************************************************************************
****************************  ALV GRID  ********************************
************************************************************************
.
.
.
.
*I have implemented all methods for this class, it hink its not important to see *which code its has, important is why its not triggering.
class lcl_application definition.
  public section.
    data: next_node_key type i.
    methods:
*   ALV EVENTS
    handle_alv_drag for event ondrag of cl_gui_alv_grid
        importing e_row e_column e_dragdropobj,
    handle_alv_drop for event  ondrop of cl_gui_alv_grid
        importing e_row e_column es_row_no e_dragdropobj,
    handle_alv_drop_complete for event ondropcomplete of cl_gui_alv_grid
        importing e_row e_column e_dragdropobj,
*   TREE EVENTS
    handle_tree_drag for event drag  of cl_column_tree_model
        importing node_key item_name drag_drop_object,
    handle_tree_drop for event drop  of cl_column_tree_model
        importing node_key drag_drop_object,
    handle_tree_drop_complete for event drop_complete of cl_column_tree_model
        importing node_key ITEM_NAME drag_drop_object.
endclass.