I am trying to update SAP backend using OData and SAP Gateway services. while executing it throws an error and doesn't update data in backend. I am trying to update 'accounts' data in SAP CRM backend.
The error message contains this response:
The file {ServiceName}({BP_Number_of_that_Account}) has been successfully uploaded
This application has been deployed on to SAP Netweaver portal. I put the breakpoints in backend and found that it doesn't even reach the backend.
The code looks as follows:
OData.request(
{
headers: {'x-requested-with' : 'XMLHttpRequest','Content-Type': 'application/atom+xml', 'DataServiceVersion': '2.0'},
requestUri: "/sap/Gateway/PGY/SERVICEACCOUNTS/SERVICEACCOUNTSCollection("+recordToUpdate.data.BP_NUMBER+")?sap-client=100&$format=xml",
method: "PUT",
data: {
ACCOUNT_NAME: recordToUpdate.data.ACCOUNT_NAME,
BP_NUMBER: recordToUpdate.data.BP_NUMBER,
CITY: recordToUpdate.data.CITY,
COUNTRY: recordToUpdate.data.COUNTRY,
E_MAIL: recordToUpdate.data.E_MAIL,
HOUSE_NO: recordToUpdate.data.HOUSE_NO,
POSTL_COD1: recordToUpdate.data.POSTL_COD1,
REGION: recordToUpdate.data.REGION,
STREET: recordToUpdate.data.STREET,
TELEPHONE: recordToUpdate.data.TELEPHONE
},
user: "****",
password: "****"},
function (data, response) {
//success handler
console.log(response);
console.log('Successfully updated object');
},
function (err)
{
//error handler
console.log('error while updating');
console.log(err);
}
);
Any help will be appreciated, thank you.