on 01-04-2011 8:01 AM
please help me how to make the inputfield for the label (say id) as mantatory one?
Thanks in advance
Hai ,
use this code make Input field as a mandatory,
DATA: l_view_controller TYPE REF TO if_wd_view_controller .
* Check all the mandatory attributes
l_view_controller = wd_this->wd_get_api( ) .
cl_wd_dynamic_tool=>check_mandatory_attr_on_view(
EXPORTING view_controller = l_view_controller
display_messages = abap_true
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Alagappan ,
To make any field mantatory you have do coding requiered for input check.
For user visibility you can make a field required by changing the state of your UI element to required.
In normal Input Fields the asterisk will come on the left of the input field,
It will be basically on the right hand side of the label having label for property bound to the input field.
It will be like
Name * = |''''''''''''''''''''''''''''''''|
But that is just for visibility purpose.
To make it mandatory you need to do some coding during the save or validate or final action on the screen
like :-
data lo_nd_employee type ref to if_wd_context_node.
data lo_el_employee type ref to if_wd_context_element.
data ls_employee type wd_this->element_employee.
data lv_pernr like ls_employee-pernr.
navigate from <CONTEXT> to <EMPLOYEE> via lead selection
lo_nd_employee = wd_context->get_child_node( name = wd_this->wdctx_employee ).
get element via lead selection
lo_el_employee = lo_nd_employee->get_element( ).
get single attribute
lo_el_employee->get_attribute(
exporting
name = `PERNR`
importing
value = lv_pernr ).
*Check the input here
If lv_pernr is initial.
get message manager
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
.
report message
call method lo_message_manager->report_error_message
exporting
message_text = u2018Please input the personnel Numberu2019
Reply if you required any further assistance.
Thanks & Regard ,
Monishankar C
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thomas ,
Thanks for your reply.
I have implemented the class for CL_WD_DYNAMIC_TOOL=>CHECK_MANDATORY_ATTR_ON_VIEW for input check.
I have implemented the class first in WDMODIFYVIEW .
But as this is my default view so its generating the error message in beginning of the application.
So I moved the code in the required action and its working fine.
But i have one question can I limit the no of message, like if i have three required field then its showing three error message if all the field are blank.
I want to display one message regardless of the no. of blank input field.
Thanks in advance.
Monishankar C
Hi Alagappan,
You can also implement your scenario by implementing the class CL_WD_DYNAMIC_TOOL=>CHECK_MANDATORY_ATTR_ON_VIEW as per stated by Thomas Jung.
Just do the coding as below in your required action :-
Check Required field***********************************
DATA: L_API_COMPONENT type ref to IF_WD_COMPONENT.
DATA VIEW type ref to IF_WD_VIEW_CONTROLLER.
L_API_COMPONENT = WD_COMP_CONTROLLER->WD_GET_API( ).
VIEW ?= WD_THIS->WD_GET_API( ).
types:
begin of t_check_result_message,
t100_message type symsg,
context_element type ref to if_wd_context_element,
attribute_name type string,
end of t_check_result_message .
data:
message type standard table of t_check_result_message.
CALL METHOD CL_WD_DYNAMIC_TOOL=>CHECK_MANDATORY_ATTR_ON_VIEW
EXPORTING
VIEW_CONTROLLER = view
DISPLAY_MESSAGES = ABAP_TRUE
IMPORTING
MESSAGES = message
.
Thanks & Regards,
Monishankar C
Hi,
For making input field mandatory use below link.
And for displaying only one message you can use one of the following options
1. Use 'Message Area' view element and set its 'maxVisibleMessages' property to '1'. and report error messages using IF_WD_MESSAGE_MANAGER
2. Use interface IF_WD_MESSAGE_MANAGER. First try to get all the messages using method GET_MESSAGES and then you can remove or delete messages from list using method 'REMOVE_MESSAGE'
Thanks,
Prashant
hi,
i think you want that if user enters nothin in the infut field and tries to move ahead in application he/she must'nt be allowed to do so...is it?
To do so you have to make that input field as a mandatory one........this can be achieved by changing the state of this particular input field from " Normal Item" to " Required".
you will find this once you click on the input field and look in the property
once this is changed you will find an * sign in the input field and without entering anything in the input field further action can't be taken.hope this is clear top you and you may solve you problem.
thanks and regards,
sahai.s
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
What in deed do you wanna achieve?
Make the LABLE as mandatory?
Make the Input field as mandatory?
For Lable:
Sorry, in design, you cannot config it as mandatory.
In addition, i am very very confused that why you need to have one Just lable as mandatory??
For Input field:
You can just set "STATE" as "Required"
Remember: you can implement the 'Required-check' by your self.
Best wishes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@ edison
i guess he is asking about making the input field mandatory.. and in that way label will eb displayed with * mark.
You can make it mandatory as explained above by using property state of the imput field equal to required and then the label
linked to the input field will be shown with *.
However this is only for the display purpose. you need to write the logic to make it actully mandatory.
thanks
Sarbjeet singh
Hi,
Input filed has a property state, you can make the state required then the input filed will be having a (*) before the input field and after the label.
`However this does not do the mandatory check itself. You have to do it programmatic.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Just change the State property of Input field from Normal to REQUIRED.
Now you input field will be mandatory.
Thanks,
Saurav.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
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.