Skip to Content

Add an entity in sapui5

Mar 20, 2017 at 05:11 PM


avatar image
Former Member

I am working on a sap fiori app & i want to give the user the possiblity to create a notification concerning a certain material. Unfortunately, the method doesn't work & i have no idea why

Here's my code :

saveChanges: function() {
    var oModel = this.getView().getModel();
    var oParam = {};
    var frag = sap.ui.core.Fragment.byId(this._fragmentName, "Equnr_id").getValue();
    var frag1 = sap.ui.core.Fragment.byId(this._fragmentName, "Qmtxt_id").getValue();
    var frag2 = sap.ui.core.Fragment.byId(this._fragmentName, "Qmdat").getValue();
    alert(frag+" "+frag1+" "+frag2);
    oParam.Equnr = frag;
    oParam.Qmtxt = frag1;
    oParam.Qmdat = frag2;
    oModel.create("/avisSet", oParam,{

   success : function() {" Created Successfully" );},
   error : function() {" Creation failed" );}

        }); }

I don't know exactly what the problem is.. when i press the button "savechanges" , a messagetoast appears saying Creation failed

10 |10000 characters needed characters left characters exceeded

When you press the save changes button what error message do you see in the browser console?

* Please Login or Register to Answer, Follow or Comment.

1 Answer

avatar image
Former Member Mar 21, 2017 at 12:05 AM

You need to check a parameter of a callback function 'error'.

Edit callback function like this

error : function(oError ) {
 //check oError here
10 |10000 characters needed characters left characters exceeded