on 06-13-2012 6:18 AM
Hi, I have a requirement to validate all input fields.. if they are empty i have to show error ?
i hav tried with :
1) Mandatory field check using check mandatory fields method but using this method im getting more messages based on no of fields empty..
2) Report messages but i dont know how to validate multiple input fields at a time ..
pls help me..
Lokesh you can check the below documents.
http://scn.sap.com/docs/DOC-25768 - This will satisfy your requirement.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To display messages,
Get the WD message manager of type IF_WD_MESSAGE_MANAGER.
This interface provides various methods to display messages.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In this case, you can just check if you get any error messages.
While caling the method CHECK_MANDATORY_ATTR_ON_VIEW, mark the parameter DISPLAY_MESSAGES as ABAP_FALSE. This should stop messages from being displayed.
Parameter MESSAGES should give you all error messages.
And then If there are error messages, you can display your own message something like
'Fill all required fields'.
Hi Lowkeshwar,
If all the fields are 'Mandatory' to be filled, you can follow the steps:
1. For the input fields, mark the property 'State' as 'Required'. This will give an asterisk to the input field.
2. To validate all fields that are marked as required in Step 1, you can use method CHECK_MANDATORY_ATTR_ON_VIEW of class CL_WD_DYNAMIC_TOOL. This method automatically checks for all input fields that have property 'State' set as 'Required' and gives errors for the input fields that are not filled.
You can get the errors from the method above and display them.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Lokeshwar,
U can try by two ways:
1.
read all the input field values if anyone of them is empty Set a flag as "X".
Then while using throwing Error messages check whether this flag is set If yes then display error message.
2. clear all the messages using message manager ( Clear_message ) then set your own message.
Thanks and regards,
Nsingh
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 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.