Skip to Content

POST in ODate Service

Hi all,

I have a simple form with input fields. The values of these fields I want to post via odata service into my backend by clicking a button. It´s my first post function and I don´t know how to use "oDataModel.createEntry" function (is this the right one?). Can anybody help my?

Here is my code:

var oButton = new sap.m.Button({

  text: "Post",

  press: function(){

  var postURL = "/sap/opu/odata/bao/sc_api_ldr_srv/";

  var oDataModel = new sap.ui.model.odata.ODataModel(postURL, true);

  var newData = {

  "odata.type": "/BAO/SC_API_LDR_SRV.LDR",

  "ProcessID": sap.ui.getCore().byId("ProcessID").getValue(),

    "IBAN": sap.ui.getCore().byId("IBAN").getValue(),

    "CustomerName": sap.ui.getCore().byId("CustomerName").getValue(),

    "AccountHolderName": sap.ui.getCore().byId("AccountHolderName").getValue(),

  "CustomerID": sap.ui.getCore().byId("CustomerID").getValue(),

    "LoanContractID": sap.ui.getCore().byId("LoanContractID").getValue(),

    "DisbursementCurrency": sap.ui.getCore().byId("DisbursementCurrency").getValue(),

    "DisbursementValue": sap.ui.getCore().byId("DisbursementValue").getValue()





Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Oct 25, 2015 at 01:09 AM

    Hi Matthias,

    You could use it like this:

    var onSuccess = function(){myAnimationIndicator.stop();};

    var onError = function(){myAnimationIndicator.stop();};

    var reqHeaders = {

                        context: this,// mention the context you want

                        success: onSuccess, // success call back method

                        error: onError, // error call back method

                        async: true // flage for async true


    // show the loader here


    oODModel = new sap.ui.model.odata.ODataModel(myUrl);

    oEntry = myNewDataEntry;

    oODModel.create('myDataSet',oEntry, reqHeaders );

    Also check this thread: SAPUI5: How to make an asynchronous OData .crea... | SCN

    Kind regards,


    Add comment
    10|10000 characters needed characters exceeded

  • Oct 24, 2015 at 11:25 PM
    Add comment
    10|10000 characters needed characters exceeded