cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple S/4 HANA Cloud services into single service using CAP

Former Member
0 Kudos

Hi Experts,

We have a requirement to develop single service in CAP pointing to multiple S/4 HANA cloud services(CDS) and return single response entity.

Currently able access individual services from CAP as external service definition imported and converted into .CSN file and created custom service and pointed to individual remote entities.

Help expecting on below areas.

1. Joining different entities locally- just projection will work here on service level?

2. Local entities need to create without persistence ?

3. Creating single response Entity with all required fields from multiple entities.

Can you please help me with pointer approach how to achieve this or example on this area.

Regards,

Satya.

Accepted Solutions (1)

Accepted Solutions (1)

david_kunz2
Advisor
Advisor

Dear Satya,

If I understand correctly you have several external service endpoints (coming from SAP S/4HANA) and you want to combine them to a single response.

This is possible, however you'll need to do this in a custom handler.

1) Import all external service definitions
2) Create a service entity with associations to the respective imported entities
3) Create a custom handler to trigger read requests to those services and compose them to a single response

Best regards,
David

Former Member
0 Kudos

Hi David,

Thanks for the reply,

now am trying to connect my code to destinations. But facing this below error (full error attached) after accessing the entity and also destination maintained with Full service URL. Please can you help me with this error.

2020-08-18T09:56:53.83+0100 [APP/PROC/WEB/0] ERR [2020-08-18T08:56:53.833Z | ERROR | 1461602]: Request failed with status code 400
   2020-08-18T09:56:53.83+0100 [APP/PROC/WEB/0] ERR [2020-08-18T08:56:53.833Z | ERROR | 1461602]: Error stacktrace: Error: Request failed with status code 400     at createError (/home/vcap/app/node_modules/axios/lib/core/createError.js:16:15)     at settle (/home/vcap/app/node_modules/axios/lib/core/settle.js:17:12)     at IncomingMessage.handleStreamEnd (/home/vcap/app/node_modules/axios/lib/adapters/http.js:236:11)     at IncomingMessage.emit (events.js:203:15)     at endReadableNT (_stream_readable.js:1145:12)     at process._tickCallback (internal/process/next_tick.js:63:19)cap-error.txt

Regards,

Satya.

david_kunz2
Advisor
Advisor
0 Kudos

Hi Satya,

Error code 400 means "bad request", so there's something wrong with the query you're sending.

Can you log the query you're sending? You can put a

 console.log(reqOptions)

inside

node_modules/@sap/cds-runtime/lib/rest/service.js:29

Thanks and best regards,
David

Former Member
0 Kudos

Hi David,

Thanks for quick response.

I have given explicit service URL in package.json as a path parameter under credentials section. And at destination maintained only S4HANA cloud host. After that it start working for multiple service.

Here i have added 3 different services and 2 services working as expected.

But one service is giving "Request failed with status code 501", same service is working and able retrieve details from Postman.

Is there any easy way we can details detailed log what is happening in background ?

Regards,

Satya

Answers (0)