D&D Behavior for all Rows/Columns

Use

You can use this process if you want to define a standard Drag & Drop behavior for all rows or columns. For example, if attribute dragsource is set in the behavior, you can link all rows or columns to objects that have set attribute droptarget and use the same flavor.

Although you can use this method to define an identical behavior for all rows, you can determine in events OnDrop and OnDropGetFlavor if you want to cancel the Drag & Drop operation. To do this, you use the data object passed and the flavor as a basis. In the data object, you normally store the data of the row dragged.

Process

  1. Define the layout structure of type LVC_S_LAYO.

  2. Define your Drag & Drop behavior and get the associated handle using method get_handle of class cl_dragdrop.

  3. Assign the handle to field s_dragdrop-row_ddid or s_dragdrop-col_ddid of the layout structure.

  4. Pass the layout structure with method set_table_for_first_display.

Result

Each row or column can be dragged by the user or appears as the target for any Drag & Drop operation.