Show TOC

DataProvider ObjectLocate this document in the navigation structure

Use

DataProvider Object

The DataProvider object at the client side manages the data in format objects that you can access using the DataProvider.Formats collection. Every format object is either described by its MIME type and the reference to a data object or by a URL for providing the data.

The number of format objects or DataProvider objects depends on the data:

  • If multiple logically-identical data objects in different formats are needed at the client side then there must be multiple format objects.

    An example for this is a text that appears as both an RTF text and a WinWord document.

  • If multiple data objects that are not logically-identical are needed at the client side, then you have to use multiple DataProvider objects.

    This is not a problem as it only requires a small amount of runtime to create a DataProvider object.

Creating New Format Objects

You can create new format objects in the following way:

  • Automatically using format conversions

  • Explicitly using assignments

    For explicit assignments, the user must ensure that the data is logically identical.

    Caution

    Since practically any data object can be found in a format object, you cannot assume that multiple format objects in a DataProvider object always contain the same data because not every data object provides DataChange events.

    Since it would be too costly to perform a conversion after every data change, it is only ensured that format objects contain identical data directly after calling DataProvider.Formats.ConvertFormat.

Data Access

You can access the data as follows:

  • Directly using the format object

  • Using methods of the DataProvider object by specifying the format required (MIME type)

    Caution

    SAP always recommends that you access data using the DataProvider object.

    The DataProvider object and format objexts contain further information that is described in further detail in the interface documentation.

Data is either obtained using a URL or by assigning the data directly. If data is obtained using a URL, you can either create a new format object or call the DataProvider.SetDataFromUrl method. You can also specify using the MIME type of the format object which MIME types are relevant for you.

You can request the data

  • synchronously or

  • asynchronously

    as required. If the data is obtained asynchronously, the user of the data is informed about DataProvider object events by the request status.

Data is obtained for the user transparently using http:, ftp:, and file: as well as from the LocalTables object. If you address data from the LocalTables object, you first have to export data from the ABAP program using the DP_CREATE_URL function module. The data is stored in the main memory of the client.

Sending Data

You can send data to the following using the DataProvider object:

  • A server

    Use the method SaveDataToUrl in the DataProvider object or format object for this. Take care of any write-protection issues.

  • An ABAP program

    For this, enter a URL that does not start with http:, ftp:, or file:. If you do not enter a URL, then a unique URL is generated ("sapr3://<GUID>").

    The ABAP program can access the data addressed using this URL with the function modules DP_GET_TABLE, DP_GET_STREAM, or DP_GET_OBJECT.

Retrieving Data Consistently

To make data retireval more consistent, data objects that is obtained from the DataProvider object is always addressed by a URL with a unique name. At the moment, http:, ftp:, and sapr3: are supported (sapr3: refers to tables that were obtained from an SAP system using RFC).

To standardize the processing of the data object obtained at the client side by the DataProvider object as much as possible, all data objects must be assigned to MIME types. Therefore, the DataProvider object only accepts data with a MIME type. You either enter the MIME type when setting the data or it is determined from the HTTP ResponseHeader or the MIME type specified in the ABAP program. MIME type application/x-unknown is currently used for the namespaces ftp: and file:. Data to be transferred from an ABAP program must be sent with a MIME type. The MIME type application/x-r3table is used for typed internal tables.

You can also assign data to the SAP Data Provider directly. For this you do not use a URL, but assign the data using media (interfaces) that are recognized by the DataProvider object. You always have to specify the MIME type to assign data directly.

Note

If you use typed internal tables, do not use the MIME type application/x-r3table since special function modules are provided for such tables. These function modules create and transfer additional information that is required for this MIME type.

Displaying Data Consistently

The SAP Data Provider maps data objects in different forms that are called Media.

A medium represents a specific memory medium (or a specific interface); format and content remain unchanged. The media used are usually standard COM interfaces, but SAP-specific interfaces are also used for typed tables. It is also possible to access ALO DB rowsets.

The DataProvider object supports the following media:

Medium

Data display

Note

Stream

IStream interface

Corresponds to a byte stream with cursor

LockBytes

ILockBytes interface

Corresponds to a byte stream without cursor

Object

IUnknown interface

Corresponds to a COM object

AutomationObject

IDispatch interface

Corresponds to an OLE Automation object

Caution

The AutomationObject is very dependent on the MIME type. The methods and properties of the object displayed using IDispatch often vary greatly for every format object. The standard implementation only supports AutomationObject for OLE documents of an OLE Automation Server. This depends on the medium conversion object for other types. You can find information about which possibilities are offered by an Automation Object of a conversion in the documentation for the conversion object.

R3Table

Internal table Data access using the ISAPDPR3Table interface. This interface gets the ISAPrfcITab interface and rowset interfaces that are required for the OLE DB.

To access the OLE DB rowset, use the ISAPrfcITab interface or convert the format objects from application/x-r3table to application/x-rowset. The conversion is simpler and does not require a copy of the data. In Visual Basic this is the only way to access a RecordSet.

STGMEDIUM

STGMEDIUM structure

This structure is not an interface but can be managed using reference counting.

R3TableAutoObj

IDispatch interface

This automation interface has the methods of the ISAPDPR3Table interface.

Data

VARIANT

Always gets a copy of the data.

Caution

Data depends on the MIME type. The data saved in VARIANT normally varies greatly from format object to format object.

File

The data can be written to or read from a file.

You must use the same media for assigning data directly:

  • Since you only need to assign a reference, it is simple to execute assignments with the majority of media.

  • For the Data and File media you have to create a copy fo the data in the format object of the DataProvider object.

    Caution

    Not all media are supported for a format. Aside from this, the standard conversions do not support the conversion of all media. You can find more information about the media that are available for a format in the documentation for the medium conversion object.