cancel
Showing results for 
Search instead for 
Did you mean: 

multiple row selection in standard table..

Former Member
0 Kudos

hi all..

i have a standard table in my view..

I want to select multiple rows from it...

and also need to know which rows have been selected...

any idea...

jagruti..

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Jagruthi,

You can get all selected rows of the node using the method get_selected_elements of IF_WD_CONTEXT_NODE interface.

CALL METHOD mo_wd_context->get_selected_elements

EXPORTING

INCLUDING_LEAD_SELECTION = abap_true

RECEIVING

set = lt_elements.

Here mo_wd_context is the reference to context node that you are using for the table.

Thanks,

Prashanth

mohammed_anzys
Contributor
0 Kudos

hi Jagruti,

Go to the table properties and give SelectionMode = Multiple . This will allow you to select multiple rows.The select rows will be availble in the WDEVENT or lead selection

Thanks

Anzy

Former Member
0 Kudos

hi mohammed ..

thanx for reply..

but im getting a dump....after setting the selection mode to multi..

do i hv to do anything else..

jagruti..

shwetars
Advisor
Advisor
0 Kudos

Hi Jagruti,

In addition to the table ui-element property settings you need to do the following:

In your node properties set the selection property to 0..n if your cardinality is 0..n else set it to 1..n if your cardinality is 1..n.

Regards,

Shweta

mohammed_anzys
Contributor
0 Kudos

Yep..shweta is right..its because of the cardibnality.

Former Member
0 Kudos

hi shweta..

hey thanx..got it..

but now how do i read the values of the rows that hv been selected..

jagruti....

Former Member
0 Kudos

Hi Jagruti:

There is a explanation in the WIKI:

https://wiki.sdn.sap.com/wiki/display/WDABAP/Context#Context-1.110

->How do I get all selected elements of a context node?

Cheers,

Sascha

Message was edited by:

Sascha Dingeldey

shwetars
Advisor
Advisor
0 Kudos

Hi Jagruti,

As prashanth said above you can get all selected rows of the node using the method get_selected_elements of IF_WD_CONTEXT_NODE interface.

CALL METHOD mo_wd_context->get_selected_elements

EXPORTING

INCLUDING_LEAD_SELECTION = abap_true

RECEIVING

set = lt_elements.

next loop through the above internal table and read the attributes of each element using the method get_static_attributes( ) of the interfrace if_wd_context_element.

Regards,

Shweta

Former Member
0 Kudos

hi sascha..

hey it has this code..

data:

lr_context_node type ref to if_wd_context_node,

lr_context_element type ref to if_wd_context_element.

data:

lt_selected_elements type wdr_context_element_set.

data:

ls_some_structure type some_structure.

lr_context_node = wd_context->get_child_node( name = 'NAME' ).

lt_selected_elements = lr_context_node->get_selected_elements( ).

loop at lt_selected_elements into lr_context_element.

lr_context_element->get_static_attributes(

static_attributes = ls_some_structure

).

so wht shud b ls_sone structure...

an internal table na.....

jagruti..

shwetars
Advisor
Advisor
0 Kudos

Hi Jagruti,

It will be a structure. Why don't you use the webdynpro wizard to generate the code to read the atttributes of the node, data declaration would be avialable for you.

Regards,

Shweta

Former Member
0 Kudos

Hi Jagruti.

some_structure is the structure of your context node. if you have for example a

context node of structure kna1 this should be used here.

If you did not assigned a structure to the node just use

TYPE if_v_viewname=>element_contextnodename to get the structure of the node.

Cheers,

Sascha