How to Display Formatted Save Results
In this blog, I would like to share one simple solution I have implemented with couple of HTML tags in order to display formatted custom messages after save operation. May be some of you are already aware about it, but I thought it’s worth to share.
In my recent implementation, I was expected to display some customized success or failure messages to users after they perform save. Here all data save related calculations and validations are performed in write back BADI and it is expected to display details about them in formatted text. Like user should see No Records are stored! message in case of invalidations.
For this, et_message export table parameter of write back BADI Pre-Process method can be used by populating a message rows through BADI logic. These messages are displayed in Save Results Log in Error Message block.
Additionally, you can use simple html scripting to highlight specific message (when tested we observed that this screen supports html tags).
e.g., If you are rejecting records in your BADI logic and want to show specific text in such case to users in red color in bold then you can use script like –
<b><font color=”red”>No Records are stored!</font></b>
which results into –
DATA: ls_message TYPE uj0_s_message.
ls_message-message = ‘<b><font color=”red”>No Records are stored!</font></b>’.
ls_message-msgid = ‘FAILED’.
ls_message-msgno = ’01’.
ls_message-msgty = ‘E’.
APPEND ls_message TO et_message.
Further such messages can be maintained in message class(TCode: SE91) to make them reusable.
Save Results Error Message Log with some html formatting makes save outputs more descriptive and appealing.
I am still looking for replacing text Error Message with Message to avoid wrong header for customized messages for successful operations.
—Tested on SAP EPM SP20, SAP BPC NW 10—
If you have any suggestions, comments or inputs, please do share.
Thanks and Regards,