cancel
Showing results for 
Search instead for 
Did you mean: 

Backend service is not hitting breakpoint

AbhishekSharma
Active Contributor
0 Kudos

Hi Experts,

I have one Gateway service which I wanted to use PUT method so that data what ever send from frontend can be saved using Method "ORDERINFO_HSET_UPDATE_ENTITY" of my Service Implementation.

I have written below code in

When I run this code I get below error:

In simple words I wanted to send data from Frontend using HTTP Method PUT so that I can use "UPDATE_ENTITY" method.

When I run Service from Gateway using PUT method passing two parameter it hits to "UPDATE_ENTITY" method but not from Frontend.

Please help me .

Thanks-

Abhishek

Accepted Solutions (1)

Accepted Solutions (1)

kedarT
Active Contributor
0 Kudos

Hi Abhishek,

You need to provide those parameters as you did in Gateway along with the path in Update mode, something like this:

update("/ORDERINFO_HSet(par1=' "+ val1 +" ',par2=' " +val2 +" ')",oEntry,null)

Hope this helps.

AbhishekSharma
Active Contributor
0 Kudos

Hi Kedar,

Thanks for your quick reply...

I tried what you suggested but no luck.

I am still getting below error :

Something else could be wrong other then this piece of code ?

Thanks-

Abhishek

Former Member
0 Kudos

Hi Abhishek,

please check SAPUI5 SDK - Update OData-Model

You can see that the third parameter which is required for update()-Method of ODataModel is not mandatory.

So instead of using null as a third parameter, just don't state anything. Try using only 2 parameters with the update-method

Regards,

Dominik

kedarT
Active Contributor
0 Kudos

Use your code which you have commented i.e., functions for success and failures also along with the parameters.

AbhishekSharma
Active Contributor
0 Kudos

Hi Dominik,

Below is my code :

  onProcessOrder: function() {

  var oEntry = {

            "RefGuid":"10000000000",

            "Objectid" : "1000000"

    };

  

  var oParams = {};

        oParams.fnSuccess = function (){};

        oParams.fnError = function () {};

  alert("efsfsdf");

  this._oComponent.getModel().setHeaders({"content-type" : "application/json;charset=utf-8"});

   this._oComponent.getModel().update('/ORDERINFO_HSet', oEntry, oParams, function(){

     sap.ui.commons.MessageBox.show(

          sap.ui.commons.MessageBox.alert("Success!")

      );

     },function(){

       sap.ui.commons.MessageBox.alert("Error!");

  });

  },

Below is service request which works when run from Gateway:

/sap/opu/odata/sap/<myservicename>/ORDERINFO_HSet(RefGuid=binary'10',Objectid='1000000')

former_member182372
Active Contributor
0 Kudos

so what do you see in dev tools-network?

AbhishekSharma
Active Contributor
0 Kudos

Thanks-

Abhishek

former_member182372
Active Contributor
0 Kudos

anything in response tab?

Answers (2)

Answers (2)

AbhishekSharma
Active Contributor
0 Kudos

Thanks Kedar, Dominik and Maksim for helping me.

Thanks-

Abhishek

former_member182372
Active Contributor
0 Kudos

if you wanna use that old ugly format of

https://sapui5.netweaver.ondemand.com/sdk/#docs/api/symbols/sap.ui.model.odata.ODataModel.html#updat...

you have to pass 2 more parameters: success and error functions, like

.update("...", oEntry, null, function(){}, function(){})

AbhishekSharma
Active Contributor
0 Kudos

Hi Maksim and Kedar,

I updated my code as below:

this._oComponent.getModel().update("/ORDERINFO_HSet(RefGuid=binary'10',Objectid='1000000')", oParams, function(){

     sap.ui.commons.MessageBox.show(

          sap.ui.commons.MessageBox.alert("Success!")

      );

     },function(){

       sap.ui.commons.MessageBox.alert("Error!");

  });

now I am getting some different error :

Thanks-

Abhishek

Former Member
0 Kudos

Hi,

Are you testing this from WebIDE ?

If so, Can you check your neo-app.json file contains the following destination(Back end destination Configuration).

{

  "path": "/destinations/<DestinationName>",

  "target": {

  "type": "destination",

  "name": "<DestinationName>"

  },

  "description": "GatewaySystem"

Then your oModel initialization in the component.js should have the service URL in the following format,

var sServiceUrl = "/destinations/<DestinationName>/sap/opu/odata/sap/<YourServiceName>/";

this.oModel = new sap.ui.model.odata.ODataModel(sServiceUrl);

Thanks,

Rumeshbabu S