on 10-23-2009 7:42 AM
Hi expert,
I have two views in my component and based on the input field in view1 ,whether it is empty or not , I want to make another input field in view2
Editable .
Rgds
U need to proceed as follows :
1 create a attribute in component controller under ATTRIBUTEu2019s tab , say attr1 of type wdy_boolean
2 suppose ur 1st view has input field binded to ca_attribute under cn_node , read it
Using code wizard by CNTRL + F7
3 check whether user has entered value , read attributeu2019s value
4 if user has entrd value , make attr1 as u2018Xu2019
Wd_comp_controller->attr1 = u2018Xu2019.
5 make a context attribute of type wdy_boolean in ur second view, say GDDB under node cn_select
6 bind it wid the the field whicn needs to be editable , set it to X to make the field editable and
if attr1 EQ u2018Xu2019 , set it to u2018Xu2019 , otherwise blank u2018 u2018 .
U need to proceed as follows :
1 create a attribute in component controller under ATTRIBUTEu2019s tab , say attr1 of type wdy_boolean
2 suppose ur 1st view has input field binded to ca_attribute under cn_node , read it
Using code wizard by CNTRL + F7
3 check whether user has entered value , read attributeu2019s value
4 if user has entrd value , make attr1 as u2018Xu2019
Wd_comp_controller->attr1 = u2018Xu2019.
5 make a context attribute of type wdy_boolean in ur second view, say GDDB under node cn_select
6 bind it wid the the field whicn needs to be editable , set it to X to make the field editable and
if attr1 EQ u2018Xu2019 , set it to u2018Xu2019 , otherwise blank u2018 u2018 .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Read ca_attribute
DATA lo_nd_cn_attribute TYPE REF TO if_wd_context_node.
DATA lo_el_cn_attribute TYPE REF TO if_wd_context_element.
DATA ls_cn_attribute TYPE wd_this->element_cn_attribute.
DATA lv_ca_attribute LIKE ls_cn_attribute-ca_attribute.
* navigate from <CONTEXT> to <CN_ATTRIBUTE> via lead selection
lo_nd_cn_attribute = wd_context->get_child_node( name = wd_this->wdctx_cn_attribute ).
* get element via lead selection
lo_el_cn_attribute = lo_nd_cn_attribute->get_element( ).
* get single attribute
lo_el_cn_attribute->get_attribute(
EXPORTING
name = `CA_ATTRIBUTE`
IMPORTING
value = lv_ca_attribute ).
Check if user has enterd value
If lv_ca_Attribute NE u2018 u2018 .
Wd_comp_controller->attr1 EQ u2018Xu2019.
ELSE.
Wd_comp_controller->attr1 EQ u2018 u2019.
ENDIF.
In ur second view
// if attr1 is u2018Xu2019 , make field editable
IF wd_comp_controller->attr1 EQ u2018Xu2019.
DATA lo_nd_cn_select TYPE REF TO if_wd_context_node.
DATA lo_el_cn_select TYPE REF TO if_wd_context_element.
DATA ls_cn_select TYPE wd_this->element_cn_select.
DATA lv_gddb LIKE ls_cn_select-gddb.
* navigate from <CONTEXT> to <CN_SELECT> via lead selection
lo_nd_cn_select = wd_context->get_child_node( name = wd_this->wdctx_cn_select ).
* get element via lead selection
lo_el_cn_select = lo_nd_cn_select->get_element( ).
* set single attribute
lo_el_cn_select->set_attribute(
EXPORTING
name = `GDDB`
value = lv_gddb ).
do revert in case of any issue. It is working fine for me
regards,
amit
hi,
1. bind the editable property of input field in view 2 with an attribute of wdy_boolean.
2. Now check the value of input field in view1 and based on it set the value of attribute binded to enable property in view2.
For enable : Set as 'X'.
for disable : Set as ' '.
To read the value of input field in View1 :
1. Map the context attributes of view1 with component controller. Similliarly in View2.
2. This way you can read the value of input field of View1 in View2 dirrectly by just reading the attribute's value.
if lv_input1 is initial.
<set non-editable>
else .
<set view2 input field editable>
Edited by: Saurav Mago on Oct 23, 2009 12:15 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
U can do it using wd_comp_controller . create context in ur component controller , in this way the context wud be accessible in both the views .
If u r new to WDA , refer these articles :
Main Topic Page:
http://sdn.sap.com/irj/sdn/nw-wdabap#section2
Tutorials for Beginners:
eLearning Videos:
/people/thomas.jung/blog/2006/06/20/web-dynpro-abap-demonstration-videos
regards,
amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
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.