Skip to Content
avatar image
Former Member

Add an entity in sapui5

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

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
    Add comment
    10|10000 characters needed characters exceeded