Skip to Content
0

Add an entity in sapui5

Mar 20, 2017 at 05:11 PM

37

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() { sap.m.MessageToast.show(" Created Successfully" );},
   error : function() { sap.m.MessageToast.show(" 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?

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

1 Answer

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

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

Edit callback function like this

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