Scenario on displaying listbox (Multiple selections) using WebDynpro for ABAP

...Previous

11. Click on ROOTUIELEMENTCONTAINER create element TABLE.

12. Right click on TABLE element and select create binding.


 

13. click on ROOTUIELEMENTCONTAINER create element BUTTON

14. Create an action for BUTTON. 

 

15. Now Double Click on ON_DISPLAY method and write following code.

METHOD onactionon_display .
* Data Declaration 
  DATA lo_nd_airline TYPE REF TO if_wd_context_node.
  DATA lo_el_airline TYPE REF TO if_wd_context_element.
  DATA lt_elements TYPE wdr_context_element_set.
  DATA ls_airline TYPE wd_this->element_airline.
  DATA it_type TYPE wd_this->elements_airline.
  DATA lv_id LIKE ls_airline-id.
  
  DATA lo_nd_sflight TYPE REF TO if_wd_context_node.
  DATA lo_el_sflight TYPE REF TO if_wd_context_element.
  DATA lt_sflight TYPE wd_this->elements_sflight.
  DATA lt_sflight2 TYPE wd_this->elements_sflight.
  DATA ls_sflight TYPE wd_this->element_sflight.
* navigate from <CONTEXT> to <AIRLINE> via lead selection
  lo_nd_airline = wd_context->get_child_node( name = wd_this->wdctx_airline ).
  lt_elements = lo_nd_airline->get_selected_elements( ).
  LOOP AT lt_elements INTO lo_el_airline.
    lo_el_airline->get_static_attributes( IMPORTING static_attributes = ls_airline ).
    APPEND ls_airline TO it_type.
  ENDLOOP.                             " LOOP AT lt_elements  
  lo_nd_sflight = wd_context->get_child_node( name = wd_this->wdctx_sflight ).
     SELECT  carrid
             connid
             fldate
             currency
             planetype 
       FROM  sflight
  INTO TABLE lt_sflight.
  LOOP AT it_type INTO ls_airline.
    LOOP AT lt_sflight INTO ls_sflight WHERE carrid = ls_airline-id.
      APPEND ls_sflight TO lt_sflight2.
    ENDLOOP.                           " LOOP AT lt_sflight
  ENDLOOP.                             " LOOP AT it_type
* Bind Internal table with Table Element
  lo_nd_sflight->bind_table( lt_sflight2 ).  
ENDMETHOD. 

16. Right Click on Web DynPro application and select Create Application.

 

17. Test Application. 

OUTPUT : 

 

Select multiple values by pressing CTRL button. And click on Display button. Data for selected values will be displayed in TABLE element like below. 

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image