Hello Guys,
in my fiori app, i need to create an infotype data
oBackEnd.create("/EmployeeRecordSet", oODataEntry, {
success: function(oData, oResponse) {
debugger;
let localModel = new JSONModel(oData);
this.getView().setModel(localModel, "Local");
MessageToast.show(this.getText("CREATESUCCESS"));
}.bind(this),
error: function(oError) {
debugger;
MessageToast.show(this.getText("CREATEERROR"));
}.bind(this)
});
In the backend, as for most of "bapi" operation, you do have error message but sometimes... Warning or success message....
In my DPC_EXT -> _CREATE_ENTITY method i do retrieve correctly the message - E or W or Success whatever...
I found here https://answers.sap.com/questions/10514968/successerrorinfo-message-in-return-of-odata-servic.html a way to add the message....
IF ex_bapiret2 IS NOT INITIAL.
mo_context->get_message_container( )->add_message(
iv_msg_type = ex_bapiret2-type
iv_msg_id = ex_bapiret2-id
iv_msg_number = ex_bapiret2-number
iv_msg_v1 = ex_bapiret2-message_v1
iv_msg_v2 = ex_bapiret2-message_v2
iv_msg_v3 = ex_bapiret2-message_v3
iv_msg_v4 = ex_bapiret2-message_v4
iv_add_to_response_header = abap_true
).
RAISE EXCEPTION TYPE /iwbep/cx_mgw_busi_exception
EXPORTING
message_container = mo_context->get_message_container( ).
ENDIF.
Whatever i do - Warning message - my UI5 App finishes in the Error processes, whereas i would have expected it to finish in the success...
Is what i'm expecting realistic ? Doable ? how ?
Request clarification before answering.
You unconditionally raise an exception, resulting in an HTTP response code of 4xx, which UI5 interprets correctly as an error.
Don't raise the exception if ex_baipret2-type is S or I or W, then the response will have a success HTTP code of 2xx for a "harmless" bapi message.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 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.