on 05-19-2009 9:03 AM
Hi Community
How can I do this requirement with WebDynpro
There is a button and a textinput field. Every time when you click on this button, for example, the letter K must appear in this Textinput field. Whenever you click on it button letter K should appear. In five clicks just five times the letter K.
For each assistance, I would be very grateful.
Friendly Reagards
spielwiese ++
Hi,
Firstly create an attribute 'TEXT' type string and bind it to your textinput field.
Secondly create a method for the onAction event of the button.
Now in this method write the following code.
DATA lo_el_context TYPE REF TO if_wd_context_element.
data: l_text type string.
lo_el_context = wd_context->get_element( ).
" read the attribute.
lo_el_context->get_attribute(
EXPORTING
name = `TEXT`
IMPORTING
value = l_text ).
" append 'K' and set the attribute
if l_text is initial.
l_text = 'K'.
else.
concatenate l_text 'K' into l_text.
endif.
lo_el_context->set_attribute(
EXPORTING
name = `TEXT`
value = l_text ).
Hope it helps!
Regards,
Radhika.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Make use of below code.
1) Take an Input field and a button in the layout.
Create an ATTRIBUTE in the context of type string
2) Bind the attribute to input filed VALUE property
3) In the event ONACTION create a menthod disp_k.
in side the method write the below logic.
DATA:
elem_context TYPE REF TO
if_wd_context_element,
stru_context TYPE
if_view=>element_context ,
item_text LIKE stru_context-text.
* get element via lead selection
elem_context = wd_context->get_element( ).
elem_context->get_attribute(
EXPORTING
name = `TEXT`
IMPORTING
value = item_text ).
if item_text is initial.
item_text = 'K'.
else.
concatenate item_text 'K' into item_text.
endif.
** get single attribute
CALL METHOD elem_context->set_attribute
EXPORTING
* INDEX = USE_LEAD_SELECTION
VALUE = item_text
name = 'TEXT'.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.