on 2018 Jan 29 11:16 AM - last edited on 2024 Feb 04 3:25 AM by postmig_api_4
How to use Batch operation of SAP HANA Service layer for multiple transaction in one request
Request clarification before answering.
Hi Rahul,
Service Layer supports executing multiple operations sent in a single HTTP request through the use of Batch Operations. Refer to the "Service_Layer_Documentation" which shows how you can use Batch Operations using Service Layer.
Below is an example to Create Multiple Business Partners in a Single HTTP Request Using Service Layer Batch Operations:
1. Batch Request Headers:
In the Header, you must set the key “Content-Type” with the value as multipart/mixed;boundary=batch_36522ad7-fc75-4b56-8c71-56071383e77c. The boundary is arbitrary, pick whatever you want. Just make sure you use it as the same on the body of your request.

2. Batch Request Body:
The body of a batch request consists a series of individual requests and change sets, each represented as a distinct MIME part, and separated by the boundary defined in the Content-Type Header.

The HTTP request is provided in the attached "HTTP Request.txt" file.
Hope it helps!
Kind regards,
ANKIT CHAUHAN
SAP SME Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Ankit,
I have tried This above solution but its getting Error Like Bad Format
Please find attached file for Body data.
--------------------------------------Error----------------------------------
--batchresponse_G0EL122V-s4WZ-H30t-Fyzb-WwhFQ4ckSEWJ
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 400 Bad Request
Content-Type: application/json;charset=utf-8
Content-Length: 129
{
"error" : {
"code" : -1,
"message" : {
"lang" : "en-us",
"value" : "BadFormat"
}
}
}
--batchresponse_G0EL122V-s4WZ-H30t-Fyzb-WwhFQ4ckSEWJ--
----------------------------------Header------------------------------------------
Content-Type - multipart/mixed;boundary=batch_36522ad7-fc75-4b56-8c71-56071383e77c
----------------------------
Please suggest solution for same.
Thanks and Regard.
The http-request is missing a line break and should be probably like this:
--batch_36522ad7-fc75-4b56-8c71-56071383e77c
Content-Type: application/http
Content-Transfer-Encoding:binary
POST /b1s/v1/BusinessPartners
{"CardCode":"TestBatch004", "CardName":"Test Batch 01", "CardType": "C"}
--batch_36522ad7-fc75-4b56-8c71-56071383e77c
Content-Type: multipart/mixed;boundary=changeset_77162fcd-b8da-41ac-a9f8-9357efbbd
--changeset_77162fcd-b8da-41ac-a9f8-9357efbbd
Content-Type: application/http
Content-Transfer-Encoding: binary
Content-ID: 1
POST /b1s/v1/BusinessPartners
{"CardCode":"TestBatch005", "CardName":"Test Batch 02", "CardType": "C"}
--changeset_77162fcd-b8da-41ac-a9f8-9357efbbd--
--batch_36522ad7-fc75-4b56-8c71-56071383e77c--
This still results in a "Bank account is missing" error in my demo system, but at least the request's format seems to be okay.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
One more question.
Is the batch operation like a DI transaction? (StartTransaction / EndTransaction)
BR
Robin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rahul,
Please allow me some time to check it and come back to you.
Kind regards,
ANKIT CHAUHAN
SAP SME Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 22 | |
| 18 | |
| 13 | |
| 7 | |
| 6 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.