cancel
Showing results for 
Search instead for 
Did you mean: 

How to add new view in extended fiori leave request application and navigate to the view

vijayaraghavan_m
Explorer
0 Kudos

Hi Experts,

We have extended the standard leave request Fiori application.

When I try to add new view and navigate using routes, I'm not able to do so.

Below is the error message from Console.

"Control with ID Application could not be found - EventProvider sap.m.routing.Target"

Could you please help in achieving the same.

We have extended leave request v2 and created new 'z' bsp application.

Thanks,

Vijay

maheshpalavalli
Active Contributor
0 Kudos

can you provide the code that you have used to add view in routing and how you called it.

Accepted Solutions (0)

Answers (3)

Answers (3)

vijayaraghavan_m
Explorer
0 Kudos

Hi Mahesh,

Please find below code. "declaration" is the second view name.

Controller.js

handleDeclaration: function (oEvent) {

/this.oRouter.navTo("declaration", {});

var sUrl = "#" + this.getOwnerComponent().getRouter().getURL("declaration");

this.byId("idDeclarationLink").setHref(sUrl);

this.getOwnerComponent().getRouter().navTo("declaration");

}

Component.js

hcm.myleaverequest.Component.extend("hcm.myleaverequest.zhcm_lrq_cre.Component", { metadata: { version: "1.0", includes: ["css/style.css"], config: { "sap.ca.i18Nconfigs": { "bundleName": "hcm.myleaverequest.zhcm_lrq_cre.i18n.i18n" }, }, customizing: { "sap.ui.viewReplacements": { "hcm.myleaverequest.view.S1": { viewName: "hcm.myleaverequest.zhcm_lrq_cre.view.S1Custom", type: "XML", }, }, "sap.ui.controllerExtensions": { "hcm.myleaverequest.view.S6B": { controllerName: "hcm.myleaverequest.zhcm_lrq_cre.view.S6BCustom", }, "hcm.myleaverequest.view.S1": { controllerName: "hcm.myleaverequest.zhcm_lrq_cre.view.S1Custom", }, "hcm.myleaverequest.view.S1-dbg": { controllerName: "hcm.myleaverequest.zhcm_lrq_cre.view.S1-dbgCustom", } } } }, init: function () { hcm.myleaverequest.Component.prototype.init.apply(this, arguments);
// Parse the current url and display the targets of the route that matches the hash
// this.getRouter().getTargets().addTarget("declarationTarget", { // viewName: "Declaration", // viewPath: "hcm.myleaverequest.zhcm_lrq_cre.view" // });
this.getRouter().addRoute({ name: "declaration", pattern: "declaration", targetAggregation: "pages", targetControl: "Application", view: "Declaration", viewLevel: 2, viewPath: "hcm.myleaverequest.zhcm_lrq_cre.view" });
this.getRouter().initialize(); } });

Awaiting your response.

Thanks,

Vijay

vijayaraghavan_m
Explorer
0 Kudos

Hi Shree Krishan,

Thanks for your reply. I have tried the solution in the link.

But still it is not working for me.

Please note that we are using the V2 version of leave request.

Regards,

Vijay

krish96
Explorer
0 Kudos

Hi Vijayaraghavan M,

I hope this link might help you

Error : Control with ID App could not be found - EventProvider sap.m.routing.Target

If the problem still persists let me know.

Thanks and Regards

Shree Krishna