cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple selection of rows in webdynpro

Former Member
0 Kudos

Hi All,

How can we achieve the multiple selection of rows in a table in webdynpro and delete the same.

If i have a table with 4 rows i have selected 2 rows and i have to delete those 2 rows.

Thanks in Advance,

Bsreddy.

Accepted Solutions (0)

Answers (5)

Answers (5)

uday_gubbala2
Active Contributor
0 Kudos

Hi Srinivas,

Is your issue resolved? If yes then please do the needful & close this thread.

Regards,

Uday

uday_gubbala2
Active Contributor
0 Kudos

This is the code for deleting the multiple lines which might be selected by the user. I had earlier provided the code for fetching all selected lines in the table just for your reference. You dont need to use that for achieving the delete functionality.

Regards,

Uday

METHOD onactiondelete_selected_rows .
  DATA:  wd_node TYPE REF TO if_wd_context_node,
         lt_node1 TYPE ig_componentcontroller=>elements_node1,
         wa_temp  TYPE REF TO if_wd_context_element,
         lt_temp  TYPE wdr_context_element_set,
         row_number TYPE i VALUE 0.


  wd_node = wd_context->get_child_node( name = 'NODE1' ).

  CALL METHOD wd_node->get_selected_elements
    RECEIVING
      set = lt_temp.

  LOOP AT lt_temp INTO wa_temp.
    wd_node->remove_element( EXPORTING element = wa_temp ).
  ENDLOOP.

  CALL METHOD wd_node->get_static_attributes_table
    EXPORTING
      from  = 1
      to    = 2147483647
    IMPORTING
      table = lt_node1.

  wd_node->bind_table( new_items = lt_node1 ).
ENDMETHOD.

UmaArjunan
Active Participant
0 Kudos

Hi Uday,

I have the same thing to be handled in the WD application. The coding provided here is very useful and i can able to get the multiple row selection in the table.

Thank you very much....

Regards,

ABAP Dev

uday_gubbala2
Active Contributor
0 Kudos

Hi Srinivas,

Steps to make multiple rows selectable in table:

1) Create the selection property of the node that you are binding to the table as o..n

2) Un-check the, "Initialization Lead Selection" checkbox for the node which you are using to bind to the table

3) In the Layout go to the table & specify selection mode as MULTI_NO_LEAD. It is important that you set the selection mode to MULTI_NO_LEAD or else in the end you would be capturing 1 row lesser than the total number of rows the user has selected. This is because 1 of the rows would have the LeadSelection property & our logic wouldn't be reading the data for that row. Check the example code fragment as shown below:

Steps to get the multiple rows selected by the user:

In order to get the multiple rows which were selected by the user you will just have to call the get_selected_elements method of if_wd_context_node. First get the reference of the node which you have used to bind to the table & then call this method on it. Check the example code fragment below:

METHOD get_selected_rows .
  DATA: temp TYPE string.
 
  DATA: lr_node TYPE REF TO if_wd_context_node,
            wa_temp  TYPE REF TO if_wd_context_element,
            ls_node1 TYPE wd_this->element_node_flighttab,
            lt_node1 TYPE wd_this->elements_node_flighttab.
 
  lr_node = wd_context->get_child_node( name = 'NODE_FLIGHTTAB' ).
" This would now contain the references of all the selected rows
  lt_temp = lr_node->get_selected_elements( ).
 
    LOOP AT lt_temp INTO wa_temp.
" Use the references to get the exact row data
      CALL METHOD wa_temp->get_static_attributes
        IMPORTING
          static_attributes = ls_node1.
      APPEND ls_node1 TO lt_node1.
      CLEAR ls_node1.
    ENDLOOP.
ENDMETHOD.

So now lt_node1 containes information about all the rows which are selected by the user.

Former Member
0 Kudos

Hi Uday Gubbala,

  Thanks for the Code,may i know the Node name which you are using and the type of lt_temp.It's throwing an error

Former Member
0 Kudos

Hi,

go thru this thread

thnks

arjun_thakur
Active Contributor
0 Kudos

Hi,

Refer this thread:

I hope it helps.

Regards

Arjun