on 04-09-2014 4:33 PM
HI All,
I am populating messages in WDmodify, wDdoinit and other methods of a ZWDcomponent in message area with errors, warnings and success messages.
I used below method
lo_message_manager->report_error_message(
message_text = l_msg ).
The main problem.
It is populating duplicate messages how to check do the message exist.
Any method to clear the existing message in the message area (not messages)
I used CLEAR_MESSAGES of IF_WD_MESSAGE_MANAGER . It is clearing all the messages in the instance. I need to clear the existing messages in message area and repopulate new messages into message area.
I tried to use some logic but it is not working when we some methods are called like modify it is becoming complicated logic.
Any suggestions are welcomed.
Thanks
Gopal
Hi,
You can use IS_EMPTY method. If there are messages, then it will be initial. Otherwise, it will have X.
** get message manager
DATA lo_api_controller TYPE REF TO if_wd_controller.
DATA lo_message_manager TYPE REF TO if_wd_message_manager.
data lv_bool type abap_bool.
data lt_messages type if_wd_message_manager=>ty_t_messages.
lo_api_controller ?= wd_this->wd_get_api( ).
CALL METHOD lo_api_controller->get_message_manager
RECEIVING
message_manager = lo_message_manager
.DATA lv_message TYPE string.
DATA lv_message_type TYPE i.
lv_message_type = if_wd_message_manager=>co_type_standard.
* report message
CALL METHOD lo_message_manager->report_success
EXPORTING
message_text = 'Success'.
* report message
CALL METHOD lo_message_manager->is_empty
RECEIVING
empty = lv_bool
.
if lv_bool eq 'X'.
....
endif,
If you comment report_sucess method, you will find the difference.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gopal,
As Kiran said, it is always best to use report_attribute_error_message( ) method, as it highlights the error field that makes an user for better clarification.
BR,
RAM.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can use, remove_message( ) method, to remove the message. Or use, get_messages( ) method first to get all the messages, then loop the message and check if the message already exists. IF it already exists don't raise message again, else report message.
hope this helps u,
Regards,
Kiran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gopal,
Can you please be specific about what you mean by duplicate messages.
Also please share the scenarios like what exactly you are looking for.
Regards,
Rafi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.