Drag and Drop

Use

With drag and drop a user can select UI elements from a UI area (source), drag them from the source, and drop them into another UI element area (target). Source and target can be either the same UI element or two different UI elements. The ALV can be used as the source and the target of a drag and drop operation.

Note that, in ALV, you cannot drop objects between rows, only onto an existing row.

More general information on Drag and Drop in tables in Web Dynpro ABAP :

Drag and Drop

See also the system documentation for CL_SALV_WD_CONFIG_TABLE and IF_SALV_DRAG_AND_DROP.

ALV as a DragSource

You can enable the ALV as DragSource by adding a DragSourceInfo to the ALV. The enduser is then able to drag the selected rows to a drop target. Note that every row selected is dragged.

You can make the following settings:

  • Create a DragSourceInfo

  • Get the DragSourceInfo

  • Set and get information about a DragSourceInfo

  • Delete the DragSourceInfo

Create a DragSourceInfo

To generate a DragSourceInfo, you use the methods of interface class IF_SALV_WD_DRAG_AND_DROP (implementing class CL_SALV_WD_CONFIG_TABLE).

Function

Method

Create DragSourceInfo

CREATE_DRAG_SOURCE_INFO

Get the DragSourceInfo

To be able to modify properties of the DragSourceInfo, you must first call the GET_DRAG_SOURCE_INFO method of interface class IF_SALV_WD_DRAG_AND_DROP (implementing class CL_SALV_WD_CONFIG_TABLE).

Function

Method

Get the DragSourceInfo

GET_DRAG_SOURCE_INFO

Set and get information about a DragSourceInfo

A DragSourceInfo has the following properties:

  • DATA

    When an object is dropped, an event is triggered and DragSourceInfo.data is passed as the event parameter DATA. In the case of ALV for Web Dynpro ABAP, the application must specify at this point the ALV from which the object was dropped. The application can then ask the ALV context of that ALV for the current selections in the implementation of the ON_DROP event in the DropTarget.

  • ENABLED

    The enabled flag enables or disables the DragSourceInfo. That way you can specify whether the ALV can be used for a drag operation.

  • TAGS

    To define which drag source can be moved to which drag target, specify the corresponding string (same name) in the tag property of the relevant DragSourceInfo and DropTargetInfo. You can also use multiple tags. You separate the tags with blank spaces. The system does not differentiate between uppercase and lowercase letters in tags. You can use an asterisk (*) as a wild card at the end of the tags for example, grid*. You may not use the following characters: Colon (:) Comma (,) Semicolon (;) Backslash (\) Slash (/) Point (.)

For retrieving and setting properties of the DragSourceInfo, you use methods from interface class IF_SALV_WD_DRAG_SOURCE_INFO.

Function

Method

Returns the value for data transport

GET_DATA

Returns if the DragSourceInfo is enabled

GET_ENABLED

Returns the tags of the DragSourceInfo

GET_TAGS

Sets the value for data transport

SET_DATA

Sets the enabled flag of the DragSourceInfo

SET_ENABLED

Sets the tags of the DragSourceInfo

SET_TAGS

Delete the DragSourceInfo

To delete the DragSourceInfo you previously defined, you use the method of interface class IF_SALV_WD_DRAG_AND_DROP (implementing class CL_SALV_WD_CONFIG_TABLE).

Function

Method

Delete the DragSourceInfo

DELETE_DRAG_SOURCE_INFO

ALV as a DropTarget

You can enable the ALV as Drop Target by adding one or more DropTargetInfos to the ALV.

The ALV supports only dropping items on a table row.

The enduser is then able to drop an item onto a row of an ALV.

You can make the following settings:

  • Create a Row-DropTargetInfo

  • Get Row-DropTargetInfos

  • Set and get information about a Row-DropTargetInfo

  • Delete Row-DropTargetInfo

Create a Row-DropTargetInfo

To generate a RowDropTargetInfo, you use the methods of interface class IF_SALV_WD_DRAG_AND_DROP (implementing class CL_SALV_WD_CONFIG_TABLE).

Function

Method

Create a Row-DropTargetInfo

CREATE_DROP_ROW_TARGET_INFO

Get Row-DropTargetInfos

To be able to modify properties of a Row-DropTargetInfo, you must first call the get method of interface class IF_SALV_WD_DRAG_AND_DROP (implementing class CL_SALV_WD_CONFIG_TABLE).

Function

Method

Get Row-DropTargetInfos

GET_DROP_ROW_TARGET_INFO

Get all Row-DropTargetInfos

GET_DROP_ROW_TARGET_INFOS

Set and get information about a Row-DropTargetInfo

A DropTargetInfo has the following properties:

  • ENABLED

    The enabled flag enables or disables the Row-DropTargetInfo. That way you can specify whether the ALV can make use of this Row-DropTargetInfo for a drop operation.

  • NAME

    Name of a Row-DropTargetInfo.

  • TAGS

    To define which drag source can be moved to which drag target, specify the corresponding string (same name) in the tag property of the relevant DragSourceInfo and DropTargetInfo. You can also use multiple tags. You separate the tags with blank spaces. The system does not differentiate between uppercase and lowercase letters in tags. You can use an asterisk (*) as a wild card at the end of the tags for example, grid*. You may not use the following characters: Colon (:) Comma (,) Semicolon (;) Backslash (\) Slash (/) Point (.)

For retrieving and setting properties of the DragSourceInfo, you use methods from interface class IF_SALV_WD_DRAG_SOURCE_INFO.

Function

Method

Returns if the DropTargetInfo is enabled

GET_ENABLED

Returns the name of a DropTargetInfo

GET_NAME

Returns the tags of the DropTargetInfo

GET_TAGS

Sets the enabled flag of a DropTargetIfno

SET_ENABLED

Sets the name of a DropTargetInfo

SET_NAME

Sets the tags of the DropTargetInfo

SET_TAGS

Specifying which Row-DropTargetInfos can be used for dropping onto rows

You specify which DropTargetInfo can be used for which row in the ALV as follows: You either define exactly one DropTargetInfo in the method SET_DROP_ROW_NAME; or you tell the ALV the fieldname, in which the name of each DropTargetInfo for each row in the ALV is stored.

Function

Method

Returns the name of the Row-DropTargetInfo for dropping on a row

GET_DROP_ROW_NAME

Returns the name of the field that manages the name of the Row-DropTargetInfo

GET_DROP_ROW_NAME_FIELDNAME

Specifies the name of the Row-DropTargetInfo to be used

SET_DROP_ROW_NAME

Specifies the field that manages the name of the Row-DropTargetInfo

SET_DROP_ROW_NAME_FIELDNAME

Deleting Row-DropTargetInfos

To delete the Row-DropTargetInfos you previously defined, you use the methods of interface class IF_SALV_WD_DRAG_AND_DROP (implementing class CL_SALV_WD_CONFIG_TABLE).

Function

Method

Delete Row-DropTargetInfo

DELETE_DRAG_SOURCE_INFO

Delete all Row-DropTargetInfos

DELETE_DRAG_SOURCE_INFOS