on 08-15-2020 4:15 PM
Hello Experts,
I want to know how can I execute Odata.READ calls synchronously. Below is my code: I tried async: false as we do in Odata V1 model, but it didn't work.
Is there any other way other than using event handlers attachRequestSent() and attachRequestCompleted() to achieve synchronous execution in Odata Calls. Your quick response is much appreciated!
this.oModel.read('/ZST_REPORT(1)', {
// async: false,
success: function(oData, oResponse) {
that.FLAG_SET_LOB = oData.ID;
},
error: function(request, error) {
sap.m.MessageToast.show("Server Error in LOB Data: Please Contact Technical Team, if problem persists.");
}
});
Thanks,
Zayid
Hi Zayid,
After reading the documentation, I don't think there is any parameter as async to make the request synchronous. Read call in V2 is always and default asynchronous.
The other question regarding the event, there are requestSent, requestFailed and requestCompleted and in case of batch, batchRequestSent, batchRequestCompleted and batchRequestFailed can be attached to the model directly.
In case, if you still like to make the sync call, use $.ajax. In this case, you have to handle creating the request url and so on.
Thanks
Prashil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
92 | |
11 | |
10 | |
9 | |
9 | |
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.