Skip to Content
author's profile photo Former Member
Former Member

$batch problem

Hi experts,

I am trying to implement $batch functionality by following the documentation below.

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/40546820-3ea7-2f10-dfab-be373c0da357?QuickLink=index&overridelayout=true&55959128903935

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

this is my URI : /sap/opu/odata/sap/ZMASTERDATA_SRV/$batch

URL Header - has the following properties

X-CSRF-Token

Content-Type

Authorization

and this it XML Request

--batch

Content-Type: application/http

Content-Transfer-Encoding: binary

Accept: application/json

GET Banks(DealerID='WN01234',BankDetailID='DINC') HTTP/1.1

<2 enters>

--batch

Content-Type: application/http

Content-Transfer-Encoding: binary

Accept: application/json

GET Banks(DealerID='WN01234',BankDetailID='DOUT') HTTP/1.1

< 3 enters>

--batch--

I received status : 202 Accepted

but i only received ONE set of data for - 'GET Banks(DealerID='WN01234',BankDetailID='DINC') '

I would expect to see TWO set of data for both request.

it looks like the system does NOT process my second 'GET'

Please let me know what you think.

Thank You and appreciate your help


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Sep 25, 2013 at 12:26 AM

    Hi Martin,

    please have a look at the samples that can be created within the Gateway Client for the test group CORE_SAMPLES.

    There I have adapted the test case "$batch - 09 - read – entityset" such that it performs two single reads rather than two queries on two different entity sets.

    Here I get two results:

    --batch_005056A5-09B1-1ED1-BF82-409B26A80900

    Content-Type: application/http

    Content-Transfer-Encoding: binary



    GET TravelagencyCollection('00000055') HTTP/1.1




    --batch_005056A5-09B1-1ED1-BF82-409B26A80900

    Content-Type: application/http

    Content-Transfer-Encoding: binary



    GET TravelagencyCollection('00000055') HTTP/1.1




    --batch_005056A5-09B1-1ED1-BF82-409B26A80900—

    Response:

    --ejjeeffe0

    Content-Type: application/http

    Content-Length: 1267

    content-transfer-encoding: binary



    HTTP/1.1 200 OK

    Content-Type: application/atom+xml;type=entry

    Content-Length: 1154

    dataserviceversion: 2.0



    <?xml version="1.0" encoding="utf-8"?>

    <entry xml:base="http://erpcrmsrv:8000/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/" xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">

    <id>http://erpcrmsrv:8000/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/TravelagencyCollection('00000055')</id>

    <title type="text">TravelagencyCollection('00000055')</title>

    <updated>2013-09-25T00:13:44Z</updated>

    <category term="RMTSAMPLEFLIGHT.Travelagency" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>

    <link href="TravelagencyCollection('00000055')" rel="edit" title="Travelagency"/>

    <content type="application/xml">

    <m:properties>

    <d:agencynum>00000055</d:agencynum>

    <d:NAME>Sunshine Travel</d:NAME>

    <d:STREET>134 West Street</d:STREET>

    <d:POSTBOX/>

    <d:POSTCODE>54323</d:POSTCODE>

    <d:CITY>Rochester</d:CITY>

    <d:COUNTRY>US</d:COUNTRY>

    <d:REGION>NY</d:REGION>

    <d:TELEPHONE>+1 901-632-5620</d:TELEPHONE>

    <d:URL>http://www.sunshine-travel.sap</d:URL>

    <d:LANGU>E</d:LANGU>

    <d:CURRENCY>USD</d:CURRENCY>

    <d:mimeType>text/html</d:mimeType>

    </m:properties>

    </content>

    </entry>

    --ejjeeffe0

    Content-Type: application/http

    Content-Length: 1267

    content-transfer-encoding: binary



    HTTP/1.1 200 OK

    Content-Type: application/atom+xml;type=entry

    Content-Length: 1154

    dataserviceversion: 2.0



    <?xml version="1.0" encoding="utf-8"?>

    <entry xml:base="http://erpcrmsrv:8000/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/" xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">

    <id>http://erpcrmsrv:8000/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/TravelagencyCollection('00000055')</id>

    <title type="text">TravelagencyCollection('00000055')</title>

    <updated>2013-09-25T00:13:44Z</updated>

    <category term="RMTSAMPLEFLIGHT.Travelagency" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>

    <link href="TravelagencyCollection('00000055')" rel="edit" title="Travelagency"/>

    <content type="application/xml">

    <m:properties>

    <d:agencynum>00000055</d:agencynum>

    <d:NAME>Sunshine Travel</d:NAME>

    <d:STREET>134 West Street</d:STREET>

    <d:POSTBOX/>

    <d:POSTCODE>54323</d:POSTCODE>

    <d:CITY>Rochester</d:CITY>

    <d:COUNTRY>US</d:COUNTRY>

    <d:REGION>NY</d:REGION>

    <d:TELEPHONE>+1 901-632-5620</d:TELEPHONE>

    <d:URL>http://www.sunshine-travel.sap</d:URL>

    <d:LANGU>E</d:LANGU>

    <d:CURRENCY>USD</d:CURRENCY>

    <d:mimeType>text/html</d:mimeType>

    </m:properties>

    </content>

    </entry>

    --ejjeeffe0—

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.