on 03-06-2012 4:00 PM
Hi....i have a input field in a view, which is bound with dictionary object of char type ,through context.for this input field, i have to allow the end users to enter the numeric and float values only,but in my condition it accepting everything and returns runtime error.for this how to validate inputs other than numerics.
Thanks & regards,
pavan maganti.
DATA lo_nd_itab2 TYPE REF TO if_wd_context_node.
DATA lo_el_itab2 TYPE REF TO if_wd_context_element.
DATA ls_itab2 TYPE wd_this->element_itab2.
DATA lv_non_numeric TYPE wd_this->element_itab2-non_numeric.
* get message manager
DATA lo_api_controller TYPE REF TO if_wd_controller.
DATA lo_message_manager TYPE REF TO if_wd_message_manager.
* navigate from <CONTEXT> to <ITAB2> via lead selection
lo_nd_itab2 = wd_context->get_child_node( name = wd_this->wdctx_itab2 ).
* get element via lead selection
lo_el_itab2 = lo_nd_itab2->get_element( ).
* get single attribute
lo_el_itab2->get_attribute(
EXPORTING
name = `NON_NUMERIC`
IMPORTING
value = lv_non_numeric ).
IF lv_non_numeric CO '1234567890'.
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_success
EXPORTING
message_text = 'All numeric'.
ELSE.
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_warning
EXPORTING
message_text = 'Contains characters'.
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Please try with this code and see whether it solves your purpose:
IF ur_attribute CO '0123456789'.
then set the value for your element.
Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Assign your datatype of the field as numc.so that you can enter only numbers.
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.