Skip to Content

Step to read the selected data from the table in webdynpro abap.

1. Create a method for the table in the property onselect  ( like get_data ) . Please find the screen shot below .

/wp-content/uploads/2013/01/method_178422.png

2. Declare the internal table and work area for the attribute to fetch which is selected.

3. Give the reference to the table which you want to have use method get_selected_elements for the node which is declared above to fetch the data .

4. Loop the selected elements and extrat the exact data which is present in the selected instance .

Sample code

  DATA :   lt_sel_elem       TYPE wdr_context_element_set.
  FIELD-SYMBOLS <ls_sel_elem> TYPE REF TO if_wd_context_element.

  DATA lo_nd_n_result TYPE REF TO if_wd_context_node.

  DATA ls_n_result TYPE wd_this->element_n_result.
  DATA lt_n_result TYPE wd_this->elements_n_result.

*   navigate from <CONTEXT> to <N_RESULT> via lead selection
  lo_nd_n_result = wd_context->get_child_node( name = wd_this->wdctx_n_result ).

*   @TODO handle non existant child
*   IF lo_nd_n_result IS INITIAL.
*   ENDIF.

  CALL METHOD lo_nd_n_result->get_selected_elements
    RECEIVING
      set = lt_sel_elem.

**fetching selected entries
  LOOP AT lt_sel_elem ASSIGNING <ls_sel_elem> .
    CALL METHOD <ls_sel_elem>->get_static_attributes
      IMPORTING
        static_attributes = ls_n_result.
    APPEND ls_n_result TO lt_n_result .
  ENDLOOP.

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

Leave a Reply