0% found this document useful (0 votes)
62 views

Odata Code

The document contains code for performing OData operations including read, create, update, delete, and batch operations on a SAP backend system. The read operation retrieves data from a "/ZFD_REGIONSSet" path and binds it to an OData model and table. The batch section shows how to create batch operations to send multiple requests to the backend in one call by adding operations to an array and submitting the batch.

Uploaded by

miltongh
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views

Odata Code

The document contains code for performing OData operations including read, create, update, delete, and batch operations on a SAP backend system. The read operation retrieves data from a "/ZFD_REGIONSSet" path and binds it to an OData model and table. The batch section shows how to create batch operations to send multiple requests to the backend in one call by adding operations to an array and submitting the batch.

Uploaded by

miltongh
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

// ODATA Read

var metaURL = "http://10.40.3.188:8000/sap/opu/odata/sap/ZFD_ORDER_COUNT_1_SRV";


var oDataModel = new sap.ui.model.odata.ODataMod
el(metaURL, true,"","");
var sPath = "/ZFD_REGIONSSet";
oDataModel.read(sPath, null, null, true, funct
ion(oEv) {
console.log(oEv);
var oModel= new sap.ui.model.json.JSON
Model();
oModel.setData(oEv);
oTable2.setModel(oModel,"nameModel");
oTable2.bindRows("nameModel>/results")
;
}, function(oEv) {
console.log(oEv);
});
// ODATA CREATE
//ODATA UPDATE
//ODATA DELETE
//ODATA BATCH
Code for batch calls
var oModel = this.getView().getModel();
var path = "EntitySet";
var data = "dataobject that has to send to back end"
var batch = oModel.createBatchOperation(path,"POST/PUT/GET/DELETE",data,null);
batchArray.push(batch);
oModel.addBacthChangeOperations(batchArray);
oModel.submitBatch(function(response){}, function(oError){});

You might also like