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
Similar Messages
-
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,
KrisHi 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 -
Drag and Drop; What row is my drop positon (ADF 11g)
Hello!
I have a request for an drag and drop - site. First a test the technic with the examples in the web - great feature, but by my request i have one great problem.
facts:
two pannels, in all pannels are one af:table with different data controls
- in the first pannel/table (source) i defined on a column a client attribute and the attributeDragSource
- in the second pannel/table (goal) i defined on a PanelGroupLayout (surround a column) the dropTarget (inclusive dataFlavor)
I definied a session-scope class and write the methode "public DnDAction handleItemDrop(DropEvent dropEvent)"
Till then its work sucessful - the methode will be called and the transfer data can be read.
problem:
- I need the row for the drop position (for manual queuing).
- I have found the component, the id of the component, the x and y - position of the drop.
- A try with the current row of the IteratorBinding what returned the last marked row in the table, not the drop-position.
I need a key (at best the value of a row.binding.Value) of the drop position in the table.
Any idea - a simple code example?
HaraldHi!
My problem was not the correct component ... this information was already available, my problem was the correct row in the component.
In the meantime I have found a result, i not sure it´s the best, but it works.
public DnDAction handleItemDrop(DropEvent dropEvent) {
System.out.println("demo1.java - handleItemDrop");
try {
DataFlavor<Number> d = DataFlavor.getDataFlavor(Number.class);
//get drag Value
Number dragValue = dropEvent.getTransferable().getData(d);
if (dragValue == null)
return DnDAction.NONE;
else {
// get the current record
ELContext elContext = FacesContext.getCurrentInstance().getELContext();
// creating value expression with the help of the expression factory and the ELContext
System.out.println("Component/Id of the drop value:"+dropEvent.getDropComponent().getId());
System.out.println("Value of the drop value (PK of the row):"+dropEvent.getDropComponent().getValueExpression("value").getValue(elContext));
// and now work with the available data
return DnDAction.COPY;
} catch (Exception ex) {
System.out.println("item drop failed with : " + ex.getMessage());
return DnDAction.NONE;
} -
How to Drag and Drop mutliple rows in the jtable
hai
i am having a jtree ,in which i added many nodes,each nodes hav
corresponding jtable with values. now i need to drag a group of rows from a jtable of particular node in jtree to another node.
at the same time i am possible to drag and drop the single row in the same sceanrio which i mentioned above.
how to do this,can anyone pls help me regarding this
gouthamThe Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/misc/dnd.html]How to Use Drag and Drop has an example with JTable support.
-
Drag and Drop between TabNavigators
Hi,
I have two tabs. Each tab has an advanceddatagrid. Is it possible to drag and drop a row from the advanceddatagrid of Tab1 to the datagrid in Tab2. If so please help.
Thanks in advance.Can anyone please help on this?
-
Advanced Data Grid - Drag and Drop
I have a drag and drop enabled Advance Datagrid that is
populated by an arraycollection. Although it is not shown below,
each object within the arraycollection has the attribute "GroupID"
and based on that id is associated to a group using the
GroupingCollection. Dragging and dropping a row from one grouping
to the another grouping works great - i.e.if Row2 from GroupA is
dragged and dropped into GroupB.
The problem is that I need to update the database to reflect
the change as well. In order to do that I have to capture the
GroupID value that is associated with the new group - in this case
GroupB. Unfortunately, this is where I am stumped and need some
help. Any help would be greatly appreciated.
GroupA (GroupID = 1)
-- Row1
-- Row 2
GroupB (GroupID = 2)
-- Row1
private function dragHandler(e:DragEvent):void{
var dg:AdvancedDataGrid = AdvancedDataGrid(e.currentTarget);
//Get GroupID of new grouping
//Call webservice and udpate database
//Refresh datagridI haven't worked with ADG and reag/drop, but with regular DG:
var iTargetIndex:int = dg.calculateDropIndex(e);
With the index you can find the item in the dataProvider.
Tracy -
Getting a stop symbol while dragging and dropping in IE9 and IE8
Hello,
I have implemented the drag and drop of row in a table. The functionality is working fine but in IE 8 and IE9 when I drag and drop the row over another row it is showing a stop sign, though in-spite of that stop symbol the drag and drop is working fine. I am using jdev 11.1.1.6
Thanks
TarunHi,
The cursor is under the control of the drag and drop framework during drag and drop operations. So if the behavior is normal on FF and /or Chrome and you have a support contract, please file a service request asking the analysts to look at your test case. Alternatively you can try and set.
If you don't have a support contract (still we are interested to get this issue checked), please send a test case to myself (mention your OS and the exact IE versions - you find that in the Help / About). In the latter case zip the workspace, rename the zip to unzip and use the mail address in my OTN profile.
Frank
Disclaimer: Bugs I file flagged "internal" and not visible outside of Oracle. In addition I don't track bugs to provide status updates. -
MULTIPLE-ROW drag and drop between 2 ALV grids
Hi,
Can anybody help me with acheiving MULTIPLE-ROW drag and drop functionality between 2 ALV grids.hi Prakash,
Actually I'm trying to develop multiple drag and drop between 2 ALV's. To understand the events properly, I started working on this sample program where it uses 1 ALV and splits it into 2 and uses single row drag and drop between them. Now I'm making it to work for multiple drag and drop, so that I can use it on my application. This is the code which I'm working on..
*& Report Z_ALV_GRID_CONTROLS_DRAG_DROP *
REPORT z_alv_grid_controls_drag_drop.
DATA : i_ztransactions TYPE TABLE OF ztransactions
WITH HEADER LINE.
DATA : i_ztransactions2 TYPE TABLE OF ztransactions
WITH HEADER LINE.
DATA : ok_code LIKE sy-ucomm .
DATA : mcontainer TYPE REF TO cl_gui_custom_container .
DATA : mcontleft TYPE REF TO cl_gui_container .
DATA : mcontright TYPE REF TO cl_gui_container .
DATA : msplitcont TYPE REF TO
cl_gui_easy_splitter_container .
DATA : malv_left TYPE REF TO cl_gui_alv_grid .
DATA : malv_right TYPE REF TO cl_gui_alv_grid .
DATA : mrow TYPE lvc_s_row .
DATA : gt_outtab_source TYPE ztransactions.
DATA : gt_outtab_target TYPE ztransactions.
DATA : g_repid LIKE sy-repid.
DATA: gs_layout TYPE lvc_s_layo ,
g_behaviour_alv TYPE REF TO cl_dragdrop .
DATA : mlines TYPE i .
CLASS lcl_dragdropobj DEFINITION
This is the Class of Drag Drop Object .
This Object is used as a temporary storage means
of the information extracted with drag
CLASS lcl_dragdropobj DEFINITION.
PUBLIC SECTION.
DATA: i_ztransactions TYPE ztransactions ,
index TYPE i ,
original_table(5) TYPE c ,
proceed_trans(1) TYPE c .
ENDCLASS. "lcl_dragdropobj DEFINITION
DATA : mdata TYPE REF TO lcl_dragdropobj .
CLASS DND_TOOLS DEFINITION
This class contains the methods responding to the
events ONDRAG , ONDROP , ONDROPCOMPLETE
of the ALV Grid Controls
CLASS dnd_tools DEFINITION .
PUBLIC SECTION .
METHODS:handle_user_command
FOR EVENT user_command OF
cl_gui_alv_grid
IMPORTING
e_ucomm.
METHODS : handle_drag_from_left
FOR EVENT ondrag OF
cl_gui_alv_grid
IMPORTING
e_row
e_dragdropobj .
METHODS : handle_dropcomplete_from_left
FOR EVENT ondropcomplete OF
cl_gui_alv_grid
IMPORTING
e_row
e_dragdropobj .
METHODS : handle_drag_from_right
FOR EVENT ondrag OF
cl_gui_alv_grid
IMPORTING
e_row
e_dragdropobj .
METHODS : handle_dropcomplete_from_right
FOR EVENT ondropcomplete OF
cl_gui_alv_grid
IMPORTING
e_row
e_dragdropobj .
METHODS : handle_drop_to_left
FOR EVENT ondrop OF
cl_gui_alv_grid
IMPORTING
e_dragdropobj .
METHODS : handle_drop_to_right
FOR EVENT ondrop OF
cl_gui_alv_grid
IMPORTING
e_dragdropobj .
ENDCLASS . "DND_TOOLS DEFINITION
CLASS DND_TOOLS IMPLEMENTATION
CLASS dnd_tools IMPLEMENTATION .
METHOD handle_drag_from_left .
METHOD handle_user_command.
DATA: lt_rows TYPE lvc_t_row.
DATA: lt_rows TYPE lvc_t_roid.
DATA: lt_row TYPE lvc_s_roid.
DATA: mdata TYPE REF TO lcl_dragdropobj .
DATA: dragdropobj TYPE REF TO lcl_dragdropobj .
get selected row
CALL METHOD malv_left->get_selected_rows
IMPORTING
et_row_no = lt_rows.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc NE 0.
add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'Error in Flush'(500).
ENDIF.
CREATE OBJECT mdata.
LOOP AT lt_rows INTO lt_row.
mrow = lt_row .
READ TABLE i_ztransactions INDEX lt_row-row_id INTO
i_ztransactions.
MOVE i_ztransactions TO mdata->i_ztransactions .
MOVE lt_row-row_id TO mdata->index.
MOVE 'LEFT' TO mdata->original_table .
e_dragdropobj->object = mdata .
ENDLOOP.
ENDMETHOD. "handle_user_command
METHOD handle_dropcomplete_from_left .
NB : the following data object MDATA is local to
the method and contains the information from the
import parameter of the method E_DRAGDROPOBJ
DATA : mdata TYPE REF TO lcl_dragdropobj .
DATA: lt_rows TYPE lvc_t_roid.
DATA: lt_row TYPE lvc_s_roid.
CALL METHOD malv_left->get_selected_rows
IMPORTING
et_row_no = lt_rows.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc NE 0.
add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'Error in Flush'(500).
ENDIF.
LOOP AT lt_rows INTO lt_row.
mdata ?= e_dragdropobj->object .
CHECK mdata->proceed_trans = 'X' .
mrow = mdata->index.
DELETE i_ztransactions INDEX mrow .
APPEND mdata->i_ztransactions TO i_ztransactions2 .
SORT i_ztransactions2 BY kunnr belnr .
DELETE i_ztransactions2 WHERE kunnr IS INITIAL .
DESCRIBE TABLE i_ztransactions LINES mlines .
IF mlines EQ 0 .
CLEAR i_ztransactions .
APPEND i_ztransactions TO i_ztransactions .
ENDIF .
ENDLOOP.
CALL METHOD malv_left->refresh_table_display.
CALL METHOD malv_right->refresh_table_display.
ENDMETHOD . "HANDLE_DROPCOMPLETE_FROM_LEFT
METHOD handle_drag_from_right.
mrow = e_row-index .
READ TABLE i_ztransactions2 INDEX mrow INTO
i_ztransactions2 .
CREATE OBJECT mdata .
MOVE i_ztransactions2 TO mdata->i_ztransactions .
MOVE mrow TO mdata->index .
MOVE 'RIGHT' TO mdata->original_table .
e_dragdropobj->object = mdata .
ENDMETHOD . "HANDLE_DRAG_FROM_RIGHT
METHOD handle_dropcomplete_from_right .
DATA : mdata TYPE REF TO lcl_dragdropobj .
mdata ?= e_dragdropobj->object .
CHECK mdata->proceed_trans = 'X' .
mrow = mdata->index .
DELETE i_ztransactions2 INDEX mrow .
APPEND mdata->i_ztransactions TO i_ztransactions .
SORT i_ztransactions BY kunnr belnr .
DELETE i_ztransactions WHERE kunnr IS INITIAL .
DESCRIBE TABLE i_ztransactions2 LINES mlines .
IF mlines EQ 0 .
CLEAR i_ztransactions2 .
APPEND i_ztransactions2 TO i_ztransactions2 .
ENDIF .
CALL METHOD malv_left->refresh_table_display.
CALL METHOD malv_right->refresh_table_display.
ENDMETHOD . "HANDLE_DROPCOMPLETE_FROM_RIGHT
METHOD handle_drop_to_left .
DATA : mdata TYPE REF TO lcl_dragdropobj .
mdata ?= e_dragdropobj->object .
IF mdata->original_table = 'RIGHT' .
mdata->proceed_trans = 'X' .
ELSE .
mdata->proceed_trans = ' ' .
ENDIF .
e_dragdropobj->object = mdata .
ENDMETHOD . "HANDLE_DROP_TO_LEFT
METHOD handle_drop_to_right .
DATA : mdata TYPE REF TO lcl_dragdropobj .
DATA: lt_rows TYPE lvc_t_roid.
DATA: lt_row TYPE lvc_s_roid.
CALL METHOD malv_left->get_selected_rows
IMPORTING
et_row_no = lt_rows.
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc NE 0.
add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = g_repid
txt2 = sy-subrc
txt1 = 'Error in Flush'(500).
ENDIF.
LOOP AT lt_rows INTO lt_row.
mdata ?= e_dragdropobj->object .
IF mdata->original_table = 'LEFT' .
mdata->proceed_trans = 'X' .
ELSE .
mdata->proceed_trans = ' ' .
ENDIF .
e_dragdropobj->object = mdata .
ENDLOOP.
ENDMETHOD . "HANDLE_DROP_TO_RIGHT
ENDCLASS . "DND_TOOLS IMPLEMENTATION
DATA : mlistener TYPE REF TO dnd_tools .
======================================================
START OF SELECTION
======================================================
START-OF-SELECTION .
PERFORM get_data .
CALL SCREEN 100 .
The screen 100 has the custom control MCONTAINER and
on the flow logic has the following modules :
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
MODULE PREPARE_SCREEN .
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
(Off course not commented out in the real flow logic)
FORM GET_DATA *
FOR THIS EXAMPLE THE DATA SELECTION IS HARD CODED
FORM get_data .
CLEAR : i_ztransactions , i_ztransactions[] .
i_ztransactions-mandt = sy-mandt .
i_ztransactions-waers = 'EUR ' .
i_ztransactions-kunnr = '0000000001' .
i_ztransactions-belnr = '0000000001' .
i_ztransactions-bldat = '20030101' .
i_ztransactions-dmbtr = '1000' .
APPEND i_ztransactions .
i_ztransactions-belnr = '0000000002' .
i_ztransactions-bldat = '20030202' .
i_ztransactions-dmbtr = '1010' .
APPEND i_ztransactions .
i_ztransactions-belnr = '0000000003' .
i_ztransactions-bldat = '20030323' .
i_ztransactions-dmbtr = '1020' .
APPEND i_ztransactions .
i_ztransactions-belnr = '0000000004' .
i_ztransactions-bldat = '20030404' .
i_ztransactions-dmbtr = '1030' .
APPEND i_ztransactions .
i_ztransactions-belnr = '0000000005' .
i_ztransactions-bldat = '20030505' .
i_ztransactions-dmbtr = '1040' .
APPEND i_ztransactions .
i_ztransactions-belnr = '0000000006' .
i_ztransactions-bldat = '20030606' .
i_ztransactions-dmbtr = '1050' .
APPEND i_ztransactions .
i_ztransactions-belnr = '0000000007' .
i_ztransactions-bldat = '20030707' .
i_ztransactions-dmbtr = '1060' .
APPEND i_ztransactions .
i_ztransactions-belnr = '0000000008' .
i_ztransactions-bldat = '20030808' .
i_ztransactions-dmbtr = '1070' .
APPEND i_ztransactions .
i_ztransactions-belnr = '0000000009' .
i_ztransactions-bldat = '20030909' .
i_ztransactions-dmbtr = '1080' .
APPEND i_ztransactions .
i_ztransactions-belnr = '0000000010' .
i_ztransactions-bldat = '20031010' .
i_ztransactions-dmbtr = '1090' .
APPEND i_ztransactions .
CLEAR : i_ztransactions2 , i_ztransactions2[] .
APPEND i_ztransactions2 .
ENDFORM . "GET_DATA
*& Module STATUS_0100 OUTPUT
The PF STATUS STATUS100 called from the module below,
has on the Standard toolbar the buttons
BACK , EXIT and CANCEL .
These buttons are provided with function code = 'EXIT'
MODULE status_0100 OUTPUT.
SET TITLEBAR 'TITLEDRAGDROP' .
SET PF-STATUS 'STATUS100'.
ENDMODULE. " STATUS_0100 OUTPUT
Module USER_COMMAND_0100 INPUT
The following module checks the User Command and ends
the program
MODULE user_command_0100 INPUT.
IF ok_code = 'EXIT' .
CLEAR : mcontainer ,
mcontleft ,
mcontright ,
msplitcont ,
malv_left ,
malv_right .
LEAVE TO SCREEN 0 .
ENDIF .
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module PREPARE_SCREEN OUTPUT
MODULE prepare_screen OUTPUT.
IF mcontainer IS INITIAL .
CREATE OBJECT mcontainer
EXPORTING
container_name = 'MCONTAINER' .
CREATE OBJECT msplitcont
EXPORTING
parent = mcontainer
orientation = 1 .
mcontleft = msplitcont->top_left_container .
mcontright = msplitcont->bottom_right_container .
CREATE OBJECT malv_left
EXPORTING i_parent = mcontleft .
gs_layout-sel_mode = 'D'.
CREATE OBJECT malv_right
EXPORTING i_parent = mcontright .
gs_layout-sel_mode = 'D'.
PERFORM set_layout_capable_of_drag_dro
USING 'X' 'X' .
CALL METHOD malv_left->set_table_for_first_display
EXPORTING
i_structure_name = 'ZTRANSACTIONS'
is_layout = gs_layout
CHANGING
it_outtab = i_ztransactions[].
CALL METHOD malv_right->set_table_for_first_display
EXPORTING
i_structure_name = 'ZTRANSACTIONS'
is_layout = gs_layout
CHANGING
it_outtab = i_ztransactions2[].
CREATE OBJECT mlistener .
CALL METHOD malv_left->set_toolbar_interactive.
SET HANDLER mlistener->handle_drag_from_left
FOR malv_left .
SET HANDLER mlistener->handle_dropcomplete_from_left
FOR malv_left .
SET HANDLER mlistener->handle_drag_from_right
FOR malv_right.
SET HANDLER mlistener->handle_dropcomplete_from_right
FOR malv_right .
SET HANDLER mlistener->handle_drop_to_right
FOR malv_right .
SET HANDLER mlistener->handle_drop_to_left
FOR malv_left .
ENDIF .
ENDMODULE. " PREPARE_SCREEN OUTPUT
Form SET_LAYOUT_CAPABLE_OF_DRAG_DRO
Definition of a Drag & Drop behaviour for the ALV
grid
FORM set_layout_capable_of_drag_dro USING drag drop.
DATA : effect TYPE i ,
handle_alv TYPE i .
CREATE OBJECT g_behaviour_alv.
effect = cl_dragdrop=>move + cl_dragdrop=>copy .
CALL METHOD g_behaviour_alv->add
EXPORTING
flavor = 'Line'
dragsrc = drag
droptarget = drop
effect = effect.
CALL METHOD g_behaviour_alv->get_handle
IMPORTING
handle = handle_alv.
gs_layout-s_dragdrop-row_ddid = handle_alv.
ENDFORM. " SET_LAYOUT_CAPABLE_OF_DRAG_DRO -
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,
ArunOnce 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 -
Drag and Drop in Web dynpro ALV
I have a requirement in wda where I am supposed to select few records from source table and drop it in target table. The dropped records should be inserted at the right index /destination, dropped at. I see SAP examples but they are all associated with tables and none of them are ALV grids.
Could anyone of you please share steps or code to achieve drap and drop in SALV_WD_TABLE.Hi Kiran,
I am in 703 so drag and drop should work good .
I am required to drag and drop records from ALV1(bottom) to ALV2(top) (and not table UI). I could create drag source but somehow the whole piece is not working .
Drop target field is dynamic. Wherever the user drops, the data in ALV2 should be inserted/updated exactly at that spot/cell . Here, I am not sure how to fill target row/field details runtime.
Just to simplify, I am doing 1 column move. Hard coded the target field ‘AUFNR3’ but still than My “On drop event” is not triggering. I always see a prohibitory sign when trying to move the ghost image across areas as if the column is not defined as DropTarget.
My code looks something like this:
Drop from AUFNR of ALV2 to AUFNR3 of ALV1 :
In WDDOINIT:*...get alv models
lr_dd_alv1 ?= wd_this->r_model_calen.
lr_dd_alv2 ?= wd_this->r_model_operlist.
l_tags_alv2 = 'AUFNR'.* create or enable/disable alvs as drag source
IF NOT lr_dd_alv2->r_drag_source_info IS BOUND.
lr_dd_alv2->create_drag_source_info(
EXPORTING
data = 'ALV2'
tags = l_tags_alv2 "'alv2'
enabled = abap_true ).
ELSE.
lr_dd_alv2->r_drag_source_info->set_enabled( abap_true ).
ENDIF.
l_tags_alv1 = 'AUFNR3'.
lr_dd_alv1->set_drop_row_name_fieldname( 'AUFNR3' ).
lr_dd_alv1->set_drop_row_name( ' ' ).
lr_dd_alv1->create_drop_row_target_info(
EXPORTING
id = 'ALV1'
name = 'alv1'
tags = l_tags_alv1
enabled = abap_true ).
In drop event: I am trying to fetch the selected row and update the ALV2 accordingly
lr_element = lr_node->get_lead_selection( ).
IF lr_element IS BOUND.
lr_element->get_attribute(
EXPORTING
name = 'AUFNR'
IMPORTING
value = l_value ).
ENDIF.
lo_nd_nd_calendar = wd_context->get_child_node( name = wd_this->wdctx_nd_calendar ).
lo_nd_nd_calendar->bind_table( new_items = lt_nd_calendar set_initial_elements = abap_true ).
ENDMETHOD.
Any help is greatly appreciated.. -
Multi-row "Drag and Drop" works for some users, not others
Background: We are working on Win7 SP1 clients, Project Prof. 2010, SP2
A couple of users have reported that they cannot move ("drag") multiple selected rows in a task sheet, only a single row at a time. Other MS Project users around them (and myself) can move multiple rows with the "Drag"
feature. "Drag and Drop" is selected in the "Options/Advanced" section of both their local global template and the Enterprise Global.
To my knowledge, the multiple row selections contain no collapsed summary tasks, in case that might be an issue.
I'm suspecting some Windows setting is amiss on the offending clients, but wanted to see if anyone else had seen this behavior before in Project Prof. 2010.
Thanks!
JTC
JAckson T. Cole, PMP, MCITPThanks for the response, Shiva!
User community is on MS Project 2010 (14.0.7011.1000) SP2, MSO (14.0.7128.1000)
To reproduce the problem, MS Project user will select multiple task rows by selecting first row, then holding MB1, and "sliding" to the last row desired. The problem manifests itself by NOT turning the cursor into the "four-arrow cross"
after selection is accomplished. If only one row is selected, the ability to move that row alone is available.
Again, only a couple of users (that have called me!) are seeing it. Their officemates are not having an issue.
FYI ...
JTC
JAckson T. Cole, PMP, MCITP -
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 -
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,
KKYes 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 Characteristic to Rows in QD
I am trying to drag and drop ship-to characteristic from infoprovider pane to the rows pane in query designer but the system is restricting me from doing that, but I can move other characterisitcs from other dimensions and drop them in the rows area. Only ship-to is the problem. Have I accidentally pressed some key or what? The "ship-to party" was provided as filter in the characteristics restriction section as a variable with manual input, so I removed it as a filter thinking that might be causing some problems but still no success. Any help would be appreciated.
LMAO..You are so right, I knew it would be something simple, but it usually takes an hour or two for my brain to warm up before I can start thinking and functioning.
Thanks, bro..points awarded! -
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
Maybe you are looking for
-
When I go to a web page, that page appears upper left, filling only half of my screen top and bottom. Each time I have to go to the menu bar View and go to full page. How can I get the web pages to display in the full screen automatically??? This j
-
Opening dbs thru button events, help, i`m a newbie..
i have the following fn for opening the db public static void main(String args[]) throws Exception new login(new javax.swing.JFrame(), true).show(); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); open(); select(); static void open() throws SQLExcepti
-
File upload applet recommendations
Greetings, We are building a large-scale extranet that will heavily involve user uploads of various files, including potentially large videos. In the past we've just used file fields and handled the stream with cffile and cfftp. However, we are think
-
Fatal error with installation of je22 con. arch. beta impl.
In step 6 it says that classpath must start with connector.jar and welogic60J2eeConnector.jar. But if I do that then the following fatal error occurs. But if the jar files are after weblogic_sp.jar and weblogic
-
I am a student and over the christmas break I up-dated my computer. Ever since my mac is running weird, especially my preview app which I use to do all of my notes. My macbook pro is little old 2010 but was running just fine before this. I just want