on 06-21-2017 2:43 PM
Hello,
I created new import function "Approve" (there is also a "Reject", but let's focus on only one of them) in my oData Service:
The approve information is returned by the $metadata request
<EntityContainer Name="ZMY_SRV_Entities" sap:supported-formats="atom json xlsx" m:IsDefaultEntityContainer="true">
<EntitySet sap:content-version="1" Name="ActivitySet" sap:updatable="false" sap:creatable="false" sap:pageable="false" sap:deletable="false" EntityType="ZMY_SRV.Activity"/>
<FunctionImport Name="Approve" m:HttpMethod="GET" EntitySet="ActivitySet" ReturnType="ZMY_SRV.Activity">
<Parameter Name="ACTIVITY_ID" Type="Edm.String" Mode="In"/>
<Parameter Name="NOTE" Type="Edm.String" Mode="In"/>
</FunctionImport>
</EntityContainer>
which I am trying to address when a button is clicked via my view controller:
var oModel = this.getModel();
oModel.callFunction(
"/Approve", "GET", {"ACTIVITY_ID": "424242", "NOTE": "test" }, null,
function(oData, response) { sap.ui.commons.MessageBox.alert("Success!"); },
function(oError){ sap.ui.commons.MessageBox.alert("Error!"); }
);
I tried to perform the call with explicit parameters too (with or without the quotes for parameter the names):
var oModel = this.getModel();
oModel.callFunction(
"/Approve", {"urlParameters": {"ACTIVITY_ID": "424242", "NOTE": "test" }, "success":
function(oData, response) { sap.ui.commons.MessageBox.alert("Success!"); },
"error": function(oError){ sap.ui.commons.MessageBox.alert("Error!"); }}
);
However at the end I see an exception in the browser console:
I found similar topics online, but most of them were not answered, so any ideas would be appreciated.
Thanks,
Martin
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.