Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata


    Idea of this wiki is to provide multiple selection screens in the Webdynpro application and to simplify the time required to create multiple reports/add change or remove any selection parameters in the screen and define the list of output fields that you want to see with less maintenance.


  I have created a table which would serve as the deciding parameter of what are the fields that you are going to enable it for select options and what is the order you need it on the layout and incase if you are using tab then it should get into which tab.    Create a table with the below structure.

ReportName would specify what Webdynpro application this report refers to.

Counter refers to the field order in the select option

FieldName refers to what is the Field Name in the table

Roll Name refers to the Data Element which is used when creating the selection fields

Selection refers to if the Data Element needs to be a part of the Selection Field

ListOutput refers to the columns that are going to be a part of the output table

SelOptions refers to the select-option variables that are referred in the program


(The idea is to create a ALV output report in ABAP and the result of it would be used to show the ALV output in the Webdynpro Application).  Please refer to the attachment of the Transparent Table ZTSLREPORTLIST         Value that is stored in the report table is going to look this


 Create a Webdynpro Application and on the used component create as many select option block as you want to create. In this case I have created a Tab Strip UI Element and created as many tab element I want to use. I presume that if some is going to try this approach has basic understanding of how selection screen option works in ABAP Webdynpro.



   Create the context which would hold the value of the ReportList data which is used for filtering the selection fields, to which selection block the data should go and the output data column elimination on the report display.  Code to add the four selection blocks. 


method set_selectionscreen .
  data lo_nd_reportlist type ref to if_wd_context_node.
  data lo_el_reportlist type ref to if_wd_context_element.
  data ls_reportlist type wd_this->element_reportlist.
  data lv_selection like ls_reportlist-selection.
  data lv_rolename like ls_reportlist-rollname.
  data lv_fieldname like ls_reportlist-fieldname.
  data lv_tabseq like ls_reportlist-tabseq.
  data fieldname type string.
  data rolename type string.
  data listcount type i.
  data count type i.
  l_ref_cmp_usage       type ref to if_wd_component_usage,
  l_ref_cmp_usage_cg       type ref to if_wd_component_usage,
  l_ref_cmp_usage_div       type ref to if_wd_component_usage,
  l_ref_cmp_usage_prd       type ref to if_wd_component_usage,
  lt_range_table        type ref to data,
  lt_range_table2       type ref to data,
  lw_dataelement        type        string,
  lr_range_table        type ref to data,
  lr_range_tablecg      type ref to data,
  lr_range_tablediv      type ref to data,
  lr_range_tableprd      type ref to data,
  lr_datadescr          type ref to cl_abap_datadescr,
  lr_tabledescr         type ref to cl_abap_tabledescr,
  lr_parameter          type ref to data.
  <fs_value>       type any,
  <fs_sign>        type any,
  <fs_option>      type any,
  <fs_low>         type any,
  <fs_high>        type any,
  <ls_range_table> type any,
  <lt_range_table> type table,
  <ls_range_table1> type any,
  <lt_range_table1> type table.
  it_tslreportlist type standard table of ztslreportlist.
  data :
  lw_count         type ztslreportlist-tabseq.
* create the used component
  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( ).
  l_ref_cmp_usage_cg = wd_this->wd_cpuse_select_optionscg( ).
  if l_ref_cmp_usage_cg->has_active_component( ) is initial.
    l_ref_cmp_usage_cg->create_component( ).
  l_ref_cmp_usage_div = wd_this->wd_cpuse_select_optionsdiv( ).
  if l_ref_cmp_usage_div->has_active_component( ) is initial.
    l_ref_cmp_usage_div->create_component( ).
  l_ref_cmp_usage_prd = wd_this->wd_cpuse_select_optionsprd( ).
  if l_ref_cmp_usage_prd->has_active_component( ) is initial.
    l_ref_cmp_usage_prd->create_component( ).

  lo_nd_reportlist = wd_context->get_child_node( name = wd_this->wdctx_reportlist ).
* Get a pointer to the interface controller of the select options component
  wd_this->mwdselectoptions        = wd_this->wd_cpifc_select_options( ).
  wd_this->mwdselectoptions_cg    = wd_this->wd_cpifc_select_optionscg( ).
  wd_this->mwdselectoptions_div    = wd_this->wd_cpifc_select_optionsdiv( ).
  wd_this->mwdselectoptions_prd    = wd_this->wd_cpifc_select_optionsprd( ).

  wd_this->m_handler               = wd_this->mwdselectoptions->init_selection_screen( ).
  wd_this->m_handler_cg            = wd_this->mwdselectoptions_cg->init_selection_screen( ).
  wd_this->m_handler_div           = wd_this->mwdselectoptions_div->init_selection_screen( ).
  wd_this->m_handler_prd           = wd_this->mwdselectoptions_prd->init_selection_screen( ).

  select * from ztslreportlist into table it_tslreportlist where reportname = 'ZSCR_FILEUPLOAD'
                                                             and selection  = 'X'.
  check syst-subrc is initial.
  lo_nd_reportlist->bind_table( it_tslreportlist ).
  call method lo_nd_reportlist->get_element_count( receiving count = listcount ).
  while count < listcount.
    count = count + 1.
    lo_el_reportlist = lo_nd_reportlist->get_element( index = count ).
    lo_el_reportlist->get_attribute( exporting name  = `SELECTION`
                                     importing value =  lv_selection ).
    lo_el_reportlist->get_attribute( exporting name =  `FIELDNAME`
                                     importing value = lv_fieldname ).
    move lv_fieldname to fieldname.
    lo_el_reportlist->get_attribute( exporting name =  `ROLLNAME`
                                     importing value = lv_rolename ).
    lo_el_reportlist->get_attribute( exporting name =  `TABSEQ`
                                     importing value = lv_tabseq ).

    if lv_selection eq 'X'.
      move lv_rolename to rolename.
      lr_range_table   = wd_this->m_handler->create_range_table( i_typename = rolename ).
      if rolename eq 'SYST-DATUM'.
        rolename = 'SYSTDATUM'.
      case lv_tabseq.
        when '1'.
          wd_this->m_handler->add_selection_field( i_id                     =  rolename
                                                   i_is_auto_description    =  abap_false
                                                   it_result                =  lr_range_table
                                                   i_read_only              =  abap_false ).

*        concatenate rolename 'CG' into rolename.
        when '2'.
          lr_range_tablecg   = wd_this->m_handler_cg->create_range_table( i_typename = rolename ).
          wd_this->m_handler_cg->add_selection_field( i_id                  =  rolename
                                                      i_is_auto_description =  abap_false
                                                      it_result             =  lr_range_tablecg
                                                      i_read_only           =  abap_false ).

        when '3'.
          lr_range_tablediv   = wd_this->m_handler_div->create_range_table( i_typename = rolename ).
          wd_this->m_handler_div->add_selection_field( i_id                  =  rolename
                                                      i_is_auto_description =  abap_false
                                                      it_result             =  lr_range_tablediv
                                                      i_read_only           =  abap_false ).

        when '4'.
          lr_range_tableprd   = wd_this->m_handler_prd->create_range_table( i_typename = rolename ).
          wd_this->m_handler_prd->add_selection_field( i_id                  =  rolename
                                                      i_is_auto_description =  abap_false
                                                      it_result             =  lr_range_tableprd
                                                      i_read_only           =  abap_false ).
* Set the std function button visiblity to False
  call method wd_this->m_handler->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.
  call method wd_this->m_handler_cg->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.
  call method wd_this->m_handler_div->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.
  call method wd_this->m_handler_prd->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.

    Execute functionality   On Execute we are calling a method which would capture all the inputted data and passed it on to a report to get the data out. In our case "zccrm_get_opp_list" is the report which used to retrive the data.  method get_reportdata .
  include ziget_reportdata_decl.
  select * from ztslreportlist into table it_ztslreportlist where reportname = 'ZSCR_FILEUPLOAD'
                                                              and selection  = 'X'.
  loop at it_ztslreportlist into lw_ztslreportlist.
    move lw_ztslreportlist-rollname to rolename.
    case lw_ztslreportlist-tabseq.
      when 1.
        rt_temp = wd_this->m_handler->get_range_table_of_sel_field( i_id = rolename ).
      when 2.
        rt_temp = wd_this->m_handler_cg->get_range_table_of_sel_field( i_id = rolename ).
      when 3.
        rt_temp = wd_this->m_handler_div->get_range_table_of_sel_field( i_id = rolename ).
      when 4.
        rt_temp = wd_this->m_handler_prd->get_range_table_of_sel_field( i_id = rolename ).
      when others.
    case rolename.
      when 'CRMT_OBJECT_ID_DB'.
        assign rt_temp->* to <fs_object>.
      when 'ZDESLSHBU'.
        assign rt_temp->* to <fs_sslshbu>.
        assign rt_temp->* to <fs_ssorder>.
        assign rt_temp->* to <fs_sfbdeal>.
      when 'ZDESLBUSUNIT'.
        assign rt_temp->* to <fs_sbusunit>.
      when 'ZDESLSEGMENT'.
        assign rt_temp->* to <fs_ssegment>.
      when 'ZDESLFPOQTR'.
        assign rt_temp->* to <fs_sfpoqtr>.
      when 'ZDESLFCOMMIT'.
        assign rt_temp->* to <fs_sfcommit>.
        assign rt_temp->* to <fs_sfrup>.
        assign rt_temp->* to <fs_sfndeal>.
        assign rt_temp->* to <fs_sfuequip>.
      when 'ZDESLFRISKTYPE'.
        assign rt_temp->* to <fs_sfrtyp>.
      when 'ZDESLDPOQTR'.
        assign rt_temp->* to <fs_sdpoqtr>.
      when 'ZDESLDCOMMIT'.
        assign rt_temp->* to <fs_sdcommit>.
        assign rt_temp->* to <fs_sdru>.
        assign rt_temp->* to <fs_sdequip>.
        assign rt_temp->* to <fs_sddeal>.
      when 'ZDESLDRISKTYPE'.
        assign rt_temp->* to <fs_sdrtyp>.
      when 'ZDESLPRODGRP'.
        assign rt_temp->* to <fs_spgrp>.
      when 'ZDESLDIVISION'.
        assign rt_temp->* to <fs_sdiv>.
      when 'ZDESLFAMILY'.
        assign rt_temp->* to <fs_sfamily>.
      when 'ZDEPRODUCT'.
        assign rt_temp->* to <fs_sprodi>.
  lo_el_context = wd_context->get_element(  ).
  lo_el_context->get_attribute( exporting name  = 'DESCRIPTIONREQ'
                                importing value =  lv_desc ).
  submit zccrm_get_opp_list
        with  sobject  in <fs_object>
        with  sslshbu  in <fs_sslshbu>
        with  ssorder  in <fs_ssorder>
        with  sfbdeal  in <fs_sfbdeal>
        with  sbusunit in <fs_sbusunit>
        with  ssegment in <fs_ssegment>
        with  sfpoqtr  in <fs_sfpoqtr>
        with  sfcommit in <fs_sfcommit>
        with  sfrup    in <fs_sfrup>
        with  sfndeal  in <fs_sfndeal>
        with  sfuequip in <fs_sfuequip>
        with  sfrtyp   in <fs_sfrtyp>
        with sdpoqtr  in <fs_sdpoqtr>
        with sdcommit in <fs_sdcommit>
        with sdru     in <fs_sdru>
        with sdequip  in <fs_sdequip>
        with sddeal   in <fs_sddeal>
        with sdrtyp   in <fs_sdrtyp>
        with spgrp    in <fs_spgrp>
        with sdiv     in <fs_sdiv>
        with sfamily  in <fs_sfamily>
        with sprodi   in <fs_sprodi>
        with p_text    =  lv_desc
        with pzexport  = 'X'
        with pnosec    = 'X'" No security
        and return.

Import the data that is captured in the memory to bind it to the context node to show it as the output.

Final Result:

   When you execute the application this is the resulting page you are going to view depending on the layout/number parameters that you have set it in the "ReportList" table.

The main idea of doing this way is you would be able to create reports quickly and the architecture of the report is going to remain the same for all the report that you are going to create.  


  • No labels