cancel
Showing results for 
Search instead for 
Did you mean: 

SAP CAP & UI5 / Fiori Elements - State message handling recommendations / approach

geert-janklaps
Active Contributor
360

Hi,

I'm looking for a solution to handle state messages in SAP CAP, combined with SAP Fiori Elements.

According to the UI5 documentation, state messages should be part of the response payload. https://ui5.sap.com/#/topic/fbe1cb5613cf4a40a841750bf813238e.html#loiofbe1cb5613cf4a40a841750bf81323...

I'm in the situation where I have a business object modelled in CAP, which can contain multiple errors (background processing / jobs) where a user will finally need to make some manual changes to the object. Basically, clear case of state messages (messages don't change as long as the object doesn't change).

Currently it seems like CAP only supports transition messages out of the box with e.g. req.info, req.error...

I'd like to get to a situation where these messages are captured in the backend and provided as state messages to the frontend, so that when a user opens the object in change mode, the state messages are properly shown.

I couldn't find an example of this scenario and the CAP documentation doesn't seem to mention an approach  / recommendation for this scenario. 

Any pointers in the right direction are greatly appreciated!

Cheers,

Geert-Jan

View Entire Topic
catano
Active Participant
0 Kudos

Hi @geert-janklaps,
I wonder what the format of the state messages is, because I don't know exactly what it should look like based on the documentation.

In the CAP documentation I found an object parameterization for the methods req.info, req.warning, req.error, where it is possible to specify a target. Maybe this could be used to be interpreted as a state message in the UI?

geert-janklaps
Active Contributor
0 Kudos

Hi,

Unfortunately, the documentation also states that the messages get transported to the sap-messages header of the http response. Error messages go to the error response in the body of the response.

For state messages, the messages should be part of the object response.

Cheers,

Geert-Jan

catano
Active Participant
0 Kudos
Sorry I totally overlooked that. Thanks for the clarification, Geert-Jan