Skip to Content
Author's profile photo Om Awasthi

Read selected values from table in webdynpro ABAP

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 .


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
      set = lt_sel_elem.

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

Assigned tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Thanks for the hint! Works well! 🙂