cancel
Showing results for 
Search instead for 
Did you mean: 

sapui5 messagePopover severity Problem

helmut_sieberer
Participant
0 Kudos

Hello,

i have a problem with m/messagePopover.

Odata returns severity as error, information, warning (no capital letter in the beginning)

and then I get this error:

Uncaught Error: "error" is of type string, expected sap.ui.core.MessageType for property "type" of Element sap.m.MessageItem#__item31-__popover11-0

when i convert error to Error (with capital letter at the beginning) I get no more error ?

is it true, that I have to convert all the returned severities in frontend ?

Thanks for your help

fragment:

<core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core"> <MessagePopover items="{message>/messageSet}"> <MessageItem type="{message>severity}" title="{message>message}"></MessageItem> </MessagePopover> </core:FragmentDefinition>

Accepted Solutions (1)

Accepted Solutions (1)

maheshpalavalli
Active Contributor
0 Kudos

Hi Helmut Sieberer,

You don't need to convert the messages returned by the odata request, SAP OData parser will automatically convert the message from the response and set it to the message model. (True, we need to convert them if you want to do it manually).

https://github.com/SAP/openui5/blob/master/src/sap.ui.core/src/sap/ui/model/odata/ODataMessageParser...

In the manifest.json you need to add the below property for odata parser to come to action. BTW you can get the message model using

sap.ui.getCore().getMessageManager().getMessageModel()

	"sap.ui5": {
		"handleValidation": true,

You can find a lot about online help, blogs and question.

BR,

Mahesh

Answers (2)

Answers (2)

helmut_sieberer
Participant
0 Kudos

Hello,

Thanks for your answer

but why does oData return error and not Error.

my code is:

CALL METHOD O_MESSAGE_CONTAINER->ADD_MESSAGE EXPORTING IV_MSG_TYPE = SY-MSGTY IV_MSG_ID = SY-MSGID IV_MSG_NUMBER = SY-MSGNO IV_MSG_V1 = SY-MSGV1 IV_MSG_V2 = SY-MSGV2 IV_MSG_V3 = SY-MSGV3 IV_MSG_V4 = SY-MSGV4 IV_ADD_TO_RESPONSE_HEADER = ABAP_TRUE.

and when I look in the returned messages in frontend it says error for severity (not Error)

so I have to convert all the severities (error to Error, warning to Warning...) - I just wonder about this...

SergioG_TX
Active Contributor
0 Kudos