Showing results for 
Search instead for 
Did you mean: 

SAPUI5: To much error messages

Former Member
0 Kudos


i use oData and therefore create an error like this:

DATA: lo_exception TYPE REF TO /iwbep/cx_mgw_busi_exception,

            lo_container TYPE REF TO /iwbep/if_message_container.

      lo_container = mo_context->get_message_container( ).



            it_bapi_messages          = lt_return

*              iv_error_category         =

                iv_determine_leading_msg  = abap_true

                iv_entity_type            = iv_entity_name

                it_key_tab                = it_key_tab

                iv_add_to_response_header = abap_true


      CREATE OBJECT lo_exception


*         textid      =

*         previous    =

         message_container      = lo_container

*         http_status_code = '500'

*         http_header_parameters =

*         sap_note_id =

*         msg_code    =

*          entity_type = iv_entity_name

*          message     = 'Konnte nicht gespeichert werden!'

*         message_unlimited      =

*         filter_param     =

*         operation_no     =


      RAISE EXCEPTION lo_exception.

but i always get more error-messages then i supose to get:

only the one in the middle is the error i added.

Accepted Solutions (1)

Accepted Solutions (1)


Hi Michael,

What UI5 version are you using? What NW ABAP / SAP GW do you have? Would you mind posting your error response here (in JSON would be great)?

I know this issue pretty well... When you send an error from SAP GW to the frontend you will receive a certain response structure on the frontend. This structure contains a leading message and could possibly have zero ore more detail messages. Here is an example:

Let's assume the following dummy SAP GW ABAP code:

  METHOD employees_get_entityset.
    RAISE EXCEPTION TYPE /iwbep/cx_mgw_not_impl_exc
        textid = /iwbep/cx_mgw_not_impl_exc=>method_not_implemented
        method = 'EMPLOYEES_GET_ENTITYSET'.

Triggering this service implementation code with/sap/opu/odata/sap/ZNABI_EMPLOYEE_SRV/Employees?$format=json will result with the following error message in the response (in JSON format):

  "error" : {
    "code" : "/IWBEP/CM_MGW_RT/021",
    "message" : {
      "lang" : "en",
      "value" : "Method 'EMPLOYEES_GET_ENTITYSET' not implemented in data provider class."
    "innererror" : {
      "application" : {
        "component_id" : "",
        "service_namespace" : "/SAP/",
        "service_id" : "ZNABI_EMPLOYEE_SRV",
        "service_version" : "0001"
      "transactionid" : "58BDC3218BC10D60E10080000AF0030E",
      "timestamp" : "20170307090853.3367070",
      "Error_Resolution" : {
        "SAP_Transaction" : "Run transaction /IWFND/ERROR_LOG on SAP Gateway hub system (System Alias LOCAL) and search for entries with the timestamp above for more details",
        "SAP_Note" : "See SAP Note 1797736 for error analysis ("
      "errordetails" : [
          "code" : "/IWBEP/CX_MGW_NOT_IMPL_EXC",
          "message" : "Method 'EMPLOYEES_GET_ENTITYSET' not implemented in data provider class",
          "propertyref" : "",
          "severity" : "error",
          "target" : ""

In this example we raised one exception. However, SAP GW actually has a leading message (code = /IWBEP/CM_MGW_RT/021) and one error detail (code=/IWBEP/CX_MGW_NOT_IMPL_EXC). As you can see in both cases the message is almost the same: the leading message ends with a dot while the error detail message does not end with a dot! That meas only the code and the dot in the messages itself differ! That's exactly why SAPUI5 assumes there are 2 different messages and thus UI5 displays the "one" message twice. From an endusers perspective this is a desaster.

SAPUI5 has a logic that discovers duplicate messages and removes them. Here is the corresponding ui5 ODataMessageParser.js code on github:

// Messages from an error response should contain duplicate messages - the main error should be the
// same as the first errordetail error. If this is the case, remove the first one.
if (aMessages.length > 1) {
    if (
        aMessages[0].getCode()    == aMessages[1].getCode() &&
        aMessages[0].getMessage() == aMessages[1].getMessage()
    ) {

In other words: If the GW would send for both messages the same code and the same message (including the dot) then you would only see the message only once in the UI! From the UI5 code mentioned above you can also see that UI5 only compares the first two messages. That means if SAP GW send you the messages in a different order (I think this is your case, too) then you would keep seeing (leading) messages twice

// this would show the leading message twice
[oLeadingMessage, oSomeOtherMessage, oLeadingMessage]

// you would see the message only only once on UI
[oLeadingMessage, oLeadingMessage, oSomeOtherMessage]

Anyway... IMHO this is a bug in the GW. I believe either the leading message should be available only once (and not in the details) or code + message should be exactly the same.

From your screenshot I can tell that the one message has a dot and the other does not. Furthermore, I guess that the codes differ as well. That's why you see the message twice.


Former Member
0 Kudos


i use the MessageManager. But it seems, that there are still multiple Messages.

So i do not want to use a custom messageselection...

Former Member
0 Kudos

I now try to find the error in sap's logic.

perhaps i have to create a service request 😞

0 Kudos

The only issue is that SAPUI5 and SAP GW are not 100%ly aligned, that's why you see double messages. By the way, at the UI5Con a few weeks ago I talked about OData Messages, and I also talked about the double messages + I pointed exactly out where the issues comes from. A lot of people know that issue...

My slides can be found at (and the included recording is also available directly on YouTube at

This acovers error messages, infor messages, wanings and even success messages...

0 Kudos

Hi Michael

We've the same problem. Did you create a service request? Did you receive an answer?



Former Member
0 Kudos

Hi, i did solve it... i try to think about it and then will give you answer...

Former Member
0 Kudos

I've changed coding in ABAP...

please try something like this:

DATA: lo_container TYPE REF TO /iwbep/if_message_container.
lo_container = mo_context->get_message_container( ).
iv_msg_type = /iwbep/if_message_container=>gcs_message_type-success
iv_msg_id = 'CUSTOMID'
iv_msg_number = 800
iv_msg_text = |My personal message i want to throw.|
* iv_msg_v1 =
* iv_msg_v2 =
* iv_msg_v3 =
* iv_msg_v4 =
* iv_error_category =
* iv_is_leading_message = ABAP_TRUE
* iv_entity_type = iv_entity_name
* it_key_tab = lt_keytab
iv_add_to_response_header = abap_true
* iv_message_target = '/#TRANSIENT#'

in UI5 i just did this:

this.getView().setModel(sap.ui.getCore().getMessageManager().getMessageModel(), "message");

Former Member
0 Kudos

I missed, that i also redefined the Methods:



the coding was just empty, but this was the origin of the dupplicated messages.

Answers (2)

Answers (2)

Active Contributor

If all the options are failing, why dont you filter the unwanted errors(by error key) before binding it to the message managaer?

0 Kudos

RAISE EXCEPTION TYPE /iwbep/cx_mgw_busi_exception
textid = if_t100_message=>default_textid " <- this line is needed, else an empty line exists in innererror!
message_container = lo_container.

Former Member
0 Kudos

Du you also have an idea how to send an Success-Message in a similar way?

Former Member
0 Kudos

Hi Manuel,

i tried it, but i still get multiple lines... is it possible that there is an error in the SAPUI5-Framework?