cancel
Showing results for 
Search instead for 
Did you mean: 

SAP HTML5

nishantbansal91
Active Contributor
0 Kudos

Hi,

How we can send update request to SAP Server using eclipse using ODATA service. Now i am able to get the data from From eclipse, but how we can send the request using ODATA service.

Regards,

Nishant

Accepted Solutions (1)

Accepted Solutions (1)

scott_stefanich
Active Participant
0 Kudos

Hello Nishant,

To confirm, are you using an SAP Gateway OData service with read and update operations, then using the service for a SAPUI5 application OData model?

If so, I suggest beginning by confirming both the read and update operations work correctly via the Gateway Client (SAP transaction /IWFND/MAINT_SERVICE) or a web browser plugin such as Postman or Advanced REST client.

For the Gateway Client, you can perform a GET method, then select "Use as Request" to copy the results for use in the PUT method. For modifying methods, you'll need to first fetch a CSRF token from a non-modifying request (GET), then return the token with the modifying request (PUT) as described here.

Once the read and update methods are confirmed, you can use the SAPUI5 OData model as described in Implementing an OData Model and its subsection OData Write Support. Ultimately, the goal is to perform a model update method such as in the documentation's example:


var oEntry = {};

oEntry.Price = "599$";

oModel.update('/Products(1)', oEntry, null, function(){

  alert("Update successful");

  },function(){

alert("Update failed");});

Hope this helps,

Scott Stefanich

nishantbansal91
Active Contributor
0 Kudos

Hi Scott,

As suggested by you in above section,

                      oModel.update('/Products(1)', oEntry, null, function(){ 

                      alert("Update successful"); 

                        },function(){  alert("Update failed");}); 

But in my case above section is not working, When i go for first section its gives me error that field type is not edm.string.

But when i passed the service name in the " " & inside double code pass the key with '    '  is there any difference to pass the service name. 

Now with below code application is working fine as per expected.

      oModel.update("/ZGPSet('1')", oEntry, null, function(){
        alert("Update successful");
       },function(){

       alert("Update failed");});

Regards,

Nishant

Answers (0)