Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to bind table data to Odata without selecting row index

Hi Experts,

I want send table data to backend(ODATA) without selecting index.

ex. if have 100 records it should bind at time

i gone through this link

How to send table data to Odata | SCN

here they are sending invidual values and hard coded the data.

i don,t know how to get table data and push it to ODATAModel on click of Button.

Example without using table data:

function batchTest(){   

    var sServiceUrl = "services/employee.xsodata"; 


    var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl, true); 


    var oEmp1 = { 

                "EmployeeId": "0000000014", 

                "FirstName": "Laura", 

                "LastName": "Hahn" 


    var oEmp2 = { 

                "EmployeeId": "0000000015", 

                "FirstName": "Matthias", 

                "LastName": "Müller" 



    var batchChanges = [];   


    batchChanges.push( oModel.createBatchOperation("Employees", "POST", oEmp1) );   

    batchChanges.push( oModel.createBatchOperation("Employees", "POST", oEmp2) );   




    oModel.submitBatch(function(data) {   



        if (data.__batchResponses[0].__changeResponses) { 

            alert("Inserted " + data.__batchResponses[0].__changeResponses.length + " Employee(s)");   

        } else { 




    }, function(err) {   

      alert("Error occurred", err);   


var oButton = new sap.m.Button({ 

        text : "Batch Input", 

        tooltip : "trigger batch input", 

        press : batchTest 


Thanks & Regards,



Personally, I would never ever use getCells()... Rather use the model property directly:

var aTableData = this.byId("myTable").getModel().getData();

for (i = 0; i < aTableData.length; i++) {

    var oEmp = {

        "EmployeeId" : aTableData[0].EmployeeId,

        "FirstName"  : aTableData[0].FirstName,

        "LastName"   : aTableData[0].LastName


    batchChanges.push(oModel.createBatchOperation("Employees", "POST", oEmp));


(I assumed your table data uses the same property names as the POST data)

2 View this answer in context

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question