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
Request clarification before answering.
Dear Juan,
Thanks for reporting this. We'll look into it.
For now, I'm afraid you'll need to do the conversion yourself.
Best regards,
David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David,
Thank you for your response.
I think the problem is that the framework is not considering that the external service is OData 2.0.
Then it tries to parse an OData 2.0 JSON Date as an OData 4.0 JSON Date, and the format is very different.
Do you have any suggestion to do the conversion myself?
I am doing the following to fordward the requests to the external services:
const cds = require('@sap/cds')
module.exports = cds.service.impl(async function () {
const journalEntryItemBasicSrv = await cds.connect.to('API_JOURNALENTRYITEMBASIC_SRV')
const { A_CompanyCode, A_GLAccountInChartOfAccounts, A_CostCenter } = this.entities
const entities = [ A_CompanyCode, A_GLAccountInChartOfAccounts, A_CostCenter ]
entities.forEach( entity => {
this.on('READ', entity, req => journalEntryItemBasicSrv.tx(req).run(req.query))
});
})
Thanks in advance.
| User | Count |
|---|---|
| 10 | |
| 5 | |
| 5 | |
| 5 | |
| 4 | |
| 2 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.