创建节点:
需要在组件上引用OVS组件WDR_OVS:引用后需要更改添加节点属性值如下:
布局如下:
在view中也添加ovs组件
新建事件方法:
ON_EVENT
代码如下:
METHOD on_event. TYPES: BEGIN OF lty_stru_input, carrid TYPE string, connid TYPE string, END OF lty_stru_input. TYPES: BEGIN OF lty_stru_list, carrid TYPE string, connid TYPE string, text TYPE string, END OF lty_stru_list. DATA: ls_search_input TYPE lty_stru_input, lt_select_list TYPE STANDARD TABLE OF lty_stru_list, ls_text TYPE wdr_name_value, lt_label_texts TYPE wdr_name_value_list, lt_column_texts TYPE wdr_name_value_list, lv_window_title TYPE string, lv_group_header TYPE string, lv_table_header TYPE string. FIELD-SYMBOLS:TYPE lty_stru_input, TYPE lty_stru_list. DATA:lw_carrid TYPE string, lw_connid TYPE string. CASE ovs_callback_object->phase_indicator. WHEN if_wd_ovs=>co_phase_0. ls_text-name = 'CARRID'. ls_text-value = 'Search Field-Carrid'. INSERT ls_text INTO TABLE lt_label_texts. ls_text-name = 'CONNID'. ls_text-value = 'Search Field-Connid'. INSERT ls_text INTO TABLE lt_label_texts. ls_text-name = 'CARRID'. ls_text-value = 'Result-Carrid'. INSERT ls_text INTO TABLE lt_column_texts. ls_text-name = 'CONNID'. ls_text-value = 'Result-Connid'. INSERT ls_text INTO TABLE lt_column_texts. ls_text-name = 'TEXT'. ls_text-value = 'Result-Text'. INSERT ls_text INTO TABLE lt_column_texts. lv_group_header = 'Group Header'. lv_window_title = 'Window Title'. lv_table_header = 'Table Header'. ovs_callback_object->set_configuration( label_texts = lt_label_texts column_texts = lt_column_texts group_header = lv_group_header window_title = lv_window_title table_header = lv_table_header col_count = 3 row_count = 8 ). WHEN if_wd_ovs=>co_phase_1. ovs_callback_object->context_element->get_static_attributes( IMPORTING static_attributes = ls_search_input ). ovs_callback_object->set_input_structure( input = ls_search_input ). WHEN if_wd_ovs=>co_phase_2. IF ovs_callback_object->query_parameters IS NOT BOUND. ENDIF. ASSIGN ovs_callback_object->query_parameters->* TO . IF NOT IS ASSIGNED. ENDIF. lw_carrid = -carrid. lw_connid = -connid. REPLACE ALL OCCURRENCES OF '*' IN lw_carrid WITH '%' . REPLACE ALL OCCURRENCES OF '*' IN lw_connid WITH '%' . IF lw_carrid IS NOT INITIAL AND lw_connid IS NOT INITIAL. SELECT * INTO CORRESPONDING FIELDS OF TABLE lt_select_list FROM SFLIGHT WHERE carrid LIKE lw_carrid AND connid LIKE lw_connid. ENDIF. IF lw_carrid IS INITIAL AND lw_connid IS NOT INITIAL. SELECT * INTO CORRESPONDING FIELDS OF TABLE lt_select_list FROM SFLIGHT WHERE connid LIKE lw_connid. ENDIF. IF lw_carrid IS NOT INITIAL AND lw_connid IS INITIAL. SELECT * INTO CORRESPONDING FIELDS OF TABLE lt_select_list FROM SFLIGHT WHERE carrid LIKE lw_carrid . ENDIF. ovs_callback_object->set_output_table( output = lt_select_list ). WHEN if_wd_ovs=>co_phase_3. IF ovs_callback_object->selection IS NOT BOUND. ENDIF. ASSIGN ovs_callback_object->selection->* TO . IF IS ASSIGNED. ovs_callback_object->context_element->set_attribute( name = 'CARRID' value = -carrid ). ovs_callback_object->context_element->set_attribute( name = 'CONNID' value = -connid ). ENDIF. ENDCASE.ENDMETHOD.