cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

Hi,

I am developing a solution using CAPM.

I am using the S/4 HANA Cloud API API_JOURNALENTRYITEMBASIC_SRV as an external service.

My problem is when I try to consume an EntitySet that returns an attribute of tipe Edm.Date (for example A_CostCenter entityset).

The error is "Invalid value /Date(253402214400000)/ (JavaScript string). A string value in the format YYYY-MM-DD must be specified as value for type Edm.Date."

I think the CAPM framework is expecting a format YYYY-MM-DD, but S/4 HANA Cloud is returning the dates with this format: /Date(253402214400000)/

Here is an image where the error happens:

Does anyone have the same error?

Does exist any fix?

Thanks in advance

View Entire Topic
jsg24582
Explorer

David,

I find the way to do the conversion (basically the `run` method returns a Promise that its resolved value is the JSON response of the external service, already parsed, without doing any validation):

        this.on('READ', entity, async req => {
            let response = await journalEntryItemBasicSrv.tx(req).run(req.query)
            response.forEach( instance => {
                if (instance.ValidityEndDate) 
                instance.ValidityEndDate = ODataV2toODataV4Date(instance.ValidityEndDate)
            });
            return response;
        })

It would be very helpful if the problem is fixed.

Thanks a lot for your support!

Kind regards

Trinidad
Product and Topic Expert
Product and Topic Expert

Hi jsg24582 ,

Could you please share the ODataV2toODataV4Date function implementation?

david.kunz2 Do you know if this issue is going to be fixed soon?

Thanks
Trinidad.