cancel
Showing results for 
Search instead for 
Did you mean: 

Batching multiple operation in a single request

GowthamRaja
Participant
0 Kudos

Hi Experts,

I am doing a task as displayed below

How To Batch Multiple Operations Into A Single Request

whether the multiple operation in a single request can be done only with Odata using $batch or there is any different approach. is it possble to do it using rfc methods as per link [Content Deleted June 2013] Kindly help me on this issue

Message was edited by: Jason Lax

Accepted Solutions (0)

Answers (4)

Answers (4)

prasanna_prabhu2
Explorer
0 Kudos

Hi,

Can multiple batching operations be used for $filter and $select operations as well... ?

Regards

Prasanna.

arunchembra1
Participant
0 Kudos

Hi Prasanna,

Please find the below link.

http://scn.sap.com/docs/DOC-45504

Thanks,

Arun Chembra

prasanna_prabhu2
Explorer
0 Kudos

Hi Arun,

Thanks a lot for the quick response. But in my case its always fetching the entity collection though i give the filter condition. The request body looks like below

-------------------------------------------------------------------------------------------------------------------------------------------------

--batch

Content-Type: application/http

Content-Transfer-Encoding: binary

Accept: application/xml

GET CUSTOMERCollection/?$filter = COUNTRY eq 'AT'  HTTP/1.1

--batch

Content-Type: application/http

Content-Transfer-Encoding: binary

Accept: application/jsonxml

GET CUSTOMERCollection/?$filter = COUNTRY eq 'BE'  HTTP/1.1

--batch--

---------------------------------------------------------------------------------------------------------------------------------------

Am i missing something here.

Even if i keep the debugger point the table it_filter_select_options is empty.

Could you please help me on this regard.?

arunchembra1
Participant
0 Kudos

Hi Prasana,

1. Instead of batch request call single request and check you are getting data for CUSTOMERCollection/?$filter = COUNTRY eq 'AT'  HTTP/1.1 and CUSTOMERCollection/?$filter = COUNTRY eq 'BE'  HTTP/1.1 .


2. While calling batch you are getting any erro?

3. Have you redefine/IWBEP/IF_MGW_APPL_SRV_RUNTIME~CHANGESET_BEGIN and

/IWBEP/IF_MGW_APPL_SRV_RUNTIME~CHANGESET_END methods. If not please refer this link http://scn.sap.com/docs/DOC-45504

4. Please check this link also http://scn.sap.com/thread/3403864

Thanks,

Arun Chembra

prasanna_prabhu2
Explorer
0 Kudos

Hi Arun,

If i execute the requests separately its fetching the data.

Now i am geeting an error "Invalid type for '$filter' system query option. Expected type is 'Edm.Boolean'" when do a batch operation.

I have redefined both the changeset begin and change set end.

Regards

Prasanna.

arunchembra1
Participant
0 Kudos

Hi Prasana,

The body you are passing was not correct, call service using below body.

--batch

Content-Type: application/http

Content-Transfer-Encoding: binary

Accept: application/json

 

 

GET WBCollection/?$filter= COUNTRY eq 'AT' HTTP/1.1

   

--batch

Content-Type: application/http

Content-Transfer-Encoding: binary

Accept: application/json

  

GET WBCollection/?$filter= COUNTRY eq 'BE' HTTP/1.1

  

--batch--

Thanks,

Arun Chembra

prasanna_prabhu2
Explorer
0 Kudos

Hi Arun,

I used the same body which u have mentioned above by changing my entity collection.

Now it gives an msg that "Response does not contain any data."

I checked the thread http://scn.sap.com/thread/3403864  and gave the same spacing suggested but still it gives this message.

Am i missing something here.

Regards

Prasanna

arunchembra1
Participant
0 Kudos

Hi Prasana,

This issue was because of spacing only, please try the spacing as shown below.

--batch

Content-Type: application/http

Content-Transfer-Encoding: binary

Accept: application/json

<<Only one Enter>>

GET WBCollection/?$filter= COUNTRY eq 'AT' HTTP/1.1

        

<<Only two Enter>>

--batch

Content-Type: application/http

Content-Transfer-Encoding: binary

Accept: application/json

<<Only one Enter>>  

GET WBCollection/?$filter= COUNTRY eq 'BE' HTTP/1.1

<<Only three enter>>

--batch--

Thanks,

Arun Chembra

prasanna_prabhu2
Explorer
0 Kudos

Hi Arun,

Thanks you it worked .

But the issue is though i gave the filter query in the body its returning the entitycollection.

In my case country with 'AT' has 2 records and 'BE' has 3 records. So it should return me 5 records.

But its returning the entitycollection. Should we have to do a separate implementation for this??

Regards

Prasanna

Former Member
0 Kudos


Hi Prasanna,

We are also facing the similar kind of  issue. Have you got any solution for this?  If so, Can you please share with us.

Thanks in advance.

Regards,

Sandhya

AshwinDutt
Active Contributor
0 Kudos

Hello Sandhya,

Please correct the URL,

U need to pass the filters as below :

Sample Payload for ur reference -> Correct ur URL accordingly

--batch--

--batch

Content-Type: application/http

Content-Transfer-Encoding: binary

GET get_emp_dataSet?$filter=Userid+eq+'00001'+and+Name+eq+'ASH*' HTTP/1.1

--batch

Content-Type: application/http

Content-Transfer-Encoding: binary

GET get_emp_dataSet?$filter=Userid+eq+'00002' HTTP/1.1

--batch--

Regards,

Ashwin

Former Member
0 Kudos


Hi Ashwin,

Working fine now. Thank you

Regards,

Sandhya

GowthamRaja
Participant
0 Kudos

Hi Jibin,

this is my url : http://server:port/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/$batch

this is my header info:

this is my body content:

jibin_joy
Contributor
0 Kudos

Hi Rowtham,

   "The server is refusing to process the request because the entity has a unsupported format" error usually occur  when we provide invalid content Type .

    Based on above post Content-type is fine even i tested it working properly as shown below

Regards,

Jibin Joy

GowthamRaja
Participant
0 Kudos

Thanks Jibin. then this is system side error right? what should i do to resolve it or provide me a document which is working fine.

jibin_joy
Contributor
0 Kudos

Hi,

  I Think .....its small pblm in Content Type:Content-Type: mutlipart/mixed; boundary=batch (Wrong spelling)

Its Content-Type: multipart/mixed; boundary=batch

Regards,

Jibin

GowthamRaja
Participant
0 Kudos

Hi Jibin,

Thanks for your help haven't noticed the spelling. now it is working fine. Thanks a lot

rohith_deraje
Advisor
Advisor
0 Kudos

Hi Raja,

If you are using SUP ODP to consume Gateway REST services, here is some android saple code to send multiple request in single call. Please revert back if this is what you are looking for. I will share you the code to hadle the response as well.

ISDMBundleRequest batchRequests = new SDMBundleRequest();

String serviceDocPath = "http://<host>:port /sap/opu/sdata/iwfnd/RMTSAMPLEFLIGHT/";

ISDMRequest serviceDocRequest = buildRequest(serviceDocPath , (ISDMNetListener) this);

batchRequests.addRequest(serviceDocRequest);

  

ISDMRequest metaDataRequest = buildRequest(serviceDocPath + "$metadata",(ISDMNetListener) this);

batchRequests.addRequest(metaDataRequest);

  

searchURL = "http:// <host>:port/sap/opu/sdata/iwfnd/ RMTSAMPLEFLIGHT/carrierCollection";

ISDMRequest collectionDataRequest = buildRequest(searchURL, (ISDMNetListener)this);

batchRequests.addRequest(collectionDataRequest);

  

getRequestmanager().makeRequest(batchRequests);

Regards

Rohith

GowthamRaja
Participant
0 Kudos

Hi Rohith,

Thanks for your information. i cannot get your information clearly, can you please make me clear on what you have posted. Thanks in advance

rohith_deraje
Advisor
Advisor
0 Kudos

Hi Raja,

If I understand your question correctly, You are trying to send batch requests to gateway.

Batch => Multiple operations in single call/requests.

The cample code I shared above is to send batch/bundle requests from android application to gateway using SUP.

SUP:- Sybase unwired platform which is a mobile platform ofering from SAP to develop online/offline mobile applications.

Is my undertsnading correct here?

Regards

Rohith

GowthamRaja
Participant
0 Kudos

Hi Rohith,

I am doing an android application that i am scanning a barcode and getting the value of the barocode.

My Requirement is:

I have to pass the value stored in a variable to get the details of a value from sap system backened table. How to do this Please guide me. Awaiting for your reply, Thanks

GowthamRaja
Participant
0 Kudos

Hi,

As per the document

How To Batch Multiple Operations Into A Single Request

i cannot post the batch operation as mentioned in page.18, after sending the request it displays as

"The server is refusing to process the request because the entity has a unsupported format" and the status code as 415-unsupported media type. kindly help me on this to resolve the problem. Thanks

jibin_joy
Contributor
0 Kudos

Hi Rowtham,

   can u post ur batch Request with its main header.

Regards,

Jibin Joy

jibin_joy
Contributor
0 Kudos

Hi Gowtham,

   

   Its all depends on ur entity design .

- we can use GetEntitySet Method if Barcode information is also presented in same entity with help of $filter option.

- If not available use custom operation http://www.odata.org/documentation/uri-conventions#ServiceOperationParameters .

- one more option is to use "select" option which is also implemented in GETEntityset . I think this option is provided by SAP not from Odata Protocol.

Regards,

Jibin

wbrown
Participant
0 Kudos

Hi Raja,

If I understand the question correctly, the $batch is the only operation that you can use to send multiple requests over one http call.

It is possible to use the RFC methods, but the $batch function was introduce in SP4 (I believe) so if you were running SAP NetWeaver Gateway 2.0 SP3 as in the How-to guide example, it wouldn't work.

Regards,

Wayne

GowthamRaja
Participant
0 Kudos

Hi Brown,

Thanks for your information. if you see the link i have attached, it will show the service RMTSAMPLEFLIGHT is not build on modelling like BOR, RFC, etc and we are using the latest version of SAP Netweaver gateway.