on 07-16-2007 12:35 PM
Hi All,
I have a scenario where in I have around 10 input fields and a button named SEARCH in a view. Upon clicking on search button, based on that filled values Iam writing a select statement .
Now I would like to validate the values in that fields before putting them in select statement.
In the method WDBEFOREACTION Iam trying to validate them and I could display the error message.So, whenever I press on Button SEARCH if the values in input fields are not correct error messages are getting displayed but what ever code I have in SEARCH button is also getting executed. But when there is an error i dont want that code getting executed.
Is there any standard functionlity wherein I use in this case or I have to handle maually?
Please Suggest.
Thank You,
Suresh.
Which method of the message manager are you using to report errors? If you use report_exception, I think the search will not get executed. It is like raising an exception.
Regards,
Nithya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nithya,
In that thread she said "Check the values in WDDOBEFOREACTION. In this method you can check the name of the action, if it is an action of the same view. Maybe you want to skip testing, if the user pressed the CANCEL button or something similar."
How exactly you check the action. In my case I have a clear button where in I dont want to perform any validations.
Please Suggest.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use the following code to get the name of the action which has been triggered.
data: lr_view_ctrl type ref to if_wd_view_controller,
lv_action type ref to if_wd_action.
lr_view_ctrl = wd_this->wd_get_api( ).
lv_action = lr_view_ctrl->get_current_action( ).
lv_action->name is the name of the action.
You could then check if lv_action->name = 'CLEAR'.
Regards,
Nithya
Suresh,
I have handled one that scenario in the following way:
[1].created a method to check and validate the input fields
[2].created a method report error , and called the same method whenevr ab error is reported.
[3}.declared the message manager globally in component controller and calling the methods wherever necessary.
[4].written a method to check if any errors reported, source code as follows:
DATA:l_error_list_empty TYPE abap_bool.
*Check if any errors are reported
CALL METHOD wd_comp_controller-><u><b>l_message_manager->is_empty</b></u>
RECEIVING
empty = l_error_list_empty.
IF l_error_list_empty EQ abap_true.
errors_reported = abap_false.
ELSE.
errors_reported = abap_true.
ENDIF.
errors_returned is a returning parametr of type boolean.
[5].created a mthod to do the search
[6]. on action search, do the following code:
DATA: errors_reported TYPE abap_bool.
*Checking the input fields
wd_this->check_input( ).
errors_reported = wd_this->check_errors_reported( ).
*If no errors are reported call the method to get the statements
IF errors_reported EQ abap_false.
wd_comp_controller->get_statement( ).
*else clear the list which was populated earlier
ELSE.
wd_comp_controller->clear_alv( ).
ENDIF.
it worked for me.
cheers,
Madhu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
In your action , use a local flag MCHECK of type xfeld. First check whether the fields are valid , if yes ..then set the flag as 'X' else space.And in your search functionality execute the code only when the flag is 'X'.
Thanks
Anzy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You could also validate your input fields in the search event method. Report an error message if the validation fails and return from the method.This would solve your problem.
Regards,
Shruthi R
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.