Skip to Content

Master Detail App Cannot read property 'getValue' of undefined in Controller

Hi Experts,

I am using a template of Master Detail Application for one my application, I want to update table by using Approve Semantic button for this i am using Update.Model function but when i get value for this i got error Can't read Property 'GetValue' of undefined. I know i am making very Basic Mistake here but i already Browsed so much but couldn't find any clue to solve this issue . Thanks in Advance.

], function (BaseController, JSONModel, formatter) {
"use strict";
return BaseController.extend("zbps.controller.Detail", {
formatter: formatter,
/* =========================================================== */
/* lifecycle methods                                           */
/* =========================================================== */
onInit : function () {
// Model used to manipulate control states. The chosen values make sure,
// detail page is busy indication immediately so there is no break in
// between the busy indication for loading the view's meta data
var oViewModel = new JSONModel({
busy : false,
delay : 0,
lineItemListTitle : this.getResourceBundle().getText("detailLineItemTableHeading")
this.getRouter().getRoute("object").attachPatternMatched(this._onObjectMatched, this);
this.setModel(oViewModel, "detailView");
onSemanticButtonPress: function (oEvent) {
//var oViewModel = sap.ui.getCore().getModel("oViewModel"); 
var oViewModel = this.getModel("detailView"); 

var that = this;
// CREATE******************
if ("Approve" == oEvent.oSource.mProperties.text) {
var obj = {};

"ERROR"  Cannot read property 'getValue' of undefined in Controller"
obj.Belnr = that.getView().byId("Belnr").getValue(); " Error Point  <<<<<<<-----
obj.Gjahr = that.getView().byId("Gjahr").getValue(); 
//obj.Gjahr = "2018";
var updateurl = "/MasterBPSSet(Belnr='"
+ that.getView().byId("Belnr").getValue() + "')";

oViewModel.update(updateurl, obj , null);

var sAction = oEvent.getSource().getMetadata().getName();
sAction = sAction.replace(oEvent.getSource().getMetadata().getLibraryName() + ".", "");"Pressed: " + sAction);
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

0 Answers

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.