简体   繁体   中英

Add Custom SAPUI5 Library to SAP Cloud Platform Fiori Launchpad (Portal Service)

I've created a custom SAPUI5 library with the SAP Web IDE and deployed the library to the SAP Cloud Platform. The library is used by multiple SAPUI5 applications and works perfect when the apps are launched from the SAP Web IDE. The dependency to the library is defined in the manifest.json of each application:

"dependencies": {"libs": {"custom.library"}: {}}}

Furthermore I've already added the correct path to the file neo-app.json .

Now I've registered the SAPUI5 applications to the SAP Cloud Platform Fiori Launchpad. I can start the Launchpad and see the tiles for the apps. But when I start an app the following error occurs: Error: failed to load 'custom/library/library.js' from https://sapui5.hana.ondemand.com/1.52.17/resources/custom/library/library.js : 404

How can I register the custom UI5 library to the Fiori Launchpad?

On SAP Community, you'll find this blog about the SAPUI5 Custom control library. There it says that you need to add an entry into “routes” array of neo-app.json file for your newly deployed library. The entry shall look like this:

{
       "path": "/webapp/resources/my/custom/control",
       "target": {
             "type": "application",
             "name": "mycustomlib", 
             "entryPath": "/"
       },
       "description": "Custom control library"
}

Here, “path” is the path you use in the dependency definition of your controller JS file. “name” in “target” clause contains the name under which you deployed the library into SAP Cloud Platform.

As SAP Fiori Crew pointed out, you need to create a route entry in neo-app.json for the SAP Cloud Platform router to know where to serve your library files from when requested by the applications.

A good way to find out the exact URL that needs to be added is checking the Network requests in your browser's Developer Tools, when trying to load the application in the Launchpad:

对Cloud Fiori启动板中的library-preload.js的请求失败

In the example above, adding this entry to neo-app.json solved the problem:

{
    "path": "/sap/ui5/1/resources/vplanner/common",
    "target": {
        "type": "application",
        "name": "vpfioricommon"
    },
    "description": "Common Library"
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM