Skip to Content

OData Context Binding undefined for Odata v4 service

5 days ago


avatar image

Hello All,

I am new to UI5 and still exploring.

What i have done so far:

-> Create a DB schema

-> Created a OData V4 using Java SDK - which can perform CRUD operation.

-> Created desitination for the Odata service

-> I have tested it working by creating a demo view with table and displays all the items with item aggregation - list binding


-> My actual requirement is to create a UI5 application with a simple view with 4 input fields and a save button.

-> When i click on Save it should perform the binding and save the data in the backend database.

-> Below is the code i have written so far for the controller but it is not working. Can someone suggest on what should be code to make the save button working.

], function(Controller, utils, JSONModel) {
	"use strict";

	return Controller.extend("book.BookAdd.controller.Add", {
		onInit: function() {
			var oModel = new JSONModel({
				data: {
					"bookId": parseInt(utils.generateRandomNumber(100, 9999)),
					"bookName": "",
					"isbn": "",
					"price": undefined,
					"priceCurrency": utils.getDefaultCurrencyCode(),
					"authorName": ""

			this.getView().setModel(oModel, 'addModel');


		onSave: function() {
			var oView = this.getView();
			var self = this;
			var oBinding = this.oView.byId("simpleFormChange").getBinding({path: "/Book"});
			var oDModel = oView.getModel();
			var oContext = oBinding.create(;

		onCancel: function() {


10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers