Skip to end of metadata
Go to start of metadata

Create a Web Dynpro Application in SE80 like ZDYNPRO_SELECT_OPTIONS

dbl click on  ZDYNPRO_SELECT_OPTIONS in the Used Components Tab

provide Component Use as SELECT_OPTIONS 

Component as WDR_SELECT_OPTIONS

Create  a View SELECT_OPTIONS

In PROPERTIES Tab create Component Use Select both the Select_Options from the POPUP Box 

in the LAYOUT Tab create a ViewContainerUIElement  

search Button with  Action SEARCH and a Table to display the data w.r.t select-options

in METHOD Tab in Method  WDDOINIT give the code

method wddoinit .

*& Data declaration

  data:

    range_table type ref to data,

    read_only   type abap_bool,

    typename    type string.



  data:

    lr_componentcontroller type ref to ig_componentcontroller,

    l_ref_cmp_usage        type ref to if_wd_component_usage.



  l_ref_cmp_usage = wd_this->wd_cpuse_select_options( ).

  if l_ref_cmp_usage->has_active_component( ) is initial.



    l_ref_cmp_usage->create_component( ).



  endif.



  wd_this->select_values = wd_this->wd_cpifc_select_options( ).



* init the select screen

  wd_this->select_option =

wd_this->select_values->init_selection_screen( ).



  wd_this->select_option->set_global_options(

                                i_display_btn_cancel  = abap_false

                                i_display_btn_check   = abap_false

                                i_display_btn_reset   = abap_false

                                i_display_btn_execute = abap_false ).





* create a range table that consists of this new data element

  range_table = wd_this->select_option->create_range_table(

  i_typename = 'MATNR' ).



* add a new field to the selection

  wd_this->select_option->add_selection_field(

  i_id = 'MATNR' it_result = range_table i_read_only = read_only ).


endmethod. 



In Method TAB ONACTIONSEARCH_MATERIAL  give code

 
method onactionsearch_material .


* get message manager

data lo_api_controller     type ref to if_wd_controller.

data lo_message_manager    type ref to if_wd_message_manager.





*& Data declaration

  data:

    material_node type ref to if_wd_context_node,

    t_mara type standard table of mara,

    s_matnr type ref to data,

    fs_matnr type mara.



  field-symbols: <fs_matnr> type table.



* Retrieve the data from the select option

 s_matnr = wd_this->select_option->get_range_table_of_sel_field( i_id =

'MATNR' ).





* Assign it to a field symbol

  assign s_matnr->* to <fs_matnr>.



*& Fetch data from database table <MARA>

  select * from mara up to 100 rows into table t_mara

       where matnr in <fs_matnr>.



*& Navigate from <context> to node <MATERIAL>

  material_node = wd_context->get_child_node( name = 'MATERIAL' ).



*& Bind internal table with node

  material_node->bind_table( t_mara ).



endmethod.
 

 In Windows node map the VIEW with the Window and right click on View_Container-> Embed View-> WND_SELECTION_SCREEN

  • No labels