WDA select-options

本文介绍了一个简单的 WDA (Web Dynpro for ABAP) select-options 组件测试案例,详细展示了从组件添加到应用创建及测试的全过程。文中通过实例代码说明了如何设置 select-options 的字段、范围表,并在搜索操作中使用这些设置来筛选数据。
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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值