cancel
Showing results for 
Search instead for 
Did you mean: 

Set one or more rows as selected default in a table

Former Member
0 Kudos

Hello All,

I am using a table UI element in which records are displayed . I want 2 or 3 records to be selected by default in that displayed table . I am able to select one record as selected by default as

node->set_selected ( index = lv_index ) .. I am setting the index . want to set more than 1.

Regards,

Sana..

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi ,

It can be achieved using the set_selected() method of if_wd_context_element.

Sample code.

DATA lo_nd_flight_node TYPE REF TO if_wd_context_node.
                         DATA lo_el_flight_node TYPE REF TO if_wd_context_element.
                         DATA ls_flight_node TYPE wd_this->element_flight_node.

*                        navigate from <CONTEXT> to <FLIGHT_NODE> via lead selection
                         lo_nd_flight_node = wd_context->get_child_node( name = wd_this->wdctx_flight_node ).

                         lo_el_flight_node = lo_nd_flight_node->get_element( index = 3 ).
                         lo_el_flight_node->set_selected( FLAG = abap_true ).
                         
                         lo_el_flight_node = lo_nd_flight_node->get_element( index = 5 ).
                         lo_el_flight_node->set_selected( FLAG = abap_true ).

In the above code , I set 2 elements with index 3 and 5 as selected by default.

Make sure that you have set the selection property of context node as 0:n ..

Thanks,

aditya.

Answers (1)

Answers (1)

Sharathmg
Active Contributor
0 Kudos

Make sure the the selection property of the node should be 1..n or 0..n.

Regards,

Sharath