Skip to Content

Additional GET commands in a batch operation

Hi,

When i make a read call for an odatamodel for one entity, in the chrome console, if i check that $batch operation, there are 2 additional calls which i never included as part of filters or parameters:

GET Entity1/$count HTTP/1.1

GET Entity1?$skip=0&$top=100 HTTP/1.1

Not sure why these calls are made via $batch request.

Anybody knows how to avoid these calls ?

BR,
Venky

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Feb 23, 2017 at 05:07 PM

    Update model settings in manifest.json and use the property 'defaultCountMode' as 'None', this will avoid the call for $count.

    I think second request is still required. Show me your batch request and XML view binding.

    Below is the code for 'manifest.json'

    "sap.app": {
        "dataSources": {
    	  "invoiceRemote": {
    		"uri": "https://services.odata.org/V2/Northwind/Northwind.svc/",
    		"type": "OData",
    		"settings": {
    		  "odataVersion": "2.0",
                      "defaultCountMode": "None"      //--> this removes count mode in batch request
    		}
    	  }
    }
    
    "sap.ui5": {
        "models": {
             "dataSource": "invoiceRemote"
         }
    }
    Add comment
    10|10000 characters needed characters exceeded

  • Mar 03, 2017 at 03:49 AM

    Hello Venky,

    Whenever there is an aggregation binding in UI5 , the framework will automatically trigger the count call , so that controls like table ,list can provide a paging , growing functionality. This is precisely the reason why the $top and $skip keep getting appended to your request.

    I would suggest you to set the defaultCountMode to Inline in either

    1. Manifest.json

    2. In the component or view hook method by using javascript code model.setDefaultCountMode("Inline") .

    The use of "Inline" appends one more parameter to your request $inlineCount=allpages which makes only request (instead of 2 requests) but also retrieves the count and everything else works seamlessly.

    Thanks and Regards,

    Veera

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Veera,

      Thanks for your help.

      I wanted to get rid of these calls, so i tried setting defaultCountMode to 'None'--> it removes only one call GET Entity1/$count HTTP/1.1

      But still there is another call which is still getting called:

      GET Entity1?$skip=0&$top=100 HTTP/1.1

      Any idea how do i get rid of it ?

      BR,
      Venky.

  • May 28 at 02:15 PM

    Hello,

    To disable 2nd request you can add

    refreshAfterChange: false in settings. But of course there will be side effect based on your use case.

    Regards,
    Vinod Patil

    Add comment
    10|10000 characters needed characters exceeded