sapui5sap-fiorisap-cloud-platform

Extended application descriptor file and invalid datasource


I have two applications:

The hrportalcore has the namespace de.example.core and there are the dataSources also maintained. (sap.app.dataSources in manifest.json). The datasource is:

[...]
"HRPOJavaLeave": {
   "uri": "<path>",
   "type": "OData",
   "settings": {
       "annotations": [],
       "odataVersion": "2.0",
       "localUri": ""
   }
}
[...]

The datasources can be used without any problems in the extended application but the console brings the following errors:

enter image description here

It says the datasource contains errors, but it can be used (strange?).

Another thing is, that the Component-preload.js file is loaded from a wrong place once a time. The application works without problems, but it is - as said - loaded once from a wrong location?

My manifest.json of the hrportalrequestleave looks like in the extension part (sap.ui5.extends):

[...]
"extends": {
    "component": "de.example.core",
    "extensions": {}
},
[...]

The parent is defined rightly in the neo-app.json as /parent to show to hrportalcore.

jQuery.sap.declare("de.example.request.leave.Component");

// use the load function for getting the optimized preload file if present
if (!jQuery.sap.isDeclared("de.example.core.Component")) {
    sap.ui.component.load({
        name: "de.example.core",
        // Use the below URL to run the extended application when SAP-delivered application is deployed on cloud
        url: jQuery.sap.getModulePath("de.example.request.leave") + "/parent"
            // we use a URL relative to our own component
            // extension application is deployed with customer namespace
    });
}

this.de.example.core.Component.extend("de.example.request.leave.Component", {
    metadata: {
        manifest: "json"
    }
});

This all happens in the Fiori Launchpad of HANA Cloud Platform


Solution

  • Solution

    manifest.json of hrportalcore: Always use the up-to-date version which you have deployed on your HCP in the applicationVersion property:

    {
        "_version": "1.2.0",
        "sap.app": {
            "_version": "1.2.0",
            "applicationVersion": {
                "version": "1.6.2"
            },
    ...
    

    manifest.json of hrportalrequestleave (Extension project): As above, always use the up-to-date version which you have deployed on your HCP in the applicationVersion property.

    DataSource not found?!

    If you have a extension project (like hrportalrequestleave < hrportalcore), then the manifest.json of both applications are merged like jQuery.extend(...). All properties, expect the sap.app tree, because it describes really the application and can not be copied from parent extension.

    Now, when you use a dataSource from the parent extension, it will not be found. That means for you, you must define the sap.app.dataSources in the extension project manifest.json.