on ‎2020 Nov 18 4:53 PM
Hi
I have an oData model with an Import Function to check an order. I use this code to call it:
var oModel = this.getView().getModel();
oModel.callFunction("/CheckOrder", { "Aufnr" : Order },
function(oData, response) { return response; },
function(oError){} );
But the function os not called? When i check trace i don´t se any calls - not even erronous calls?
What is wrong?
Request clarification before answering.
Check this documentation here :
https://ui5.sap.com/#/api/sap.ui.model.odata.v2.ODataModel%23methods/callFunction
you can pass parameters like mentioned in the api documentation.
oModel.callFunction("/CheckOrder", {
method: "GET",
urlParameters: { "Aufnr" : Order },
success: function(oData, response) {
}.bind(this), // callback function for success
error: function(oError) {
}.bind(this)
}); Thanks,
Mahesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you can see in the documentation, they have mParameters, it is an object type, so we are passing that as an object to call function, I am rewriting it as below for better understanding.
var mParameters = {
method: "GET",
urlParameters: { "Aufnr" : Order },
success: function(oData, response) {
}.bind(this), // callback function for success
error: function(oError) {
}.bind(this)
};
oModel.callFunction("/CheckOrder", mParameters);
jakob.steen-petersen it will be asynchronous, so you have to write code inside success, or wrap your logic inside a function and call it inside the success handler, it's same like your odata read call, whhhiiich I answered in ur previous question.
Actually i did write code inside success... For now just a simple Message:
var oModel = this.getView().getModel();
oModel.callFunction("/CheckOrder", {
method: "GET",
urlParameters: { "Aufnr" : Order },
success: function(oData, response) {
MessageBox.error(response);
}.bind(this), // callback function for success
error: function(oError) {
}.bind(this)
And i get the message - but it is still issued after further processing of code (i have checked by debugging)
| User | Count |
|---|---|
| 8 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.