Wednesday, 2 September 2020

How to use an SAPUI5 application in another one as component (without duplicating the whole code of the application)?

Environement

Framework : SAPUI5 V1.38.39
IDE : SAP WEB IDE

Problem

I want to use a SAPUI5 application in another one, in order to do so I found the following resource: https://blogs.sap.com/2017/04/05/sapui5-how-to-reuse-parts-of-a-sapui5-application-in-othermultiple-sapui5-applications/

Code

in component.js in init I used :

var sPath = sHostUrl.includes("webidetesting") ? "https://gtyext.net" : sHostUrl;
jQuery.sap.registerModulePath("ztntapp", `${sPath}/sap/bc/ui5_ui5/sap/ztntapp/`);

And in my view :

<core:ComponentContainer 
    name="ztntapp" 
    manifestFirst="true" 
    component="ztntapp">
</core:ComponentContainer>

and in neo-app.json

{
    "path": "/sap/bc/ui5_ui5/sap/ztntapp/",
    "target": {
        "type": "destination",
        "name": "gtyext_net",
        "entryPath": "/sap/bc/ui5_ui5/sap/ztntapp/"
    },
    "description": "namespace.tntapp Resources"
}

Error message

Uncaught Error: failed to load 'ztntapp/Component.js' from https://webidetesting278-a392f.dispatcher.hana.ondemand.com/sap/bc/ui5_ui5/sap/ztntapp/Component.js: Error: failed to load 'TrackAndTrace/ztntapp/model/models.js' from resources/TrackAndTrace/ztntapp/model/models.js

Points with neo-app.json :

Other research

  • With the neo-app.json file, the problem is to locate the resource from the "ztntapp", I seen that there is also a jQuery.sap.registerResourcePath but I am not sure how to use it for this case


from How to use an SAPUI5 application in another one as component (without duplicating the whole code of the application)?

No comments:

Post a Comment