In a first blog post regarding conversions in SAP Gateway Foundation we discussed their relevance in the context of the differences between the ABAP type system and the OData type system. Although not directly related to conversions the handling of date and time perfectly fits into this topic.
ABAP knows date, time, and different representations of time stamps. And, it provides reuse functions to execute date and time calculations. OData has its own date and time definitions with functions that may be used in
$filter
expressions, for example.
Often, questions arise how the different representations map and how a data provider needs to be implemented to create a best match between both worlds. It is certainly not possible to dig into each and every detail. But, let us start with a few aspects.
Date and Time in OData
To represent date and time information, the OData specification in version 2.0 knows the three primitive types
Edm.DateTime,
Edm.Time, and
Edm.DateTimeOffset.
Since this is not really sufficient for business applications specification version 4.0 switches to
Edm.Date,
Edm.TimeOfDay,
Edm.DateTimeOffset, and
Edm.Duration.
We focus on specification version 2.0 and restrict the discussion to Edm.DateTime and Edm.DateTimeOffset. Details regarding the representations can be found in the
OData specification
, the
ISO 8601 standard
, and in
http://www.w3.org/TR/xmlschema-2
. Here, we quickly list the different formats. The literals are used in the URI, that is, in
$filter
expressions or key predicates, for example. ATOM and JSON refer to the content type of the request or response payload. The number of decimal places available for sub-seconds is defined by the facet precision.
Edm.DateTime represents a date and a time in
UTC
(formerly, Greenwich Mean Time):
Representation
Example
Literal
datetime'yyyy-mm-ddThh:mm[:ss[.fffffff]]'
datetime'2016-07-08T12:34:56'
ATOM
yyyy-mm-ddThh:mm[:ss[.fffffff]]
2016-07-08T12:34:56
JSON
"\/Date(<ticks>)\/"<ticks> = number of milliseconds since midnight Jan 1, 1970
"\/Date(1467981296000)\/"
The ticks in the JSON representation may also be negative to describe dates and time before Jan 1, 1970. "\/Date(-6847804800000)\/" is midnight Jan 1, 1753, for example.
Edm.DateTimeOffset adds time zone information relative to UTC. The date and time information is amended by the standard time difference (offset) with the sign
v
: +01:00 for Central European Time (CET) or -05:00 for Eastern Standard Time (EST), for example.
Buenas tardes como andan? consulta respecto al examen final, saben si es online, si mandan el material para hacer actividades y luego cargarlas, si es teorico/practico? cualquier informacion al respec...
OpenSAP y sus cursos sobre SAP
OpenSAP y sus cursos sobre SAP
OpenSAP es una plataforma en línea creada por SAP, una empresa líder en software empresarial a nivel mundial. Ofrece una amplia gam...
Estoy intentando acceder a swagger-ui.html y obtengo lo siguiente
<errorList>
<errors>
<message>El sitio base swagger-ui.html no existe</message>...
Hola chicos, una duda en SAP, quiero realizar una MIGO, pero no aparece mi Orden de Pago y en otra me aparece que es por falta de posición. Saben cómo podría hacerle para saber el estado de mi orden d...