on 11-02-2015 5:04 PM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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')
Thanks Kedar, Dominik and Maksim for helping me.
Thanks-
Abhishek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
if you wanna use that old ugly format of
you have to pass 2 more parameters: success and error functions, like
.update("...", oEntry, null, function(){}, function(){})
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.