on 11-10-2008 3:29 PM
Hi all, I have an ItemListBox in my WD application, which I have used a supply function to provide data to populate the listbox.
Now I have this snippet of code (generated with the Code Wizard) that is supposed to read the value that the user selects:
DATA lo_nd_node_mynode TYPE REF TO if_wd_context_node.
DATA lo_el_node_mynode TYPE REF TO if_wd_context_element.
DATA ls_node_mynode TYPE wd_this->element_node_mynode.
navigate from <CONTEXT> to <NODE_MYNODE> via lead selection
lo_nd_node_mynode = wd_context->get_child_node( name = wd_this->wdctx_node_mynode ).
get element via lead selection
lo_el_node_mynode = lo_nd_node_mynode->get_element( ).
get all declared attributes
lo_el_node_mynode->get_static_attributes(
IMPORTING
static_attributes = ls_node_mynode ).
Here comes the problem: When "multipleSelection" is unchecked, I am able to retrieved the single value selected from "ls_node_mynode".
However, when I check multipleSelection, ls_node_mynode gives nothing.
What gives? I know this is really a simple question, but I am unable to find anything remotely useful in the documentation for this. Thanks in advance.
Hi HSKOK,
Please try to understand following code it will solve your problem.And its a running code so u can use it .
data lt_elements type wdr_context_element_set.
data lr_node type REF TO if_wd_context_node.
data node_element type ref to IF_WD_CONTEXT_ELEMENT.
data it_type type wd_this->elements_ZPROMOTIONS.
data wa_type type wd_this->element_ZPROMOTIONS.
lr_node = wd_context->get_child_node( 'ZPROMOTIONS' ).
lt_elements = lr_node->get_selected_elements( ).
loop at lt_elements into node_element.
node_element->get_static_attributes( importing static_attributes = wa_type ).
append wa_type to it_type.
endloop.
Here you need to understand why above loop has been introduced
regards
PG
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you, Abap WD and PG. I have resolved my question with help from both your answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use this method of the interface node GET_SELECTED_ELEMENTS, and change the context to multiple selection.
You are getting only one record bcoz you are using get_static_attributes method, which will only retrun one row.
Hope it works.
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.