cancel
Showing results for 
Search instead for 
Did you mean: 

To make the input field editable

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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 .

Former Member
0 Kudos

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

Answers (2)

Answers (2)

Former Member
0 Kudos

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

Former Member
0 Kudos

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:

[original link is broken]

eLearning Videos:

/people/thomas.jung/blog/2006/06/20/web-dynpro-abap-demonstration-videos

regards,

amit