cancel
Showing results for 
Search instead for 
Did you mean: 

CAP (Node.js) OData V2 Batch Request using SAP Cloud SDK – How to capture all errors in a changeset?

08-27-2025 9:11 PM
valentincadart Active Participant
742 views 0 comments
SAP Managed Tags
Labels
"OData"batchBusiness Accelerator HubCAP NodeJSS4HAHASAP Cloud Application Programming Modelsap cloud sdk
Subscribe

Hi everyone,

I’m working on a use case where I need to send a batch of update/create/delete requests from a SAP CAP (Node.js) backend to an SAP S/4HANA system. I'm using the SAP Cloud SDK and the Business Accelerator Hub to build and send the OData V2 (using odata-v2-adapter) batch requests.

Here’s what I’ve achieved so far:

  • I’m able to send multiple requests (update/create/delete) within a single batch.
  • To ensure transactional behavior, I wrap all these requests into one changeset.
  • This works well from a transactional standpoint: if any request fails, nothing is committed in S/4.

However, here’s the problem, when one request inside the changeset fails, only a single error is returned, and the rest of the requests are not processed. This behavior is expected according to OData V2 specs and SAP Cloud SDK documentation:

  • “The body of a ChangeSet response is either a response for all the successfully processed change request within the ChangeSet [...] or a single response indicating a failure of the entire ChangeSet.” (OData V2)
  • “If the execution of any request within a changeset fails, the whole changeset will be reflected as an error in the response.” (SAP Cloud SDK)

What I tried:

  • Splitting requests into multiple changesets (one per request) within the same batch allows me to retrieve individual errors, but I lose transactional integrity, some changes are committed while others fail.
  • I also explored the continueOnError option from the odata-v2-adapter, but it only applies between multiple changesets, not within a single changeset. So, again, it doesn’t help with my use case. (SAP Community Q&A)

What I’m looking for:

  • Is there any way (official or workaround) to get detailed errors for all requests without sacrificing atomicity?
  • Alternatively, is there a way to simulate or validate a batch in a “check” or “test” mode, without actually executing it in the S/4HANA backend, just to detect all potential errors?
  • Or is the recommended approach, as suggested by CAP documentation, to implement strong input validation before triggering the batch, to ensure that it will succeed?

Any insights, ideas, or shared experiences would be greatly appreciated!

Thanks in advance!

Accepted Solutions (0)

Answers (0)