Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3523

Posting data in batch/bulk using OData services in SAPUI5

$
0
0

Hello UI5 people,

I hvae been trying to post data in bulk but with no luck. Went through few links but still not able to figure out how to do this right. Can anyone guide me step by step.

 

Links i checked out are:

Gateway Batch calls from SAPUI5,

and SAPUI5 demokit (official website)

 

Following is the code snippet, while running this neither data is being posted at the backend nor i am getting any error message.

Please help me out with this.

Code:

 

var batchChanges = [];

var rowLen = sap.ui.getCore().getModel("newDvr").getData().length;


             for(var i=0;i<rowLen;i++)

           {

            var NewData = {

                         "ProcessType":"ZDRQ",

                         "VisitType":"ZDVR",

                         "VisitDate": visitDateFormat.toString(),

                         "StartTime": startTimeFormat.toString(),

                         "EndTime": endTimeFormat.toString(),                 

                         "Activities":activity.toString(),

                         

                         "ActivityDesc":actvDescArr.toString(),

                         "DealerNo" : $("#dlrNum-col0-row0").val(),

                         "UserId": "P00108156"

 

            };

            batchChanges.push(NewData);

            }


var oModel = new sap.ui.model.odata.ODataModel("http://172.25.10.102:8000/sap/opu/odata/sap/ZDVR_SRV","true","USER","pwd",{

              "X-Requested-With": "JSONHttpRequest", "Content-Type":"application/json",

       });

 

       sap.ui.getCore().setModel(oModel,"newDvr1");



oModel.createBatchOperation('/CREATE_DVR',POST,batchChanges,null,function(response){

       alert("successfully posted");

      function() {

       alert("error");

       });


I am new to SAPUI5, so may be everything i am doing here is wrong. Please guide me how to do this.

Thank you,

Regards,





Viewing all articles
Browse latest Browse all 3523

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>