on 10-26-2015 6:34 AM
Hello Experts,
I develop a SAP FIORI Custom Application, this is working fine without any issue when we run it directly by its URL.
But problem is that when I am running it by FIORI Launch Pad I am getting the following error (still functionality working fine) when navigate from one view to another.
And getting following errors in Console –
2015-10-26 11:11:31 Illegal new hash - cannot be parsed: 'page|{"id":"Detail"}|0' - sap.ushell.renderers.fiori2.Shell.controller core-min-0.js:85
core-min-0.js:85 2015-10-26 11:11:31 Could not open app. Try again later. - core-min-0.js:85
I am using getEventBus() Method for navigation so the bus subscription code is in App.view.Controller as following.
onInit: function() {
var bus = sap.ui.getCore().getEventBus();
bus.subscribe("nav", "to", this.navHandler, this);
},
navHandler : function(channelId, eventId, data) {
if (eventId === "to") {
if (!data.id) {
jQuery.sap.log
.error("'nav to' event cannot be processed. data.id must be given");
}
this.navTo(data.id, data.data, true);
} else if (eventId === "back") {
if (!data.step) {
data.step = 1;
}
if (data.home) {
jQuery.sap.history.backToHash("");
} else if (data.step > 0) {
jQuery.sap.history.back(data.step);
} else {
jQuery.sap.log
.error("'nav back' event cannot be processed. At least one from [data.step, data.home] must be given with valid value");
}
} else if (eventId === "virtual") {
jQuery.sap.history.addVirtualHistory();
} else {
jQuery.sap.log
.error("'nav' event cannot be processed. There's no handler registered for event with id: "
+ eventId);
}
},
navTo : function(id, data, writeHistory) {
if (id === undefined) {
// invalid id
jQuery.sap.log
.error("navTo failed due to missing id");
} else {
// load view on demand
var app = this.getView().app;
if (app.getPage(id) === null) {
var type = ("Home" === id) ? "JS" : "XML";
var page = sap.ui.view({
id : id,
viewName : "com.abc.view." + id,
type : type
});
app.addPage(page);
jQuery.sap.log
.info("app controller > loaded page: "
+ id);
}
// navigate in the app control
var transition = ("Update" === id) ? "show"
: "slide";
app.to(id, transition, data);
// write browser history
if (writeHistory === undefined || writeHistory) {
var bookmarkable = false;
var stateData = {
id : id
};
jQuery.sap.history.addHistory("page",
stateData, bookmarkable);
}
// log
jQuery.sap.log.info("navTo - to page: " + id);
}
},
And navigation code from one to other is as below –
handleListItemPress : function (evt) {
var cust_no = evt.getSource().mProperties.title;
var cust_name = evt.getSource().mAggregations.attributes[0].mProperties.text;
var cust_city = evt.getSource().mAggregations.attributes[1].mProperties.text;
var bus = sap.ui.getCore().getEventBus();
bus.publish("nav", "to", {
id : "Detail",
data : {
cust_no : cust_no,
cust_name : cust_name,
cust_city : cust_city
}
}), sap.ui.getCore().getEventBus().publish("app", "RefreshDetail", {
context : evt.getSource().getBindingContext(),
cust_no : cust_no,
cust_name : cust_name,
cust_city : cust_city
});
},
I don’t know where I am wrong, if you find any solution for it please help me.
Thanks & Regards,
Imran Ali
Hi Imran,
There are few design guide lines for Fiori like apps development. Until and unless we follows those, our custom apps will not work as standard SAP apps.
First principle is to use component.js file to decide the navigation and context parameters within Fiori like app. Because in Fiori only Fiori launchpad.html is the html file which will be acts as shell to hold all fiori apps. So your responsibility is to just add component.js file with all possible routes and link your component file in your launchpad through lpd_cust transaction SAPUI5.Component=Custom UI Component name.
Fiori apps launch process happens through semantic object navigation so please make sure that you have created a custom semantic object through the transaction /UI2/SEMOBJ to launch your application.
Please verify above points.
Regards,
Arun.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Imran,
Are you using component based structure for your custom app ? If yes, from your attached screenshots for LPD_CUST role SAPUI5.Component value seems to be set to some incorrect component value. You need to give actual name of component.js with complete namespace to resolve the path. From your error screenshots also, It is showing problem with your component file path. Please verify one more time.
Regards,
Arun.
Hi Imran;
Could you please share your Target mapping settings and LPD_CUST settings using screenshots.
Seems like an issue with type of application selected in target mapping.
Make sure "SAPUI5.Component=" parameter is mentioned correctly in LPD_CUST
Regards,
Sarbjeet Singh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Imran;
Thanks for the information.
You could try one thing.
We should not use globaleventbus for the applications running in fiori launchpad as the same event could be handled by some other evenhandler present in the FLP.
nav as the channel name and to as the event name could be creating the problem. try using some other event name and channel name like Znav and Zto and try again.
Important link explaining wht all we need to take care while developing applications running inside FLP is as below
Regards,
Sarbjeet Singh
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.