Skip to Content
0

How can I combine two different applications into one in SAPUI5?

Nov 14, 2017 at 09:03 AM

41

avatar image
Former Member

Hello everyone,

I am totally new in SAPUI5 and doing an intership now in a company. I want to reuse the view from one application in another application. I have already read so many Q&A and I tried to write some small tests. However, it doesn't work and I still don't understand how it works.

My code is below:

<script

      id="sap-ui-bootstrap"

      src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js"

      data-sap-ui-theme="sap_belize"data-sap-ui-libs="sap.m"

      data-sap-ui-compatVersion="edge"data-sap-ui-preload="async"

      data-sap-ui-resourceroots='{

           "sap.ui.demo.wt": "./",

           "sap.ui.demo.mt": "../test2"}'>

</script>

<script>

      sap.ui.getCore().attachInit(function () {

         new sap.ui.core.ComponentContainer({

             name: "sap.ui.demo.wt"

      }).placeAt("content");});
      var oComp = sap.ui.getCore().loadLibrary("test2").createComponent({ 
          name: "test2",        

          id: "Comp2",

          settings: {appTitle: "Hello World 2"}        });

         var oCompCont = new sap.ui.core.ComponentContainer("CompCont2", {                 component: oComp

        });

        oCompCont.placeAt("content");

</script>

As you can see, I want to add the view from another application with namespace sap.ui.demo.mt into the current view(application), but it doesn't work. So I think maybe both of the applications don't know each other, because they are totally two separaed applications. So, I tried to change the relationship of those two applications into a parent-son relationship which means I put one of them under the folder of the other one. It's still failed. Should I register the component first? However, I don't know how to register a component from one application. I have read many documents in internet, but they don't have a clear guidelines for us to follow. Have someone maybe an example for me to reference?

Thanks in advance.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers