Skip to Content

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

Error in Eclipse while reading NW service

Hello Experts, I developed a web service in the backend(SAP). I am planning to use the READ(GET) operation in the SAP UI5 application. However, i got stuck up at an issue which says " Uncaught Error: failed to load 'Zempcrud/EmpDetails.view.js' from ./Zempcrud/EmpDetails.view.js: SyntaxError: Illegal return statement I used an MVC approach and my view name is : EmpDetails and my project name is ZEMPCRUD. I followed the steps as shown in link "http://scn.sap.com/docs/DOC-61821#comment-583702" Can someone tell me what wrong did i do and where to correct it? Thanks

replied

Hi,

Write this code in view and check it's working.

       createContent : function(oController) {

              var oPage = new sap.m.Page({ title : "Employee Details" }); // Table or Dashboard to show Employee Data

              var oTable = new sap.m.Table({

// id : "Employees",

               itemPress : [ oController.ItemPress, oController ],

              columns : [

              new sap.m.Column({

              width: "1em",

              header: new sap.m.Label({ text : "Emp ID"  })

               }),

              new sap.m.Column({

              width: "1em",

              header: new sap.m.Label({ text : "Name"  })

               }),

               new sap.m.Column({

               width: "1em",

               header: new sap.m.Label({ text : "Address"  })

              }),

               new sap.m.Column({

               width: "1em",

               header: new sap.m.Label({ text : "Designation"  })

               }), ]

              });

              oPage.addContent(oTable);

              return oPage;

}



Also don't forget to write this code in controller.


sap.ui.controller("demo11.EmpDetails", {

  itemPress: function(oController){

  }

});

Regards

Dhananjay

0 View this answer in context

Helpful Answer

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