Hi experts,
I am trying to send data to the backend using the below mentioned code. When I execute, it says "bad request". Could anyone plz tell me as to what is wrong with the below code.
onPressSubmitCreateNotifBtn: function(){
var url = "/NotificationHeaderCollection";
var newData = {
"NotifType" : "M1",
"Qmnum" : " ",
"NotifShorttxt" : "Notification Testing Shruthi",
"FunctionLoc" : "ENSS-008",
"Equipment" : "10007094",
"Bautl" : " ",
"ReportedBy" : "kamal",
"MalfuncStdate" : "/Date(1435881600000)/",
"MalfuncEddate" : "/Date(1435968000000)/",
"MalfuncSttime" : "PT00H00M00S",
"MalfuncEdtime" : "PT00H00M00S",
"BreakdownInd" : "X",
"Priority" : "4",
"Ingrp" : "100",
"Arbpl" : "T-L400",
"Werks" : "1200",
"Strmn" : "/Date(1435968000000)/",
"Ltrmn" : "/Date(1437177600000)/",
"Aufnr" : " ",
"Docs" : " ",
"Altitude" : " ",
"Latitude" : " ",
"Longitude" : " ",
"Closed" : " ",
"Completed" : " ",
"Createdon" : "/Date(1436400000000)/",
"Qmartx" : " ",
"Pltxt" : " ",
"Eqktx" : " ",
"Priokx" : " ",
"Auftext" : " ",
"Auarttext" : " ",
"Plantname" : " ",
"Wkctrname" : " ",
"Ingrpname" : " ",
"Maktx" : " ",
"Xstatus" : " ",
"Usr01" : " ",
"Usr02" : " ",
"Usr03" : " ",
"Usr04" : " ",
"Usr05" : " ",
"TransmitType": " ",
"NotificationItems": [
{
"Qmnum" :" ",
"ItemKey" : "0001",
"ItempartGrp" : " ",
"Partgrptext" : " ",
"ItemdefectGrp" : "PM01",
"ItempartCod" : " ",
"Partcodetext" : " ",
"Defectgrptext" : " ",
"ItemdefectCod" : "1001",
"Defectcodetext" : " ",
"ItemdefectShtxt": "Item shorttext",
"CauseKey" : "0001",
"CauseGrp" : "PM01",
"Causegrptext" : " ",
"CauseCod" : "1001",
"Causecodetext" : " ",
"CauseShtxt" : "Cause shorttext",
"Usr01" : " ",
"Usr02" : " ",
"Usr03" : " ",
"Usr04" : " ",
"Usr05" : " ",
"Action" : " ",
}
],
"NotifLongText": [
{
"Qmnum": " ",
"TextLine": "Shruthi testing"
}
],
/* "finalArrJsonFormat" : JSON.parse(JSON.stringify(finalArr)),*/
"DeviceDetails": {
"Muser": "abc",
"Deviceid": "123",
"Devicesno": "456",
"Udid": "789"
}
}
var oNotifModel = new sap.ui.model.odata.ODataModel("http://103.6.157.47:8080/sap/opu/odata/EMT/PMAPP_SRV/");
oNotifModel.create("/NotificationHeaderCollection","abc","abc123",true, newData, null, function(oData, oResponse){
console.log(oResponse);
alert("sucess");
},
function(err){
jQuery.sap.require("sap.m.MessageBox");
sap.m.MessageBox.show((JSON.parse(err.response.body).error.message.value));
}
)
}