Hello guys,
I am making a simple function call to the ERP by using the below functionCall statement, which is triggered by a button on my screen:
this._oModel.callFunction("/Cancel", {
method: "GET",
urlParameters: oURLParameters,
success: sap.m.MessageToast.show("Your request has been sent"),
error: sap.m.MessageToast.show("Error found!")
});
It is expected that the ERP receives the parameters, checks whether my document can be cancelled or not and return a success or an error message, however, what happens when I click the button in the frontend application, is that the error response is immediately triggered before even reaching the ERP.
The point is that the interface is not waiting for the ERP to return anything, instead, it is triggering the error as soon as I press the button.
I thought it could be something like the function call was asynchronous but I checked in the debugger for the network call and the process stays as "pending" until the process in the ERP is finished. I believe that the frontend should wait for the response from the ERP before triggering the error or success function but this is not happening at all.
Do you guys have any idea of what could be wrong? I am kind of fresh in UI5, so sorry if this is a stupid question.
Thank you!