on 06-05-2012 4:58 AM
HI
I am new to webdynpro ABAP. My requirement is, user should be able to select multiple values in dropdown. I came to know that it can be done using drop down by key. Can anybody explain how to do data binding and fetch the selected data from dropdown by key. I was searching in the forum, but didnot get any helpful answer.Your inputs would be really helpful.
Thanks,
Pallavi.
Hi pallavi,
Refer the following thread for better understanding about dropdown by key.
http://scn.sap.com/thread/556251
Hope its useful to u,
Regards
Jana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thanks for your replies. I tried implementing it. But when I run the application, it is giving dump saying, that node doesnot contain any elements.
My context node is like this -
Mainnode->subnode(cardinaity 0 to n) ->attribute value, attribute text.
I am binding attribute text value to screen element.
Please find my code below.
DATA lo_nd_cn_cuase TYPE REF TO if_wd_context_node.
DATA lo_el_cn_cuase TYPE REF TO if_wd_context_element.
DATA ls_cn_cuase TYPE wd_this->element_cn_cuase.
DATA wa_code like LINE OF int_code.
* navigate from <CONTEXT> to <CN_CUASE> via lead selection
lo_nd_cn_cuase = wd_context->path_get_node( path = `CN_REQUESTDETAILS.CN_CUASE` ).
* get element via lead selection
lo_el_cn_cuase = lo_nd_cn_cuase->get_element( ).
data wd_node_info type ref to if_wd_context_node_info.
data value_set type wdr_context_attr_value_list.
data: lv_value TYPE WDR_CONTEXT_ATTR_VALUE.
LOOP AT int_code INTO wa_code.
MOVE wa_code-code TO lv_value-value.
MOVE wa_code-KURZTEXT TO lv_value-text.
APPEND lv_value to value_s
DATA lo_nd_cn_cuase TYPE REF TO if_wd_context_node.
DATA lo_el_cn_cuase TYPE REF TO if_wd_context_element.
DATA ls_cn_cuase TYPE wd_this->element_cn_cuase.
DATA wa_code like LINE OF int_code.
* navigate from <CONTEXT> to <CN_CUASE> via lead selection
lo_nd_cn_cuase = wd_context->path_get_node( path = `CN_REQUESTDETAILS.CN_CUASE` ).
* get element via lead selection
lo_el_cn_cuase = lo_nd_cn_cuase->get_element( ).
data wd_node_info type ref to if_wd_context_node_info.
data value_set type wdr_context_attr_value_list.
data: lv_value TYPE WDR_CONTEXT_ATTR_VALUE.
LOOP AT int_code INTO wa_code.
MOVE wa_code-code TO lv_value-value.
MOVE wa_code-KURZTEXT TO lv_value-text.
APPEND lv_value to value_set.
ENDLOOP.
wd_node_info = lo_nd_cn_cuase->get_node_info( ).
wd_node_info->set_attribute_value_set( name = 'CA_CAUSE_TXT'
value_set = value_set ).
Hi Nagapallavi,
Do one thing create node and subnode with one attribute type string only.and maintain and maintain cardin 0...n.
According to u r node replace node name ...
DATA: lo_nd_context TYPE REF TO if_wd_context_node,
lo_nd_dropdwn TYPE REF TO if_wd_context_node_info.
*Beach Is Node Name...Here u place u r node name.
lo_nd_context = wd_context->get_child_node( 'BEACH' ).
lo_nd_dropdwn = lo_nd_context->get_node_info( ).
* Initially assign NULL value to dropdown
lo_nd_context->bind_element( EXPORTING new_item = ls_beach_hut set_initial_elements = abap_false ).
DATA ls_beach_hut TYPE wd_this->element_beach_hut.
lo_nd_context = wd_context->get_child_node( 'BEACH' ).
* Initially assign NULL value to dropdown
lo_nd_context->bind_element( EXPORTING new_item = ls_beach_hut set_initial_elements = abap_false ).
LOOP AT lt_name INTO ls_name.
ls_key-value = ls_name-code.
ls_key-text = ls_name-name.
APPEND ls_key TO lt_key.
lo_nd_dropdwn->set_attribute_value_set( name = 'KEY' value_set = lt_key ).
Regards,
Venkat.
Hi Venkat,
Thanks a lot. That dump issue is resolved and i am able to populate data to dropdown.
I have a few quries here.
1. How do I select multiple entries and capture the selected values?
2. Once get selected data, that needs to be stored in backed. and in next step, need to display the selected entries.(Mean, the entries selected in previous step need to be showed as selected).
Thanks,
Pallavi.
Hi Pallavi,
Refer the following link for step by step process to select multiple values in dropdown.
http://www.saptechnical.com/Tutorials/WebDynproABAP/Listbox/page1.htm
Hope its useful to u,
Regards
Jana
Hi Nagapallavi,
When u select data then in context u will get code value that is selected text value.... Thse values normally we stord in master tables.
like below
value text
100 abc
200 def
in dropdown we can see text values( abc,def) when u select abc then the value is come '100' in context..Here w e have to read context value means '100'.. depending up on these values we can get text from tables..and in data base we can save to header and details table......
regards,
Venkat
Hi
I need to select a value (set lead selection index incase of drop down by index) of drop down by key.
How can i achieve it? In dropwodn by index case i can do it like - fetch all the values using get_static_attributes_table and then do set_lead_selection_Index.
Bot how about it incase of DD by key? whenI use get_static_attributes_table, it is not etching the values.
Thanks,
Pallavi.
you can check the below wiki post.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.