Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Sschlegel
Participant
Introduction:

There is a very common problem, that while doing a post request or any kind of update containing empty dates are not allowed by default via SEGW based OData-Services.

How to enable this is described here: DateTime field in OData entity – Points to take care when the UI is throwing run-time error. | SAP B...

Problem:

But maybe you struggle here anyway, even when using the workaround as described before - but why? Take a look here at the column DEL_DATE:


It looks fine in the ADT Data-Preview, even if 0000-00-00 is not a very nice date.

But testing the OData-Service based on this CDS View returns an error "the Value ____ is no valid Date according to XML-formats for ABAP":


Error in /IWFND/ERROR_LOG


Rescue from the past - thank you SE16:

The solution can be found via our old tooling like the good, old SE16 - here we see the true value of DEL_DATE:


The field does not contain any value - its empty, space or even null, but not 0000-00-00 as shown in ADT! And "space" or "empty string" can't be interpreted as a date! How to fix it? Simply extend your CDS with an easy CASE-Statement, that sets a value OData can handle - like the one mistakenly shown in ADT:
define view entity ZABC
as select from toa01
{
key sap_object as SapObject,
@UI.hidden: true
key object_id as ObjectId,
@EndUserText.label: 'Content Repository'
key archiv_id as ArchivId,
key arc_doc_id as ArcDocId,

case del_date
when '' then '00000000'
else del_date end as DelDate
}

This should normally not be necessary and is clearly due to a program error, but still: some kind of solution.

Enjoy!

 
5 Comments
Labels in this area