0
点赞
收藏
分享

微信扫一扫

WDA select-options

松鼠树屋 2022-06-20 阅读 76

A simple test case for WDA select-options


1、Add Component WDR_SELECT_OPTIONS ​WDA <wbr>select-options




2Add Component for the view


WDA <wbr>select-options



3 Create Node (0:N)


WDA <wbr>select-options



4 Create global Attribute to transport data (select-options)


WDA <wbr>select-options



5、create instance at initial method


WDA <wbr>select-options



create Select-options table when WD initial


code: METHOD wddoinit  .



 

  DATA lo_cmp_usage  TYPE  REF  TO if_wd_component_usage .

 

  DATA :lr_t_carrid    TYPE  REF  TO  data .                  "define select-options data table



 

  "GET INSTANCE

 

  lo_cmp_usage  =   wd_this ->wd_cpuse_select_options (  ) .

 

  IF lo_cmp_usage ->has_active_component (  )  IS  INITIAL .

 

      lo_cmp_usage ->create_component (  ) .

 

  ENDIF .


 

  "creat handler

 

  DATA lo_interfacecontroller  TYPE  REF  TO iwci_wdr_select_options  .

 

  lo_interfacecontroller  =   wd_this ->wd_cpifc_select_options (  ) .


 

  DATA lv_r_helper_class  TYPE  REF  TO if_wd_select_options .

 

  lv_r_helper_class  = lo_interfacecontroller ->init_selection_screen (

 

  ) .





*--------------set select-options field------------------------*


 

  "create range table

 

  lv_r_helper_class ->create_range_table (

 

        EXPORTING

 

            i_typename          =     'S_CARRID'  " Type Name

 

        RECEIVING

 

            rt_range_table  =  lr_t_carrid      " Table Range

 

        ) .


 

  lv_r_helper_class ->add_selection_field (

 

        EXPORTING

 

            i_id                                                  =    'S_CARRID'   " ID of Selection Field

 

        it_result                                        =   lr_t_carrid    " Reference to Range Table

 

        ) .


 

  lv_r_helper_class ->set_global_options (

 

          EXPORTING

 

    i_display_btn_cancel  = abap_false

 

    i_display_btn_check  = abap_false

 

    i_display_btn_reset  = abap_false

 

    i_display_btn_execute  = abap_false  ) .


 

  "set handler to global

 

  wd_this ->m_handler  = lv_r_helper_class .


ENDMETHOD . 


6 Create View Container and other elements


WDA <wbr>select-options



WDA <wbr>select-options



Search code:

METHOD onactionact_search  .

 

  DATA lo_nd_node_spfli            TYPE  REF  TO if_wd_context_node .

 

  DATA lt_node_spfli                  TYPE wd_this ->elements_node_spfli .

 

  DATA :lr_t_carrid                      TYPE  REF  TO  data .

 

  FIELD-SYMBOLS :   TYPE  table .


 

  "get select-options table

 

  wd_this ->m_handler ->get_range_table_of_sel_field (

 

      EXPORTING

 

          i_id                              =  'S_CARRID'

 

          i_check_obligatory  = abap_true

 

      RECEIVING

 

          rt_range_table          =  lr_t_carrid

 

  ) .


 

  ASSIGN lr_t_carrid ->*  TO  .



 

  lo_nd_node_spfli  = wd_context ->get_child_node ( name  = wd_this ->wdctx_node_spfli  ) .


 

  "get data

 

  SELECT *  FROM spfli  INTO CORRESPONDING  FIELDS  OF  TABLE lt_node_spfli

 

      WHERE carrid  IN  .


 

  lo_nd_node_spfli ->bind_table ( new_items  = lt_node_spfli  set_initial_elements  = abap_true  ) .




ENDMETHOD . 

 

6 Embed view

WDA <wbr>select-options


WDA <wbr>select-options




7、Create application and test:


WDA <wbr>select-options




举报

相关推荐

0 条评论