<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: how to initiate multiple batch requests, any sample code ? in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaa-p/356112#M21406</link>
    <description>&lt;P&gt;Hi Venkatesha&lt;/P&gt;&lt;P&gt;I believe you can set the batch group ID there so that it belongs to the same group and requested together.&lt;/P&gt;</description>
    <pubDate>Wed, 22 Feb 2017 12:20:06 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2017-02-22T12:20:06Z</dc:date>
    <item>
      <title>how to initiate multiple batch requests, any sample code ?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaq-p/356110</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am making &lt;STRONG&gt;two calls of sap.ui.model.odata.read method one after the other &lt;/STRONG&gt;with different entitiy sets.&lt;/P&gt;&lt;P&gt;Since UI5 has inbuilt capability to send both GET operations in a single batch request, i can see only one $batch request in console.&lt;/P&gt;&lt;P&gt;When i checked this $batch call under 'Network' tab in chrome console, i saw there are two GET commands one after the other under 'Request Payload' and this whole $batch request is taking &lt;STRONG&gt;3 seconds&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;Whereas each of these read calls spearately takes &lt;B&gt;1.5 seconds&lt;/B&gt;.&lt;/P&gt;&lt;P&gt;--&amp;gt;So, i think when i make two read calls one after the other, browser is actually calling them sequentially.&lt;/P&gt;&lt;P&gt;What i want to achieve is to make two $batch requests for odata.read calls, which are written one after the other.&lt;/P&gt;&lt;P&gt;Is it possible with some settings or any sample code ?&lt;/P&gt;&lt;P&gt;BR,&lt;BR /&gt;Venky.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 11:24:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaq-p/356110</guid>
      <dc:creator>venkatesha_n</dc:creator>
      <dc:date>2017-02-22T11:24:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to initiate multiple batch requests, any sample code ?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaa-p/356111#M21405</link>
      <description>&lt;P&gt;Use sap.ui.model.odata.v2.ODataModel instead. It takes care of batch calls itself.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 12:05:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaa-p/356111#M21405</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-02-22T12:05:57Z</dc:date>
    </item>
    <item>
      <title>Re: how to initiate multiple batch requests, any sample code ?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaa-p/356112#M21406</link>
      <description>&lt;P&gt;Hi Venkatesha&lt;/P&gt;&lt;P&gt;I believe you can set the batch group ID there so that it belongs to the same group and requested together.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 12:20:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaa-p/356112#M21406</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-02-22T12:20:06Z</dc:date>
    </item>
    <item>
      <title>Re: how to initiate multiple batch requests, any sample code ?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaa-p/356113#M21407</link>
      <description>&lt;P&gt;Hello Venky,&lt;/P&gt;&lt;P&gt;Try using ODataModel.setUseBatch(false); &lt;/P&gt;&lt;P&gt;If you want to have 2 different requests then try disabling the request as above and see whether it serves your purpose.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 17:47:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaa-p/356113#M21407</guid>
      <dc:creator>former_member44086</dc:creator>
      <dc:date>2017-02-22T17:47:35Z</dc:date>
    </item>
    <item>
      <title>Re: how to initiate multiple batch requests, any sample code ?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaa-p/356114#M21408</link>
      <description>&lt;P&gt;Hi Dinesh,&lt;/P&gt;&lt;P&gt;I tried it, then it will  be two separate calls, but not two separate batch calls.&lt;/P&gt;&lt;P&gt;And this also voids further batching.&lt;/P&gt;&lt;P&gt;BR,&lt;BR /&gt;Venky.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2017 05:45:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaa-p/356114#M21408</guid>
      <dc:creator>venkatesha_n</dc:creator>
      <dc:date>2017-02-23T05:45:28Z</dc:date>
    </item>
    <item>
      <title>Re: how to initiate multiple batch requests, any sample code ?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaa-p/356115#M21409</link>
      <description>&lt;P&gt;Hi Hans,&lt;/P&gt;&lt;P&gt;Thanks for your suggestion.&lt;/P&gt;&lt;P&gt;I am new to SAPUI5, do you have a sample code to know how to set group ID to the already existing Odatamodel ?&lt;/P&gt;&lt;P&gt;BR,&lt;BR /&gt;Venky.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2017 07:35:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaa-p/356115#M21409</guid>
      <dc:creator>venkatesha_n</dc:creator>
      <dc:date>2017-02-23T07:35:03Z</dc:date>
    </item>
    <item>
      <title>Re: how to initiate multiple batch requests, any sample code ?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaa-p/356116#M21410</link>
      <description>&lt;P&gt;&lt;A href="https://sapui5.netweaver.ondemand.com/sdk/#docs/guide/6c47b2b39db9404582994070ec3d57a2.html"&gt;Check this link&lt;/A&gt; and scroll down to "Batch Processing"&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2017 09:03:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaa-p/356116#M21410</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-02-23T09:03:07Z</dc:date>
    </item>
    <item>
      <title>Re: how to initiate multiple batch requests, any sample code ?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaa-p/356117#M21411</link>
      <description>&lt;P&gt;this is the example of setting a group ID. I believe without setting the groupId for the request, SAPUI5 will generate a unique ID for each request so they will never inside the same batch. Take a look at the oDataModel.v2 api will help you I guess&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;var sGroupId = ...; //you can put anything you want, I myself use a timestamp.
oDataModel.setChangeGroups({
     "/record": { groupId: sGroupId } 
});
oDataModel.setDeferredGroups([sGroupId]); //deferred the group 

oDataModel.update("/record",data,{groupId : sGroupId}); //make sure to put the group in the request.
oDataModel.submitChanges({groupId: sGroupId});

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Feb 2017 01:15:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaa-p/356117#M21411</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-02-24T01:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: how to initiate multiple batch requests, any sample code ?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaa-p/356118#M21412</link>
      <description>&lt;P&gt;Hi Hans,&lt;/P&gt;&lt;P&gt;I am using oDataModel.v2 api:&lt;/P&gt;&lt;P&gt;&lt;A href="https://answers.sap.com/storage/temp/22965-capture.png"&gt;capture.png&lt;/A&gt; --&amp;gt; is the screenshot from manifest.json&lt;/P&gt;&lt;P&gt;What am i doing is:&lt;/P&gt;&lt;P&gt;oDataModel = that.getOwnerComponent().getModel();&lt;BR /&gt;aFiltersOData = that._createODataFilters("Entity1");&lt;BR /&gt;oDataModel.read("/Entity1", { &lt;BR /&gt;filters: aFiltersOData,
&lt;BR /&gt;success: that._oDataReadBaseSuccessHandler
&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;I tried your suggestion like this:&lt;/P&gt;&lt;P&gt;oDataModel = that.getOwnerComponent().getModel();&lt;BR /&gt;aFiltersOData = that._createODataFilters("Entity1");&lt;BR /&gt;var sGroupId = "Group1";&lt;BR /&gt;oDataModel.setChangeGroups({
     "/Entity1": { groupId: sGroupId } 
}); &lt;BR /&gt;oDataModel.setDeferredGroups([sGroupId]); //deferred the group &lt;BR /&gt;oDataModel.update("/Entity1",{groupId : sGroupId}); //make sure to put the group in the request.
oDataModel.submitChanges({groupId: sGroupId});&lt;BR /&gt;oDataModel.read("/Entity1", { &lt;BR /&gt;filters: aFiltersOData, &lt;BR /&gt;success: that._oDataReadBaseSuccessHandler &lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;it did not work(still single batch call for two subsequent oDataModel.read calls)&lt;/P&gt;&lt;P&gt;in your code snippet, there is a one '&lt;STRONG&gt;data&lt;/STRONG&gt;', i left it blank, is this causing any problem ?&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;oDataModel.update("/record",data,{groupId : sGroupId});&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;BR,&lt;BR /&gt;Venky.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2017 07:35:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaa-p/356118#M21412</guid>
      <dc:creator>venkatesha_n</dc:creator>
      <dc:date>2017-03-01T07:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: how to initiate multiple batch requests, any sample code ?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaa-p/356119#M21413</link>
      <description>&lt;P&gt;Hi Radek,&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;I am using oDataModel.v2 api:&lt;/P&gt;&lt;P&gt;I followed the same link and tried it--&amp;gt; not working(still single batch call for two subsequent oDataModel.read calls).&lt;/P&gt;&lt;P&gt;in this link &lt;U&gt;&lt;A href="https://sapui5.netweaver.ondemand.com/sdk/#docs/guide/6c47b2b39db9404582994070ec3d57a2.html" target="test_blank"&gt;https://sapui5.netweaver.ondemand.com/sdk/#docs/guide/6c47b2b39db9404582994070ec3d57a2.html&lt;/A&gt;&lt;/U&gt;   There is one code line:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;oModel.submitChanges({groupId:"myGroupId", success: mySuccessHandler, error: myErrorHandler});&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;There is a success call function in the above statement, i think i should give success call back function in the oDataModel.read call, not here right ?&lt;/P&gt;&lt;P&gt;BR,&lt;BR /&gt;Venky.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2017 07:41:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaa-p/356119#M21413</guid>
      <dc:creator>venkatesha_n</dc:creator>
      <dc:date>2017-03-01T07:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: how to initiate multiple batch requests, any sample code ?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaa-p/356120#M21414</link>
      <description>&lt;P&gt;In oModel.read the success callback will trigger each time for a successfully read entry even if it is batch processing. You can either use submitChanges then success will trigger once per processed batch or use oModel.read and attach event &lt;A href="https://sapui5.netweaver.ondemand.com/sdk/#docs/api/symbols/sap.ui.model.odata.v2.ODataModel.html#event:batchRequestCompleted"&gt;batchRequestCompleted&lt;/A&gt; which will trigger once per batch.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2017 13:08:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaa-p/356120#M21414</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-03-01T13:08:01Z</dc:date>
    </item>
    <item>
      <title>Re: how to initiate multiple batch requests, any sample code ?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaa-p/356121#M21415</link>
      <description>&lt;P&gt;my code snippet is an example of batch request for update. you need to specify the group id for your read as well, and you need to use the submitChanges the success will trigger once all the request in the batch are processed successfully or you can attach batchRequestCompleted on your read function.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 01:03:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaa-p/356121#M21415</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-03-02T01:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to initiate multiple batch requests, any sample code ?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaa-p/356122#M21416</link>
      <description>&lt;P&gt;You can assign a groupID to the particular enitytype, which you want to load later. &lt;BR /&gt;Then you can call 2 submitchanges, 2nd one in the success of the first.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 09:06:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaa-p/356122#M21416</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2018-01-09T09:06:41Z</dc:date>
    </item>
    <item>
      <title>Re: how to initiate multiple batch requests, any sample code ?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaa-p/356123#M21417</link>
      <description>&lt;P&gt;Hi Hans,&lt;/P&gt;
  &lt;P&gt;Thanks for the solution i implemented the same with below code&lt;/P&gt;
  &lt;P&gt;var sGroupId = "myId"; &lt;/P&gt;
  &lt;P&gt;oODataModel.setChangeGroups({ "/C_Proc": { groupId: sGroupId } }); &lt;/P&gt;
  &lt;P&gt;oODataModel.setDeferredGroups([sGroupId]); //deferred the group &lt;/P&gt;
  &lt;P&gt; oODataModel.read("/C_Proc",{ &lt;/P&gt;
  &lt;P&gt; filters: aFiltersOData, &lt;/P&gt;
  &lt;P&gt; groupId : sGroupId, &lt;/P&gt;
  &lt;P&gt; urlParameters: { $select: parameters" }, &lt;/P&gt;
  &lt;P&gt; success: that._oDataRead });&lt;/P&gt;
  &lt;P&gt; oODataModel.submitChanges({groupId: sGroupId});&lt;/P&gt;
  &lt;P&gt;Now my batch calls are different. But now i am getting error in other calls&lt;/P&gt;
  &lt;P&gt;How can i make it false in future, I want my other calls to be executed as before??&lt;/P&gt;
  &lt;P&gt;Thanks,&lt;/P&gt;
  &lt;P&gt;Lavanya&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 08:29:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-initiate-multiple-batch-requests-any-sample-code/qaa-p/356123#M21417</guid>
      <dc:creator>former_member269316</dc:creator>
      <dc:date>2018-01-16T08:29:55Z</dc:date>
    </item>
  </channel>
</rss>

