Skip to Content
0

Additional GET commands in a batch operation

Feb 23, 2017 at 05:40 AM

159

avatar image

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

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

2 Answers

Srikanth KV Feb 23, 2017 at 05:07 PM
0

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"
     }
}
Show 6 Share
10 |10000 characters needed characters left characters exceeded

Hi Srikanth,

Thanks for your help.

I tried it, but it wont accept, giving syntax error--> Schema error: Manifest Json: "sap.app".dataSources[keys5.0].settings- has additional properties

Any idea why am i receiving this error.

BR,
Venky.

0

Can you show your manifest.json file?

0

Hi Srikanth,

Here i have attached manifest.json

capture.png 2nd-half.png

BR,
Venky.

capture.png (48.3 kB)
2nd-half.png (42.7 kB)
0

My mistake. Property "defaultCountMode" should be set in "sap.ui5". Refer below:

"sap.app": {
    "dataSources": {
	  "invoiceRemote": {
		"uri": "https://services.odata.org/V2/Northwind/Northwind.svc/",
		"type": "OData",
		"settings": {
		  "odataVersion": "2.0"
		}
	  }
}

"sap.ui5": {
    "myModel": {
        "models": {
               "type": "sap.ui.model.odata.v2.ODataModel",
                "dataSource": "invoiceRemote",
                "settings": { 
                       "defaultCountMode": "None"     //Place it here
                 }
         }
     }
}


manifest.jpg (69.0 kB)
1

Hi Srikanth,

Thanks a lot for your help.

After implementing your solution, it took away only this call :

GET Entity1/$count HTTP/1.1

But still there is one more call, which is still occuring: i have no idea which setting would remove this call :

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

Anyways, thanks again for your help.

BR,
Venky.

0

second request GET C_ProcMonE2EChain?$skip=0&$top=100 HTTP/1.1 mostly refers to binding to table which have the default threshold of 100, without this request data will not be populated into the table.

0
Veeraraghavan Narasimhan
Mar 03, 2017 at 03:49 AM
0

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

Show 1 Share
10 |10000 characters needed characters left 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.

0