Skip to Content

Automatic OData Model Instantiation / what settings are available?

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?

Add comment
10|10000 characters needed characters exceeded

  • 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.

  • Get RSS Feed

1 Answer

  • Best Answer
    Jun 27, 2018 at 04:19 PM


    You can achieve this by injecting constructor settings within "model" node (here's an example):

    "models": {
          "": {
            "dataSource": "mainDataSource",
            "preload": true,
            "settings": {
              "defaultBindingMode": "TwoWay",
              "defaultUpdateMethod" : "PUT",
              "defaultCountMode" : "Inline"

    Hope it helps

    Add comment
    10|10000 characters needed characters exceeded