on 02-21-2010 3:11 AM
Is it possible that the value in the drop down list is not the same as the select result?
For example,
Drop down list
1 - Name1
2 - Name2
3 - Name3
when I select '1 - Name1', in the drop down list selected item, it will show 'Name1'?
Thanks and best regards,
Anders,
Hi Anders Hejlsberg
Please check below code: Here I have attached a dropdown values for attribute LIST_ID of node LIST. The data type of
LIST_ID is CHAR02.
DATA: lo_node TYPE REF TO if_wd_context_node,
lo_node_info TYPE REF TO if_wd_context_node_info,
ls_value_set TYPE wdr_context_attr_value,
lt_value_set TYPE TABLE OF wdr_context_attr_value,
wa_list_id TYPE ty_list,
it_list_id TYPE STANDARD TABLE OF ty_list.
" Create List
ls_value_set-value = '01'.
ls_value_set-text = 'Text One'.
APPEND ls_value_set TO lt_value_set.
ls_value_set-value = '02'.
ls_value_set-text = 'Text Two'.
APPEND ls_value_set TO lt_value_set.
ls_value_set-value = '03'.
ls_value_set-text = 'Text Three'.
APPEND ls_value_set TO lt_value_set.
" Assing value help to context attribute
lo_node = wd_context->get_child_node( name = wd_this->wdctx_list ).
CALL METHOD lo_node_info->set_attribute_value_set
EXPORTING
name = 'list_id'
value_set = lt_value_set.
The dropdown will show following list:
Text One
Text Two
Text Three
Upon selecting any value in the dropdwon it will show the selected value but it will save the ID of perticular entry
(i.e. 01 or 02 or 03) in the context attribute.
Regards,
Vikrant
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Please clarify ur requirement in more detail. U are not supposed to change the text.
In drop down by key when u are selecting any value then at the back-end u are having the key for that selected value.
At the on select event u can check the key and Set_attribute the attribute which is binded to the the DDK.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
It is possible to do that. Just follow the steps:
1. Create a drop down by key and populate it with values :
Key - 01 Value : Name1
Key - 02 Value : Name2.
2. Now implement the OnSelect Event of Drop down by key.
3. Get the value selected in the OnSelect event as :
DATA lo_nd_ddk_n TYPE REF TO if_wd_context_node.
DATA lo_el_ddk_n TYPE REF TO if_wd_context_element.
DATA ls_ddk_n TYPE wd_this->element_ddk_n.
DATA lv_ddk LIKE ls_ddk_n-ddk.
* navigate from <CONTEXT> to <DDK_N> via lead selection
lo_nd_ddk_n = wd_context->get_child_node( name = wd_this->wdctx_ddk_n ).
* get element via lead selection
lo_el_ddk_n = lo_nd_ddk_n->get_element( ).
* get single attribute
lo_el_ddk_n->get_attribute(
EXPORTING
name = `DDK`
IMPORTING
value = lv_ddk ).
Note : The above code can be generated using Code Wizard(Control + F7 ).
4. Now you have the key of value selected in the local variable lv_ddk.
5. Based on key , set the attribute binded to Drop down :
if lv_ddk = '01'.
lo_el_ddk_n->set_attribute(
name = `DDK`
value = 'Name_One').
else.
lo_el_ddk_n->set_attribute(
name = `DDK`
value = 'Name_Two').
ENDIF.
Note : In the above code DDK is my context Attribute binded to Drop down by key.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.