Skip to Content

CreateEntry method

Aug 14, 2017 at 01:59 PM


avatar image

Hello dear Experts,

I am confused, but I can't achieve what seems to be a simple task. Here are my requirements :

I am currently designing a simple "create" application using SAPUI5 against NW Gateway oData, through SAP Cloud Network. This application should be a single page, reachable via a simple link.

My starting point is the basic "Worklist" template, which seems to be the most comprehensive template to start with... That said, it is far from beeing that intuitive... (no offense :)).

I am trying to use the "createEntry()" method which will, as far as I understand, create me an "empty" entity, or "temporary object" based upon my oData collection.

My app setting is based upon the manifest.json file.

My component.js is no more that the template-generated one :

In my init() method of my controller, i call this :

this.getRouter().getRoute("create").attachPatternMatched(this._onCreate, this);

the _onCreate() method is defined as :

_onCreate: function(oEvent) {
			var oContext = this.getView().getModel().createEntry("/CustomerSet", {
				success: this._fnEntityCreated.bind(this),
				error: this._fnEntityCreationFailed.bind(this)

I get this error in my console log :

I also tried instead of calling the attachPatternMatched() method :


But it seems no better :(.

Is anyone has an idea please ? Is there any comprehensive documentation on basic generated templates and why are each code lines is called ?

Thank you for your help.



manifest.png (5.9 kB)
component.png (29.3 kB)
error.png (3.6 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Srikanth KV Aug 14, 2017 at 03:58 PM

From the error it is clear that before metadata is loaded you are trying to create entry. To avoid this error create the entry after checking that metadata is loaded.

_onCreate: function(oEvent) {
     var oModel = this.getView().getModel();
     var that = this;
			var oContext = oModel.createEntry("/CustomerSet", {
				success: that._fnEntityCreated.bind(this),
				error: that._fnEntityCreationFailed.bind(this)
10 |10000 characters needed characters left characters exceeded
Olivier Souksamran Aug 16, 2017 at 08:30 AM

Thank you Srikanth !

10 |10000 characters needed characters left characters exceeded