on 10-24-2015 11:46 PM
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()
};
oDataModel.createEntry(...
}
});
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
myAnimationIndicator.start();
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,
Wouter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Matthias
it is oDataModel.create(...)
JsDoc Report - SAP UI development Toolkit for HTML5 - API Reference - sap.ui.model.odata.ODataModel
Thanks
-D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.