cancel
Showing results for 
Search instead for 
Did you mean: 

Update Table not working(O Data)

amol_samte
Contributor
0 Kudos

Hi,

I have created one RFM with importing single parameter and exporting tabular.

For get entity set is working right but when I am trying to put(update) getting error.

1. For update I have written code in update_entity even external break point is not triggering, same worked for get entity.

Get entity Request URI : /sap/opu/odata/sap/ZUSER_DATA_SRV/ZUSERDATASet/?$filter=Uname eq 'P02050607'

Put Operation URI : /sap/opu/odata/sap/ZUSER_DATA_SRV/ZUSERDATASet(Mandt='300',Uname='P02050607')

-Amol S

Accepted Solutions (1)

Accepted Solutions (1)

AbhishekSharma
Active Contributor
0 Kudos

Hi Amol,

Are you trying to hit this service from Gateway or from Code ?

It would be good if you can share Error which you are getting (Browser console use key SHIFT + F12).

Assuming you are trying to hit service from UI5 code, try below code this works for me:

<your function name>: function(oEvent) {

  var oEntry = {};

  oEntry.<your parameter>= this.oModel.getData().ObjectId;

  alert(this.oModel.getData().ObjectId);

// I set my Model in Component.JS file so getting its reference like below might change for you..

this._oComponent.getModel().update("/ZUSERDATASet(Mandt='300',Uname='" + <your user name> + "')", oEntry, null, function(){

     sap.ui.commons.MessageBox.show(

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

      );

     },function(){

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

  });

  },

Issue I faced while using PUT method was related to Virus Scan profile. but this will throw an error in Gateway when you try to use.

Second thing just check if your Entity is set to Updatable or not as in below screen shot

Thanks-

Abhishek

amol_samte
Contributor
0 Kudos

Hi Abhishek,

Scenario is, to fetch records from multiple tables and update a single table for that i have created RFM to fetch data and for update i have written code in update entity.

I am testing in gateway client.

-Amol S

AbhishekSharma
Active Contributor
0 Kudos

Hi Amol,

What Error code you are seeing when you try to call this Service from gateway client ?

It would be good if you can put Screen shot of Error..

Thanks-

Abhishek

Answers (1)

Answers (1)

AshwinDutt
Active Contributor
0 Kudos

Hello Amol,

Update needs payload to be sent as input so that data gets updated for a particular key.

Please have a look at the below for Update operation ->

Regards,

Ashwin

amol_samte
Contributor
0 Kudos

Hi Ashwin,

Can you please come again.

-Amol S

Just for information.

1. I have to fetched data from different tables and need to show for that i have create FM.

2. For Update, I have written code in Update entity.