Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
om_awasthi1
Participant

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
    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.

1 Comment
Labels in this area