OData Types

SAPUI5 supports simple types that are used together with OData models.

These types support OData Version 2.0 and/or Version 4.0 including relevant property facets as constraints. See the type’s documentation for detailed information about which OData versions, constraints and format options are supported.

Supported EDM Types

OData Type

SAPUI5 Type Implementation

Edm.Boolean

sap.ui.model.odata.type.Boolean

For more information, see sap.ui.model.odata.type.Boolean

Edm.Byte

sap.ui.model.odata.type.Byte

For more information, see sap.ui.model.odata.type.Byte

Edm.Date

sap.ui.model.odata.type.Date

For more information, see sap.ui.model.odata.type.Date

Edm.DateTime

sap.ui.model.odata.type.DateTime

For more information, see sap.ui.model.odata.type.DateTime

Edm.DateTimeOffset

sap.ui.model.odata.type.DateTimeOffset

For more information, see sap.ui.model.odata.type.DateTimeOffset

Edm.Decimal

sap.ui.model.odata.type.Decimal

For more information, see sap.ui.model.odata.type.Decimal

Edm.Double

sap.ui.model.odata.type.Double

For more information, see sap.ui.model.odata.type.Double

Edm.Guid

sap.ui.model.odata.type.Guid

For more information, see sap.ui.model.odata.type.Guid

Edm.Int16

sap.ui.model.odata.type.Int16

For more information, see sap.ui.model.odata.type.Int16

Edm.Int32

sap.ui.model.odata.type.Int32

For more information, see sap.ui.model.odata.type.Int32

Edm.Int64

sap.ui.model.odata.type.Int64

For more information, see sap.ui.model.odata.type.Int64

Edm.SByte

sap.ui.model.odata.type.SByte

For more information, see sap.ui.model.odata.type.SByte

Edm.Single

sap.ui.model.odata.type.Single

For more information, see sap.ui.model.odata.type.Single

Edm.String

sap.ui.model.odata.type.String

For more information, see sap.ui.model.odata.type.String

Edm.Time

sap.ui.model.odata.type.Time

For more information, see sap.ui.model.odata.type.Time

Edm.TimeOfDay

sap.ui.model.odata.type.TimeOfDay

For more information, see sap.ui.model.odata.type.TimeOfDay

With XML templating, the data types are used by the sap.ui.model.odata.AnnotationHelper with the constraints defined in the OData metadata.

The following code snippet shows an excerpt from an XML template view:

#!xml
<Label text="{path: 'Label', formatter: 'sap.ui.model.odata.AnnotationHelper.format'}"/>

<Input value="{path: 'Value', formatter: 'sap.ui.model.odata.AnnotationHelper.format'}"/>

However, you can use these types independently in data bindings.

The following code snippet shows an excerpt from an XML view without XML templating:

#!xml
<Label text="Birthday"/>

<Input value="{path: 'Birthday', type: 'sap.ui.model.odata.type.DateTime', constraints: {displayFormat: 'Date', nullable: false}}"/>