Skip to Content

$Batch request from UI5 application returns "Property 'xyz' is invalid" error from SAP GW

Hi,

I have a SAP UI5 table from which I am getting all the rows and creating a JSON which I then pass to the back-end SAP system using oModel.submitChanges in my controller.

I am using oDataModel v2 to accomplish this.

batchSave: function(){
  var items = [];// intializing an array
  var oTable = sap.ui.getCore().byId("JobsDetails");
  var oTableData = oTable.getModel().getData();// getting table data
  var sServiceUrl = "http://example.com:8004/sap/opu/odata/SAP/ZXX_SRV"; // ODATA URL
  var oModel = new sap.ui.model.odata.v2.ODataModel(sServiceUrl, true);
  var aDeferredGroup = oModel.getDeferredGroups().push("myBatch");
  oModel.setDeferredGroups(["myBatch"]);
  var mParameters = {groupId:"myBatch"};           
  for (i = 0; i < oTableData.length; i++) {
   items.push({
       "Jobname": oTableData[i].Job,
       "Jobtext": oTableData[i].JobName,
   });
   //oEntry is the main object to send data using batch operation.
  var oEntry = {
    //converting data into json format
    "JobsData": JSON.parse(JSON.stringify(items)),
  };     
  oModel.create("/MyJobsSet", oEntry, mParameters);
}
oModel.submitChanges(mParameters);
}

The issue is when this method is called, it returns the error: "Property 'JobsData' is invalid" in the browser. JobsData here is the JSON string that we are pushing into oEntry and passing to the oModel. This error appears for oModel.submitChanges(mParameters);

Do I need to have any such property at the Gateway Client side (in SEGW)? or anywhere else? What is wrong in this approach?

Please find the browser response for the error below-

2018-01-17 10:10:40.841722 The following problem occurred: HTTP request failed400,Bad Request,{"error":{"code":"/IWCOR/CX_DS_EP_PROPERTY_ERROR/005056A509B11ED1BF822D2D09171A04","message":{"lang":"en","value":"Property 'JobsData' is invalid"},"innererror":{"application":{"component_id":"CA","service_namespace":"/SAP/","service_id":"ZXX_SRV","service_version":"0001"},"transactionid":"5A5948625F30D406E10000000A5F0E19","timestamp":"20180117044040.5668060","Error_Resolution":{"SAP_Transaction":"Run transaction /IWFND/ERROR_LOG on SAP Gateway hub system and search for entries with the timestamp above for more details","SAP_Note":"See SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)"},"errordetails":[]}}} - 

Thanks,

Chandan

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jan 17 at 10:28 AM

    Hi Chandan Jha,

    I think your error is in the oEntry object. Could you try by not using double quotes for the key name in the object.

    Regards,

    Arjun Biswas

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 17 at 10:28 AM

    Whatever data you are passing in the payload should exist in the corresponding entity on which you have triggered the HTTP call.

    Here in MyJobs entity(assuming MyJobsSet is entityset) you should have all the properties for which you are passing data in payload, for example JobsData.


    Add comment
    10|10000 characters needed characters exceeded