Skip to Content

Automatic OData Model Instantiation / what settings are available?

Dec 15, 2016 at 10:04 PM


avatar image

Hi all,

I'm considering automatic model instantiation of an application wide v2.ODataModel by declaring it in manifest.json. So, along the same lines as described in the sapui5 walkthrough ( my manifest looks something like this:

  "": {
    "dataSources": {
      "mydatasource": {
        "uri": "...uri to my xsodata service...",
        "type": "OData",
        "settings": {
"odataVersion": "2.0" ...what other settings are allowed here? ... } } } }, ... "sap.ui5": { ... "models": { "mymodel": { "dataSource": "mydatasource" } }, ... } }

What I would like to know is: what exactly can I configure in the "settings" object of the datasource? I saw only examples that , but no official documentation that lists what properties I can set here.

It seems to me it should be possible to set any of the properties listed for the parameters argument to the v2.ODataModel constructor ( but I noticed this does not work.

For example, I would like to set the disableHeadRequestForToken here, but I can't get it to work. I debugged a bit, and from that I think the following settings are def. checked:

annotationURI (string)
json (boolean)
odataVersion (string)
headers (object)
annotations (array?)

Are there any others? In particular I would like to set the sizeLimit and disableHeadRequestForToken properties of the model, is that possible?

10 |10000 characters needed characters left characters exceeded

Hi Roland,

have you found a solution in the meantime?

Best regards


Hi Gregor! Thanks for the reply.

yeah, it took me a while but I found some documentation that explains you can specify a "settings" property in the object that speccfies the model. The value of the settings property should be an object literal which will then be passed to the constructor of the model.
It tested it, and it works for the options I needed.
What does not work however is assigning the settings at the level of the datasource, it really has to be done in the entry of the model itself.
Here's the doc:


Hi Roland,

I'm looking for the option to change the default requested 20 entries of an OData Service ($top=20) to a number that I can define. Any pointer for that?

Best regards


Hi gregor! Can you elaborate a little bit more on your exact use case? I know the Odata $top option, but in a UI5 context I don't usually manipulate it myself.

Typically, I bind my model to controls in the view, and then those will automagically make the right request in accordance with however the control was set up. So if your use case resembles that, then I think you should look at the options for the control, and modify those.

Alternatively, I sometimes use the ui5 v2 ODataModel to do a direct call to its read method, and in that case, I set a "urlParameters" property in the object passed to the read method, and I specify the top option there, like so:{
path: "/myEntity",
urlParameters: {
top: myLimit,


I'm not sure if it's possible to set the default value for top when instantiating the model. If it is, then the option is not listed in the API documentation AFAIK.



In the last days I've worked on the Issue Registration not possible when form was called with Event# directly. As in the Detail View data from related entities of the main entity are used we did run into the issue that as soon as the number of items in the master list exceeded the default 20 this Information wasn't read anymore. For an easier reproduction of the issue in my test system it would be good to have that option. In the meantime I've created enough sample events so I was able to reproduce and fix the issue.

* Please Login or Register to Answer, Follow or Comment.

0 Answers