on 12-02-2008 1:21 PM
When I set the property in a table cell editor to required you can still proceed with actions/navigation without entering any value in those fields. Is there a standard way to perform these checks or should it be coded in WDDOBEFOREACTION manually?
Hi,
You need to call the static method check_mandatory_attr_on_view of class cl_wd_dynamic_tool. This would then automatically verify if all the mandatory fields have been filled or not. It would then populate the error messages into an internal table and display them in the view. Also the mandatory fields which haven't been filled would be highlighted with a red border. You need to put the below coding into the action up on which you want to trigger the data chesks.
data: lt_msg TYPE cl_wd_dynamic_tool=>t_check_result_message_tab,
lo_view_controller TYPE REF TO if_wd_view_controller,
lo_message_manager type ref to if_wd_message_manager.
lo_view_controller ?= wd_this->wd_get_api( ).
lo_message_manager = lo_view_controller->get_message_manager( ).
cl_wd_dynamic_tool=>check_mandatory_attr_on_view(
EXPORTING
view_controller = lo_view_controller
display_messages = abap_true
IMPORTING
messages = lt_msg ).
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Stanley,
You need to call the static method check_mandatory_attr_on_view of class cl_wd_dynamic_tool. This would then automatically verify if all the mandatory fields have been filled or not. It would then populate the error messages into an internal table and display them in the view. Also the mandatory fields which haven't been filled would be highlighted with a red border. You need to put the below coding into the action up on which you want to trigger the data checks.
data: lt_msg TYPE cl_wd_dynamic_tool=>t_check_result_message_tab,
lo_view_controller TYPE REF TO if_wd_view_controller,
lo_message_manager type ref to if_wd_message_manager.
lo_view_controller ?= wd_this->wd_get_api( ).
lo_message_manager = lo_view_controller->get_message_manager( ).
cl_wd_dynamic_tool=>check_mandatory_attr_on_view(
EXPORTING
view_controller = lo_view_controller
display_messages = abap_true
IMPORTING
messages = lt_msg ).
Regards,
Uday
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You actually have to check that whether the InputField is null in the onActionSubmit() method of your view,
Ex: If you want the Name InputField to be mandatory, just add the following code in the onActionSubmit() method of your view,
onActionSubmit()
{
String name = wdContext.currentEmployeeElement().getName();
//Check whether Name is not entered
if (name == null)
{
//Report an exception message
wdComponentAPI.getMessageManager().reportException(text_fill,true);
//text_fill can be any message of type String
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Stanley,
as Uday had suggested you can use
cl_wd_dynamic_tool=>check_mandatory_attr_on_view(
Exporting
view_controller = lo_view_controller
DISPLAY_MESSAGES = ABAP_FALSE
Importing
messages = msg_tab ).
this method to check all the mandatory fields...........
Also to stop the furthur navigation after checking all the mandatory fields you have to write the below code as well.........
FIELD-SYMBOLS: <lv_fs> TYPE ANY.
DATA: lv_flag TYPE i.
loop at msg_tab ASSIGNING <lv_fs>.
if <lv_fs> is INITIAL.
exit.
ELSEIF <lv_fs> is NOT INITIAL.
lv_flag = 3.
endif.
endloop.
CHECK lv_flag ne 3.
regards,
Pranav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.