Skip to Content
0

How to use Batch operation of SAP HANA Service layer for multiple transaction in one request

Jan 29 at 11:16 AM

204

avatar image
Former Member

How to use Batch operation of SAP HANA Service layer for multiple transaction in one request

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

ANKIT CHAUHAN
Jan 29 at 02:27 PM
0

Hi Rahul,

Please allow me some time to check it and come back to you.

Kind regards,

ANKIT CHAUHAN

SAP SME Support

Share
10 |10000 characters needed characters left characters exceeded
ANKIT CHAUHAN
Jan 30 at 11:36 AM
0

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.

http-request.txt

Hope it helps!

Kind regards,
ANKIT CHAUHAN

SAP SME Support


body.jpg (84.5 kB)
Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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.

batchbody.txt (1.5 kB)
0

Hi Rahul,

Make sure that you have selected the Content-Type Header value correctly. Also we are using the POSTMAN app to check the request.

If you are using some other application, then please make sure the equivalent options are selected.

Kind regards,

ANKIT CHAUHAN

SAP SME Support

0
NILS STRITZEL Feb 22 at 12:24 PM
0

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.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

And if you're new to using Postman, make sure that you enter value for content-type in the "value" field and not in "description". If there is no "value" field click on "..." to select it.

postman.png (12.9 kB)
0