cancel
Showing results for 
Search instead for 
Did you mean: 

get selected table rows

Former Member
0 Kudos

Hey folks,

i have got some questions with table work.

ive got a table based on a node in the context. with 5 different attributes.

after selection of one or more rows i use a button for the next view.

on that view i have to check 3 of the 5 attributes for further use.

how should i get the selected rows?

i used in the second view a method


  DATA: lo_context_node     TYPE REF TO if_wd_context_node,
        selected_elements   TYPE wdr_context_element_set,
        selected_element    TYPE REF TO if_wd_context_element,

        lv_vbeln            TYPE vbeln,
        lst_vbeln           TYPE string_table.

  lo_context_node = wd_context->get_child_node( 'ABO' ).
  lo_context_node = lo_context_node->get_child_node( 'ABO_UEBERSICHT' ).
  selected_elements = lo_context_node->get_selected_elements( ).

  LOOP AT selected_elements INTO selected_element.
    selected_element->get_attribute( EXPORTING name = 'VBELN'
                                     IMPORTING value = lv_vbeln ).
    APPEND lv_vbeln TO lst_vbeln.
  ENDLOOP.

i tried to get at least one of the fields attributes. but i dont know if this works and i dont know if i should try to get the selected rows on the second view or to somehow store the selected rows in the context before leaving the first view and use this context in second view. but i thought the selection would be marked anyways in the attributes "selection" flag, or not?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

As per ur code u will have the selected elements in SELECTED_ELEMENTS internal table.

1. Get the contents of each element using the method GET_STATIC_ATTRIBUTE( ).

2. Append the contents to an internal table.

3. Bind the internal table to another node using BIND_TABLE method.

4. Use that node to display the data in next view.(Node should be declared in the component controller ).

Ranganathan.

Former Member
0 Kudos

ok, how is the data returned? in definition it says exporting "data" ...

and is it the best way to check selections like get request instead of post request?

and well .. selected elements does give me an empty table

edit: maybe i should inform that i used this selection on the second view not on the view with the table but on the view i am using the table information, but on the explanation before i should get the selection on the tables view and use the context to check what had been selected