The following abap code shows you how to capture multiple rows selected by the user, Also see capture single selected table row
for information on how to get a single row selected by the user within your web dynpro for ABAP application.
The following method allows the user to select multiple rows and then captures all rows selected together when they
perform an action such as pressing a buttom on the application. You could equally capture each row as and when the user selects/unselects it and then add/delete
each row from a holding table. This simply uses the capturing a single table row functionality
each time the user selects a row so check this out for more information if you want to go with this method..
First step to implementing this is to create a basic web dynpro application which conatians a table and a button
Generic Method - Add code to your button action method
From the actions tab you can double click on your button ACTION to view its associated method and add the below ABAP code to it.
'CARRIERS' is the context node assigned to the table.
Data: context_node type ref to if_wd_context_node. Data: it_scarr type STANDARD TABLE OF if_view1=>element_CARRIERS, wa_scarr like line of it_scarr. data: ld_element type ref to if_wd_context_element, it_selrows type WDR_CONTEXT_ELEMENT_SET, wa_selrows like line of it_selrows. context_node = wd_context->get_child_node( name = 'CARRIERS'). it_selrows = context_node->GET_SELECTED_ELEMENTS( ). LOOP AT it_selrows INTO wa_selrows. CALL METHOD wa_selrows->get_static_attributes IMPORTING static_attributes = wa_scarr. APPEND wa_scarr TO it_scarr. CLEAR wa_scarr. ENDLOOP. * All selected rows will now be contained in it_scarr