0

I am new in SAPUI5. I have recently registered a trial account from SAP in order to use their SAP web IDE. How to separate one application from another application which is in use. I have read some articles from the internet, and try to write a small test. However, it doesn't work.

The below code is from test 1.

data-sap-ui-resourceroots='{
        "sap.ui.demo.wt",
        "sap.ui.demo.mt"
}'>
</script>
</script>
<script>
    sap.ui.getCore().attachInit(function () {
        new sap.ui.core.ComponentContainer({
            name: "sap.ui.demo.wt"
        }).placeAt("content");
    });

    var oComp = sap.ui.getCore().createComponent({
    name: "sap.ui.demo.wt",
    id: "Comp2",
    settings: {appTitle: "Hello World 2"}
    });

    var oCompCont = new sap.ui.core.ComponentContainer("CompCont2", {
             component: oComp
    });
    oCompCont.placeAt("content");

</script>

The below code is from test 2.

data-sap-ui-resourceroots='{
    "sap.ui.demo.mt": "./"
}'>
</script>
<script>
    sap.ui.getCore().attachInit(function () {
        new sap.ui.core.ComponentContainer({
            name: "sap.ui.demo.mt"
        }).placeAt("content");
    });
</script>

I know that there is some problems within data-sap-ui-resourceroots, because two applications can not recognize the path from the others. Thus, I let test 1 as a under folder in test 2. However, when I run test 1 which located under test2, the console showed only one time test 2. How can I solve it. Do I need to register the component first?

Nigel Ren
  • 56,122
  • 11
  • 43
  • 55
  • https://blogs.sap.com/2017/04/05/sapui5-how-to-reuse-parts-of-a-sapui5-application-in-othermultiple-sapui5-applications/ Read the post and the comments there for more information. – Marc Nov 09 '17 at 08:44

1 Answers1

0

You can do it using UI5 AMD

jQuery.sap.registerModulePath

You can create extension also.Just right click on the app and create a new extension project. Using extension you have more control over the view and controller

  • Hi Sujoy, thanks for reply. I'm now trying to use this method. However, I still have some questions. In this case, I have registered the component in test2 in init function. And then, I try to call it out in index.html from test 1. what input should I write in data-sap-ui-resourceroots? Until now, test1 still can't recognise the source from test 2. Thanks in advance. – Kwai Fan Lam Nov 09 '17 at 11:37