cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Missing UI Messages

jzeifang
Participant
1,346

Hello,

in our FIORI app we want to display several messages (type I or W) after an update call. The problem here is, that the messages are deleted in the UI via the messaging lifecycle because there is also an read operation directly after the update operation as described here:

https://sapui5.hana.ondemand.com/#/topic/81c735e69d354de98b0bd139e4bd4e10.html

In this article it is mentioned that the message should be marked as persistent and furthermore it is mentioned that OData V2 messages with property transition set to true are parsed to persistent UI messages.

My question now is, how to set this property transition to true in the backend ABAP code.

Any help or hint is welcome.

Many thanks in advance!

Best regards,

Jürgen

Accepted Solutions (0)

Answers (2)

Answers (2)

jzeifang
Participant

Hello all,

if someone has the same problem, here comes the ABAP coding within the OData CRUD methods to mark the UI messages as persistent:

DATA lo_message_container TYPE REF TO /iwbep/if_message_container.
DATA ls_return            TYPE bapiret2.

....

lo_message_container = /iwbep/if_mgw_conv_srv_runtime~get_message_container( ).
lo_message_container->add_message_text_only(
    iv_msg_type               = ls_return-type
    iv_msg_text               = ls_return-message
    iv_add_to_response_header = abap_true
    iv_message_target         = '/#TRANSIENT#'
  ).

Best regards,

Jürgen

geert-janklaps
SAP Mentor
SAP Mentor

Hi Jürgen,

If i'm reading the document correctly you should be able to set the parameter refreshAfterChange on the oData V2 model to false. After the update of the entity you could check for messages, if there are any display them and afterwards refresh the odata model using the read operation. If there are no messages you can trigger the read operation immediately. (this is basically solution 2 provided in the document)

Not sure yet on how to set the transition property in SAP Gateway.

Best regards,

Geert-Jan Klaps

jzeifang
Participant

Hi Geert-Jan,

thank you for your help. Unfortunately the solution 2 is (at the moment) no option for us, because this would cause a lot of changes in our app with a lot of impact.

But while debugging the UI5 code we found out, that if we set the target of the message to /#TRANSIENT# the UI messages are marked as persistent as requested:

DATA lo_message_container TYPE REF TO /iwbep/if_message_container.
DATA ls_return            TYPE bapiret2.

....

lo_message_container = /iwbep/if_mgw_conv_srv_runtime~get_message_container( ).
lo_message_container->add_message_text_only(
    iv_msg_type               = ls_return-type
    iv_msg_text               = ls_return-message
    iv_add_to_response_header = abap_true
    iv_message_target         = '/#TRANSIENT#'
  ).

Best regards,

Jürgen

geert-janklaps
SAP Mentor
SAP Mentor

Hi Jürgen,

Great to hear you found a solution! Thanks for sharing this, something that will probably be useful for a lot of people!

Best regards,

Geert-Jan Klaps