5 Replies Latest reply: May 1, 2012 5:05 PM by Arihant Kothari RSS

Error while updating SAP Backend data using OData and SAP Gateway services

Arihant Kothari
Currently Being Moderated

I am trying to update SAP back-end data using OData and SAP Gateway services.
while executing, it throws an error and doesn't update data in back-end.
I am basically trying to update 'accounts' data in SAP CRM backend.
the error message contains this response:

"The file sap/Gateway/PGY/SERVICEACCOUNTS/SERVICEACCOUNTSCollection({BP_Number_of_that_Account}) has been successfully uploaded".

this application has been deployed on to SAP netweaver portal.
I have put break points in backend and i found that it doesnt even reach to 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.

-Arihant

Actions