Show TOC Start of Content Area

Procedure documentation Implementing Drag and Drop  Locate the document in its SAP Library structure

The possibility to drag and drop objects is defined for different use cases, for example:

●      Browse and collect pattern: The user can select one or more data values and drag them to a specific position at another UI element. This is normally used to move or copy.

In this case the following UI elements are available: ItemListBox, Table, Tree,

●      Generic drag and drop: The user drags a UI element that represents a business object and drops it onto another business object, either also representing a business object or . In this case also the Image and the GridLayout can be used. In this case you can use the DropTarget UI element as a wrapping UI element.

●      Enabling runtime authoring. To enable the user to rearrange different screen areas, you can define Image, Caption or SectionHeader as drag handle. For this use case an in-place editing option also can be defined using the displayAsText property e. g. of an InputField.

Note

To ensure accessibility, you always have to implement an option that the user can fulfill the respective task without drag and drop.

What does the user do?

The drag and drop function in Web Dynpro is designed as follows:

...

       1.      The user drags either a UI element (e. g. an Image) or data taken from a Table, a Tree or a ItemListBox

       2.      As long as the user holds the mouse key pressed, a ghost is displayed that indicates his action.

If the user moves the mouse over a UI element that is defined as a drop target, the UI element indicates this either by displaying a dotted line around the container or by displaying a bold line between the respective rows. As long as the user moves the ghost over areas, that are not defined as drop targets, a prohibitory symbol is displayed additionally.

       3.      When the user drops this ghost, the onDrop event of the respective UI element is triggered. The application developer is now responsible to move or copy the respective data or to implement the necessary steps.

This graphic is explained in the accompanying text

Procedure

This example describes the basic steps to implement a browse and collect pattern.

Creating the UI elements

...

       1.      To define a drag source, insert a DragSourceInfo into an ItemListBox.

       2.      To define a drop target, insert a DropTargetInfo into the other ItemListBox.

An example how this can be implemented, is displayed below:

This graphic is explained in the accompanying text

       3.      To specify the drag source and its corresponding drop target, enter the same string to the tagproperty of the relevant DragSourceInfo and DropTargetInfo elements.

       4.      Map the parameters of the respective onDrop event accordingly. More information: Mapping Event Parameters to Action Parameters

 

End of Content Area