Issuing messages to the user is very important task in any Software. Displaying messages in CRM WEB UI is not much difficult task. We need to have below information at our hand and after that we need to call one method to display the message.
Message class, message no.
I created following message class and message in transaction se91.
We need to code at appropriate place to display the message on web ui. Here I just to DO PREPARE OUTPUT method to place the code.
METHOD do_prepare_output.
CALL METHOD super->do_prepare_output
EXPORTING
iv_first_time = abap_false.
DATA:lr_service TYPE REF TO cl_bsp_wd_message_service.
Cl_bsp_wd_message_service is used to display the message on the web ui. In above code, we are getting an instance of the message service. Then we are calling its method ADD_MESSAGE by exporting the message id, message no and message type.
Here message type indicates what kind of message it is.
E for error, S for success, W for warning and I for information.
All messages of type E , will be displayed in Red color and all messages of type W, are displayed in light yellow color.
Here is the output what I got when I executed the application.
LONG TEXT:
Sometimes, we may want to display more information along with the error message. In those situations, we will maintain long text for our message in the message class.
Whenever there is long text maintained for our message, framework automatically shows a link with name ‘DETAILS’ in the message bar next to our message. If user clicks on that, then he will be presented with a pop up with detailed information.
Go to the message class and maintain the long text. Do not forget to the un check the box self-explanatory.
Message class, message no.
I created following message class and message in transaction se91.
We need to code at appropriate place to display the message on web ui. Here I just to DO PREPARE OUTPUT method to place the code.
Cl_bsp_wd_message_service is used to display the message on the web ui. In above code, we are getting an instance of the message service. Then we are calling its method ADD_MESSAGE by exporting the message id, message no and message type.
Here message type indicates what kind of message it is.
E for error, S for success, W for warning and I for information.
All messages of type E , will be displayed in Red color and all messages of type W, are displayed in light yellow color.
Here is the output what I got when I executed the application.
LONG TEXT:
Sometimes, we may want to display more information along with the error message. In those situations, we will maintain long text for our message in the message class.
Whenever there is long text maintained for our message, framework automatically shows a link with name ‘DETAILS’ in the message bar next to our message. If user clicks on that, then he will be presented with a pop up with detailed information.
Go to the message class and maintain the long text. Do not forget to the un check the box self-explanatory.
Save it and execute the application again.