cancel
Showing results for 
Search instead for 
Did you mean: 

Reuse View 2 of App 2 in View 1 of App1

former_member196942
Participant
0 Kudos

Hi All,

I have 2 applications in my fiori launchpad:

App1 which has View 1

App2 which has View 1 & View 2.

In the View1 of App1 I have Icon Tab Bar and on the click of the Icon Tab I want to load the View 2 of App2. Meaning I want to embed/reuse the same xml view of App2 in App1,

Please note:

So far, I have tried 2 approaches:

  1. var oComp = sap.ui.getCore().createComponent( {

name : "hc.pe.manageaccounts",

id : "Comp4",

url : "/hcpemanageaccounts",
componentData : {

"targetViewName" : "CreateUser"

}

});

this.oCompContainer = new sap.ui.core.ComponentContainer("oCompEdit", {

component: oComp,

propagateModel: true,

height: "50%"

});

this.oCompContainer.placeAt(this.getView().byId("id"));

https://archive.sap.com/discussions/message/16627714#16627714

This approach, give me the component instance.

2. Using the "resourceRoots", in the manifest.json: THis approach only searches the local resources folder of the current application.

3. I also tried, registerResourcePath and jquery.sap.require,but could not get the solution.

Any help will be highly appreciated.

Accepted Solutions (1)

Accepted Solutions (1)

Ryan-Crosby
Active Contributor
0 Kudos

Hi Priya,

I have done something like this in some prototyping and the only thing I had to do was do call registerModulePath("some name", "server path") in the Component.js file where I want to add the view from the other application. Then in the init function of the controller I create the component and place it into the view like so:

var component = sap.ui.getCore().createComponent({
                name: "some name"
            });
            var oCompCont1 = new sap.ui.core.ComponentContainer({component: component});
            oCompCont1.placeAt(view.byId("somePage"));

Regards,

Ryan Crosby

Answers (0)