on 10-21-2009 9:30 AM
Hi
pls tell how to make a input field as mandatory by binding the property with it,i have binding a attr of type wdui_state,but now if value is abap_true,its not making it mandatory.
pls tell if any one have worked with it.
hi Vipin,
Set the attribute binded to State property with values 00 and 01.
here NP4_mandatory is my attribute of type WDUI_STATE binded to Input field's State property.
Mandatory - 01.
Not Mandatory - 00.
It is working for me.
lo_el_np4_number->set_attribute(
name = `NP4_MANDATORY`
value = '00' ). -
Not mandatory.
-
lo_el_np4_number->set_attribute(
name = `NP4_MANDATORY`
value = '01' ). -
Mandatory.
Edited by: Saurav Mago on Oct 21, 2009 2:12 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Saurav
tell me one thing,i was just missing with the 01 & 00 thing,i tried it but now it has made the field notation as * looks to be mandatory,but i can move to nxt tab without filing any data,so its not working as mandatory.
secondly,i also have attached the visible property,so when i have to make it mandatory,i also need to put 'X' to make it visible,is this only way to do with the fields have multiple properties.
hi Vipin,
With Wdui_state , it gives a * mark in Red. This will just give an idea to user that this field is mandatory.
If you dont fill this field, then you have to check it and reaise error message for the user.
1. get the value of input field.
2. Check if it is empty , raise an error message.
1. Get the value of input field.
lo_el_np4_number->get_attribute(
EXPORTING
name = `NP4NUMBER_INPUT`
IMPORTING
value = lv_np4number_input ).
2. if lv_np4number_input is initial. ( Also check that mandatory property has 01ie if it is mandatory and empty)
Raise error message.
Edited by: Saurav Mago on Oct 21, 2009 2:18 PM
i have to validate the input fields from the SPRO settings,so i have attached the property of ready only,required & visible with the fields,now the property needs to be set comes from the SPRO,it can be req or read only or visible,so i am trying to do it.
so observed that,if need to make a field read only or req,i 1st have to make the filed as visible than only i can make it as my requirement.
but now,after making it a mandatory,its showing * in front of filed screen name,as its a required file,but if i am moving to different tabs,of tabstript,its not giving any mandatory fields options & easily moving with differtn tabs,where i want it shd stick to this tab,unless & until its not filled.
hi,
secondly,i also have attached the visible property,so when i have to make it mandatory,i also need to put 'X' to make it visible,is this only way to do with the fields have multiple properties
Yes , when fields are mandatory then you have to make it visible also .
1. For viisbility issue , bind input fields with wdui_visibility .
2. for visible : set 02 and Invisible : Set 01.
now,after making it a mandatory,its showing * in front of filed screen name,as its a required file,but if i am moving to different tabs,of tabstript,its not giving any mandatory fields options & easily moving with differtn tabs,where i want it shd stick to this tab,unless & until its not filled.
1.Implement the OnSelect event of Tabstrip.
2. Inside this event check whether field is mandatory or not.
3. If it is mandatory ,check whether some value has been filled or not.
4. If it is mandatory and empty, Raise an error message and thus you wont be able to move to other Tabs.
I hope it would help you.
hi,
you can use this method too.
This code checks if there is any Field in the view which is mandatory and not filled. It gives error " Please fill the entries".
Check this out if it helps you. You can implement the same in OnSelect Event of Tabstrip.
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 ).
Just a little advice. You shouldn't hard code the values 01, 02, etc for visibility/mandator. These values could change over time, since they are generated from the UML models. Plus they make your code more difficult to read. There are always constants generated for these values.
For visbility you can use
CL_WD_UIELEMENT=>E_VISIBLE-NONE or CL_WD_UIELEMENT=>E_VISIBLE-VISIBLE.
For mandatory you can use
CL_WD_INPUT_FIELD=>E_STATE-NORMAL or CL_WD_INPUT_FIELD=>E_STATE-REQUIRED.
All the UI elements have similar CL_WD_* classes that contain constants with the enumerated values for most properties.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.