on 06-08-2015 7:22 AM
Hi Experts,
I would like to validate mandatory fields.If we did not enter any data, fields should get highlited and should show appropriate message.
for example ,check the below screenshot.
Here batch or meterial or plant are mandatory fields. these field are highlighted and shown a message using
'cl_wd_dynamic_tool=>check_mandatory_attr_on_view'. Highlited is fine. but i need an appropriate message as well.
How would i achive both functionalities (ie. highlighted and appropriate message)
Best regards,
Narasimha.
Hi Narasimha,
You can use the concept of report attribute error message in order the display you own error message with highlighted fields.
please find the following code , pass the error message to message_text , pass the element name to element and pass the attribute name which needs to be highlighted too attribute , call this method if the particular field is empty.
IF ls_business_details-vc_name IS INITIAL.
wd_this->message(
attribute = 'VC_NAME'
element = lo_el_business_details
message_text = 'Fill data for Business Details' ).
Endif.
METHOD message .
DATA lo_api_controller TYPE REF TO if_wd_controller.
DATA lo_message_manager TYPE REF TO if_wd_message_manager.
lo_api_controller ?= wd_this->wd_get_api( ).
CALL METHOD lo_api_controller->get_message_manager
RECEIVING
message_manager = lo_message_manager.
CALL METHOD lo_message_manager->report_attribute_error_message
EXPORTING
message_text = message_text
element = element
attribute_name = attribute.
Endmethod.
- Gowtham
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
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.