Displaying success, error, information, and warning messages is often used in web application. These messages can be generated on UI side or they can come from a backend. UI5 has built-in features that allow to handle the messages easily. And with the underlying Fiori Design Guidelines you still keep your UI looking nice.
This is my session from the UI5Con 2017 on March 24th, 2017. Unfortunately, I had technical issues to record the session during my talk. After I was asked from some people to offer the recording I recorded this session the day after the conference.
2. www.nabisoft.com 2
Message Handling is described in the Fiori Design Guidelines
Source: https://experience.sap.com/fiori-design-web/messaging/
How can we implement this in UI5?
- UI messages
- Server-side messages (OData)
6. www.nabisoft.com 6
Hint: There is a gap between MassageType and ValueState
There is currently no mapping for MessageType.Information
7. www.nabisoft.com 7
OData has a well defined format for error responses
Source: http://www.odata.org/documentation/odata-version-2-0/operations/
No information found here (anymore?)
OData 2.0
8. www.nabisoft.com 8
OData has a well defined format for error responses
Source: http://www.odata.org/documentation/odata-version-3-0/json-verbose-format/
OData 3.0
9. www.nabisoft.com 9
OData has a well defined format for error responses
Source: http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata03/os/odata-json-format-v4.0-errata03-os-complete.html#_Toc453766668
OData 4.0
10. www.nabisoft.com 10
SAP Gateway supports error responses as well
- This is a simple example every ABAP developer knows
- By using Message Containers you can add more details
15. www.nabisoft.com 15
Thank You
Code is on github:
git clone https://github.com/nzamani/openui5.git
cd openui5
git checkout ui5con2017-odata-messages
npm install
grunt serve
http://localhost:8080/testsuite/explored.html#/entity/sap.ui.core.message.Message
Manager/samples
Editor's Notes
{ "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 (https://service.sap.com/sap/support/notes/1797736)" }, "errordetails":[ { "code":"/IWBEP/CX_MGW_NOT_IMPL_EXC", "message":"Method 'EMPLOYEES_GET_ENTITYSET' not implemented in data provider class", "propertyref":"", "severity":"error", "target":"" } ] } }};
{ "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 (https://service.sap.com/sap/support/notes/1797736)" }, "errordetails":[ { "code":"/IWBEP/CX_MGW_NOT_IMPL_EXC", "message":"Method 'EMPLOYEES_GET_ENTITYSET' not implemented in data provider class", "propertyref":"", "severity":"error", "target":"" } ] } }};
{ "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 (https://service.sap.com/sap/support/notes/1797736)" }, "errordetails":[ { "code":"/IWBEP/CX_MGW_NOT_IMPL_EXC", "message":"Method 'EMPLOYEES_GET_ENTITYSET' not implemented in data provider class", "propertyref":"", "severity":"error", "target":"" } ] } }};
{ "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 (https://service.sap.com/sap/support/notes/1797736)" }, "errordetails":[ { "code":"/IWBEP/CX_MGW_NOT_IMPL_EXC", "message":"Method 'EMPLOYEES_GET_ENTITYSET' not implemented in data provider class", "propertyref":"", "severity":"error", "target":"" } ] } }};
{ "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 (https://service.sap.com/sap/support/notes/1797736)" }, "errordetails":[ { "code":"/IWBEP/CX_MGW_NOT_IMPL_EXC", "message":"Method 'EMPLOYEES_GET_ENTITYSET' not implemented in data provider class", "propertyref":"", "severity":"error", "target":"" } ] } }}