SAP Data Object 

The SAP Data Object is a special object for purposes of data transport. This object is used in drag and drop and clipboard operations. The SAP Data Object implements an automation and an IDataObject interface. The IDataObject interface is a standard OLE interface for data object manipulation. The automation interface displays the following methods:

Name

Parameters

Return Type

Description

GetData

Long

Variant

cfFormat

vaData

void

Retrieves data from the data object in the specified format

SetData

Long

Variant

cfFormat

vaData

void

Stores data in the data object in the specified format

IsFormatAvailable

Long

cfFormat

Boolean

Returns TRUE if the data object contains data in the specified format

 

SetData may specify a format which is not initially cached in the data object. Since the data object does not interpret the data in any way, the data may be of any clipboard format. The variant data type must be any data type which is transportable to other processes. Therefore, object may not be stored in the data object.

Valid formats are: char, short, long, String, Date, Time, Boolean and safe arrays of these types.

Sub DragSourceFill(DataObject As Object)

Dim cfFormat As Long

Dim Data As String

 

cfFormat = RegisterClipboardFormat( " MyClipFormat " );

Data = " This is my personal string "

DataObject.SetData(cfFormat,Data)

Sub End

 

Sub Drop(DataObject As Object)

Dim cfFormat As Long

Dim Data As String

 

cfFormat = RegisterClipboardFormat( " MyClipFormat " );

if DataObject.IsFormatAvailable(cfFormat) then

DataObject.GetData(cfFormat,Data)

MsgBox(Data)

end if

Sub End