Skip to Content

SAPUI5 - SAP Gateway - PUT method (AJAX)

Feb 24, 2017 at 11:03 AM


avatar image

Hi experts,

I'm having a problem when put method is triggered.

What I'm doing is to create records in an Infotype from SAPUI5 so I use an AJAX call as follows:


cache: false });


url: putURL,

async: true,

dataType: 'json',

cache: false,

data: JSON.stringify(data),

contentType: "application/json",

type: "PUT",

beforeSend: function(xhr) {

xhr.setRequestHeader("X-CSRF-Token", token); },

success: function(odata, textStatus, XMLHttpRequest) {



error: function() {

alert("Error Put")

} });

In my case I have to create two records so I send two ajax calls. I am able to create both records in the infotype but the problem come with the response. With the first call the success function is fired without problems but with the second one the status in the console is pending and retrieve a 504 error.


I don't know how to fixed that.

thanks in advance,


sin-titulo.png (4.2 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
Marcos Díez Mar 08, 2017 at 03:30 PM


in the Network I get this message:

"<html><head><title>Error report</title></head><body><h1>HTTP Status 504 - An internal application error occurred."

Answering to Nabi Zamani, I get more than two calls in the backend, in fact, the new entries are recorded correctly in the infotypes, but then I don't get Response.

I've noticed that this happens when the method is different. So I could send 5 PUT methods without any problem but if then I send a POST/GET method then the gateway error ocurred.


10 |10000 characters needed characters left characters exceeded
Atanu Mallik
Mar 06, 2017 at 10:59 AM

What error are you getting in the Network ?

10 |10000 characters needed characters left characters exceeded
Nabi Zamani Mar 07, 2017 at 08:41 AM

So you get a timeout... This can have several reasons:

  • your firewall blocks you
  • backend operation take way too long
  • backend operation is buggy, i.e. the is an infinite loop somewhere
  • ...

Did you implement the backend service on your own in SAP GW? Did you debug the backend? Can you veryify your call gets to the backend?

Other than that I wonder why you are not using ODataMOdel.update(...) instsead of jQuery.ajax(...). Using the v2.ODataModel would make your code much more maintainable and you would not have to worry things like csrf token, contetnType, etc. But that's a different story...

10 |10000 characters needed characters left characters exceeded
Marcos Díez Mar 08, 2017 at 03:51 PM


I have a question.

I am using oDataModel.update(...) and I am able to send various records in one call. In the backend the function

....-CHANGESET_BEGIN is called and I recived a variable IT_CHANGESET_INPUT with all the records. That's the correct perfomance?

Thanks in advanced.


10 |10000 characters needed characters left characters exceeded