Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

getting error as app.addPage while creating fiori like apps


While creating fiori like apps .I am getting following error at, true);   as

Error Msg: Uncaught TypeError: Cannot read property 'addPage' of undefined



sap.ui.jsview("sap.ui.demo.myFiori.ui5component.UI5", {

  getControllerName : function() {

  return "sap.ui.demo.myFiori.ui5component.UI5";


createContent : function(oController) {

  var app = new sap.m.App();


  var master = sap.ui.view({id:"Master",

  viewName:"sap.ui.demo.myFiori.ui5component.master", type:sap.ui.core.mvc.ViewType.JS});

  master.getController().nav = this.getController();, true);

  var detail = sap.ui.view({id:"Detail",

  viewName:"sap.ui.demo.myFiori.ui5component.detail", type:sap.ui.core.mvc.ViewType.JS});


  detail.getController().nav = this.getController();;


  return app;





sap.ui.jsview("sap.ui.demo.myFiori.ui5component.master", {

  getControllerName : function() {

  return "sap.ui.demo.myFiori.ui5component.master";


  createContent : function(oController) {

  var list1 = new sap.m.List({

  id : "master", inset: false,

  press : function(oevent)

  {oController. handleListItemPress();}


  var template = new sap.m.StandardListItem({

  title : "{SoId}"


  list1.bindItems({path : "/SalesOrderCollection",template :template} );

  return list1;



sap.ui.controller("sap.ui.demo.myFiori.ui5component.master", {

  handleListItemPress : function (evt) {

  var context = evt.getSource().getBindingContext();"Detail1", context);





Former Member
Former Member replied

As explained by Dennis, it's really two different things. assigns a member variable/ property to the object (in your case, the UI5 view object). In other programming languages like Java, it would be the same (, on ABAP, it would be me->app.

var app instead creates a local variable (within the scope of the function). In Java, this would again be something like Object app = ... and in ABAP, it would be something like DATA lv_app TYPE ...

Let me stress again that and app are really two different things. To make your code work, it's important to use either one consistently through the createContent function.

- Max

0 View this answer in context

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question