洞察探索如何利用兼容微信生态的小程序容器,实现跨平台开发,助力金融和车联网行业的数字化转型。
686
2022-11-26
WDA select-options
A simple test case for WDA select-options
2Add Component for the view
3 Create Node (0:N)
4 Create global Attribute to transport data (select-options)
5、create instance at initial method
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
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
7、Create application and test:
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~