on 04-29-2014 11:14 AM
How to enable/disable the input fields based on the data entered in the web dynpro application abap? If the user enters data in one input field then only the next input field should be enabled else it should be in disabled state. Please guide.
Hi,
Try this code.
First create a attribute with the name readonly of type wdy_boolean and bind it read_only property of input field of which is you want to enable or disable.
Next go to Init method.
Set the readonly value as 'X'.
DATA lo_el_context TYPE REF TO if_wd_context_element.
DATA ls_context TYPE wd_this->element_context.
DATA lv_visible TYPE wd_this->element_context-visible.
* get element via lead selection
lo_el_context = wd_context->get_element( ).
* @TODO handle not set lead selection
IF lo_el_context IS INITIAL.
ENDIF.
* @TODO fill attribute
* lv_visible = 1.
* set single attribute
lo_el_context->set_attribute(
name = `READONLY`
value = 'X').
After that Go to the Action ENTER.
First read the input field ( first input field, which is value entered field) , next give a condition
if input value is not initial then set the readonly value is ' '.
DATA lo_nd_input TYPE REF TO if_wd_context_node.
DATA lo_el_input TYPE REF TO if_wd_context_element.
DATA ls_input TYPE wd_this->element_input.
DATA lv_vbeln TYPE wd_this->element_input-vbeln.
* navigate from <CONTEXT> to <INPUT> via lead selection
lo_nd_input = wd_context->get_child_node( name = wd_this->wdctx_input ).
* @TODO handle non existant child
* IF lo_nd_input IS INITIAL.
* ENDIF.
* get element via lead selection
lo_el_input = lo_nd_input->get_element( ).
* @TODO handle not set lead selection
IF lo_el_input IS INITIAL.
ENDIF.
* get single attribute
lo_el_input->get_attribute(
EXPORTING
name = `VBELN`
IMPORTING
value = lv_vbeln ).
if lv_vbeln IS not INITIAL.
DATA lo_el_context TYPE REF TO if_wd_context_element.
DATA ls_context TYPE wd_this->element_context.
DATA lv_visible TYPE wd_this->element_context-visible.
* get element via lead selection
lo_el_context = wd_context->get_element( ).
* @TODO handle not set lead selection
IF lo_el_context IS INITIAL.
ENDIF.
* @TODO fill attribute
* lv_visible = 1.
* set single attribute
lo_el_context->set_attribute(
name = `READONLY`
value = ' ' ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you all for your help
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
pls check this link
SAPTechnical.COM - Enable/Disable & Show/Hide UI Elements in Web Dynpro Java
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If the user enters data in one input field then only the next input field should be enabled else it should be in disabled state.
here after entering the data in one input field, the user has to press Enter.
Create an attribute in context (say enable of type wdy_boolean) and bind the Read-only property of the input field to that attribute. Then create an action of OnEnter event of input field and set the attribute (enable) to abap_false to make it enable.
You can check this wiki for reference: Simple application to change properties of UI Elements during runtime in Web Dynpro ABAP - Web Dynpr...
Regards,
Kiran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
Create a attribute of type WDY_BOOLEAN and bind it to the input field readOnly property which has to be enabled or disabled.
Now on based the user input on first field , write logic on onEnter event for setting the attribute value, which is binded to second input field.
If the input field has to be enabled then set the attribute's value as 'X', otherwise set its value as ' '.
Regards,
Harsha J
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
1. Create a separate node of type WDY_BOOLEAN and bind it to readOnly property of the input, which you want to enable / disable .
2. Now based on user input & your condition, set the value of that attribute accordingly(If the input field has to be enabled then set the attribute's value as 'X', otherwise set its value as ' '.). This piece of code must be written , onEnter even of the input field, where user is entering and based on input you want enable / disable the field.
User | Count |
---|---|
86 | |
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.