Skip to Content
-1

SAPUI5 - Is it better to have just one oData dataSource?

My app's controllers mostly call one dataSource with no issues.

One of them, however uses 3 seperate datasources, and sometime returns 403 Forbidden errors when accessing them.

<code>"dataSources": {
        "ZSV_SURVEY_SRV": {
            "uri": "/SAPUI5-ABAP-SFI/sap/opu/odata/sap/ZSV_SURVEY_SR/",
            "type": "OData",
            "settings": {
                "odataVersion": "2.0",
                "localUri": "localService/metadata.xml"
            }
        },
        "ZRUI_COMMON_SRV": {
            "uri": "/SAPUI5-ABAP-SFI/sap/opu/odata/sap/ZRUI_COMMON_SRV/",
            "type": "OData",
            "settings": {
                "odataVersion": "2.0",
                "localUri": "localService/ZRUI_COMMON_SRV/metadata.xml"
            }
        },
        "ZTC_SHOP_TRADING_CALENDAR_SRV": {
            "uri": "/SAPUI5-ABAP-SFI/sap/opu/odata/sap/ZTC_SHOP_TRADING_CALENDAR_SRV/",
            "type": "OData",
            "settings": {
                "odataVersion": "2.0",
                "localUri": "localService/ZTC_SHOP_TRADING_CALENDAR_SRV/metadata.xml"
            }
        }
    }

Would it be better to incorporate the methods all into one dataSource (e.g. ZSV_SURVEY_SRV? or should 3 separate dataSources be fine and present no problems?

If 3 dataSources are fine, why do I sometime get the 403 error?

Is there a performance advantage either way?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Nov 27, 2017 at 02:39 PM

    Hi,

    It’s better to make single call by merging the all into one. Because while loading the application it’ll call to the backend 3 to times to get the metadata. So better go with the one.

    Or else you can make metadata Call ASYNCHRONOUS so that it should not reduce app loading time use this link Click here

    There’s one more way but I don’t know how to do it. You can create local metadata file and load it in manifest.json file other than calling backend systems.

    Hope this information is clear for you.

    Add comment
    10|10000 characters needed characters exceeded