on 04-14-2014 3:52 PM
Hi Experts,
I am developing one webdynpro application . Where i need to display an error message
like 'Please enter the required fields' if the field value is initial.
please check the below image for more information.
Please give me the solution. In case of normal field ( Not required fields ) , how to achieve the same.
Best regards,
Narasimha.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok , you could give space to the parameter DISPLAY_MESSAGES when calling the methode , then check the content of the importing parameter MESSAGES ( type T_CHECK_RESULT_MESSAGE_TAB ) if there is errors , just call you custom message by generating it into the a MessageArea element positioned in the view
Regards
Hi Narasimha,
Is your requirement is to display an error message for an attribute
Please use the method REPORT_ATTRIBUTE_ERROR_MESSAGE
Sample code:
Note: here lo_el - the context element of your attribute
Hope this helps you.
Regards,
Rama
Hi,
Instead of using check_mandatory_attr_on_view method, read the input values using get_attributes( ) method,
Then,
if lv_field1 is initial or lv_field2 is initial or lv_field3 is initial.
*Display message
lr_msg_manager->report_error_message(
message_text = 'Please enter all the fields!" ).
endif.
Regards,
Kiran
Hi Experts,
@Kiran
If i do the same code, we can get the message but the error fields won't be highlighted.
@Ramakrishappa
If i do the same code, multiple error messages get triggered. But i want to display one error message with normal input fields.
Hope you understood what is my requirement.
Best regards,
Narasimha
Hi Narasimha,
It is not possible to highlight all the fields and display one message.
A work around could be, create a messageArea UI and display the messages using report_attribute_error_message( to highlight the fields). Then set the maxVisibleMessages property of messageArea UI to 1. Then only 1 message will be visible ( with a scroll bar ).
Regards,
Kiran
Hi Kiran ,
Still it is showing all the messages without scroll bar. Kindly do the needful.
I have written the code as below.and the message area with maxVisbleMessages = 1
IF ls_qtr_detail-number_of_rooms EQ 0.
* report message
CALL METHOD lo_message_manager->report_attribute_error_message
EXPORTING
message_text = 'Please enter Number of Rooms'
element = lo_el_qtr_detail
attribute_name = 'NUMBER_OF_ROOMS'.
ENDIF.
IF ls_qtr_detail-quarter_area IS INITIAL.
* report message
CALL METHOD lo_message_manager->report_attribute_error_message
EXPORTING
message_text = 'Please Enter the Quarter Area'
element = lo_el_qtr_detail
attribute_name = 'QUARTER_AREA'.
ENDIF.
IF ls_qms_det_map-constructiondate IS INITIAL.
* report message
CALL METHOD lo_message_manager->report_attribute_error_message
EXPORTING
message_text = 'Please Enter the Construction Date'
element = lo_el_qms_det_map
attribute_name = 'CONSTRUCTIONDATE'.
ENDIF.
IF ls_qtr_detail-country IS INITIAL.
* report message
CALL METHOD lo_message_manager->report_attribute_error_message
EXPORTING
message_text = 'Please Enter Country'
element = lo_el_qtr_detail
attribute_name = 'COUNTRY'.
ENDIF.
Best regards,
Narasimha.
Hi Narasimha,
Yes, It is possible to display single message and highlight all the attributes in the given context element.
If you dont pass the attribute name, it highlights all the attributes inside the context element.
CALL METHOD lo_message_manager->report_attribute_error_message
EXPORTING
message_text = 'Please fill all the fields'
element = lo_el_qtr_detail.
The above code, highlights all the fields inside the context element lo_el_qtr_detail.
Hope this helps you.
Regards,
Rama
if you are at an older version of SAP, then there you would find that it is not possible to change the maxvisiblemessages in the designer, only via code. Please refer to this code:
data: lr_wd_message_area type ref to if_wd_message_area,
lr_view type ref to if_wd_view_controller,
lr_window type ref to if_wd_window_controller.
* Set up message controller
lr_view ?= wd_this->wd_get_api( ).
lr_window = lr_view->GET_EMBEDDING_WINDOW_CTLR( ).
lr_wd_message_area = lr_window->get_message_area( ).
lr_wd_message_area->set_display_attributes(
I_MSG_LINES_VISIBLE = 3
* i_show_only_current = ' '
i_for_all_instances = 'X'
* i_use_toggle_area = ' '
).
the code changes according to your use either in the window or in the view
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.