on 05-05-2017 12:31 PM
I need to get a property JSON in my SAPUI5 Application
OData.request({
requestUri : "/sap/opu/odata/sap/ZGW_TRANSF_APPROVAL_SRV_02/zset_transferset",
method : "POST",
headers : oHeaders,
data:oParameters
},
function(data,request) {
MessageToast.show("Transferência concluida!");
// location.reload(true);
}, function(err) {
MessageToast.show("fail!");
})
I need to show the OData property messageerror(like a image) in my code instead the message "fail"
I solved it
MessageToast.show(JSON.stringify(data["messageerror"]));
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can put a debuggere inside the error function and see what kind of data is available inside the err parameter. From there you can write your logic to show the error message.
BTW, I hope there is some good reason that you using OData.request method, Ideally the best and recommended approach is to use the OData api availble in sap ui5 library(specifically V2 version). Then you can make you of feature like message manager which does the error handling automatically without you writing any code.
Best Regards,
Mahesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use the code, if err is the json ob ject returned from the backend
err.getProperty('/messageerror'))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yourobject.property.property........ keep going until you reached the property
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.