OVS EX Program for Search Help

method ON_OVS . * declare data structures for the fields to be displayed and * for the table columns of the selection list, if necessary types: begin of lty_stru_input, * add fields for the display of your search input here pernr type string, pname type string, end of lty_stru_input. types: begin of lty_stru_list, * add fields for the selection list here pno type stext, pname type stext, end of lty_stru_list. data: ls_search_input lt_select_list ls_text lt_label_texts lt_column_texts lv_window_title lv_group_header lv_table_header type type type type type type type type lty_stru_input, standard table of lty_stru_list, wdr_name_value, wdr_name_value_list, wdr_name_value_list, string, string, string.

field-symbols: <ls_query_params> type lty_stru_input, <ls_selection> type lty_stru_list. DATA : lv_pno TYPE string, lv_pname TYPE string.

case ovs_callback_object->phase_indicator. * * when if_wd_ovs=>co_phase_0. "configuration phase, may be omitted in this phase you have the possibility to define the texts, if you do not want to use the defaults (DDIC-texts) ls_text-name = `PERNR`. "must match a field name of search ls_text-value = `Pernr No`. "wd_assist->get_text( `001` ). insert ls_text into table lt_label_texts. ls_text-name = `PERSON_NAME`. "must match a field name of search ls_text-value = `Person Name`. "wd_assist->get_text( `001` ). insert ls_text into table lt_label_texts. ls_text-name = `PNO`. "must match a field name of search ls_text-value = `Person No`. "wd_assist->get_text( `001` ). insert ls_text into table lt_label_texts. ls_text-name = `PNAME`. "must match a field in list structure ls_text-value = `Person Name`. "wd_assist->get_text( `002` ). insert ls_text into table lt_column_texts. * * * lv_window_title = wd_assist->get_text( `003` ). lv_group_header = wd_assist->get_text( `004` ). lv_table_header = wd_assist->get_text( `005` ). ovs_callback_object->set_configuration( label_texts = lt_label_texts column_texts = lt_column_texts group_header = lv_group_header

window_title table_header col_count row_count

= = = =

lv_window_title lv_table_header 2 20 ).

* * * * * * *

when if_wd_ovs=>co_phase_1. "set search structure and defaults In this phase you can set the structure and default values of the search structure. If this phase is omitted, the search fields will not be displayed, but the selection table is displayed directly. Read values of the original context (not necessary, but you may set these as the defaults). A reference to the context element is available in the callback object. ovs_callback_object->context_element->get_static_attributes( importing static_attributes = ls_search_input ). pass the values to the OVS component ovs_callback_object->set_input_structure( input = ls_search_input ). when if_wd_ovs=>co_phase_2. If phase 1 is implemented, use the field input for the selection of the table. If phase 1 is omitted, use values from your own context.

*

* * *

if ovs_callback_object->query_parameters is not bound. ******** TODO exception handling endif. assign ovs_callback_object->query_parameters->* to <ls_query_params>. if not <ls_query_params> is assigned. ******** TODO exception handling endif. * * call business logic for a table of possible values lt_select_list = ??? lv_pno = <ls_query_params>-pernr. lv_pname = <ls_query_params>-pname. REPLACE ALL OCCURRENCES OF '*' IN lv_pno WITH '%' . REPLACE ALL OCCURRENCES OF '*' IN lv_pname WITH '%' . IF lv_pno NE ' ' AND lv_pname NE ' '. SELECT PERNR PNAME FROM ZPTABLE INTO TABLE lt_select_list WHERE PNO LIKE lv_cnt AND PNAME LIKE lv_pname ORDER BY PNO ASCENDING. ELSEIF lv_pno EQ ' ' AND lv_pname NE ' '. SELECT PERNR PNAME FROM ZPTABLE INTO TABLE lt_select_list WHERE PNO LIKE lv_cnt AND PNAME LIKE lv_pname ORDER BY PNO ASCENDING. ELSEIF lv_pno NE ' ' AND lv_pname EQ ' '. SELECT PERNR PNAME FROM ZPTABLE INTO TABLE lt_select_list WHERE PNO LIKE lv_cnt AND PNAME LIKE lv_pname ORDER BY PNO ASCENDING. ENDIF. ovs_callback_object->set_output_table( output = lt_select_list ).

*

when if_wd_ovs=>co_phase_3. apply result

if ovs_callback_object->selection is not bound. ******** TODO exception handling endif. assign ovs_callback_object->selection->* to <ls_selection>. if <ls_selection> is assigned. ovs_callback_object->context_element->set_attribute( name = `PERNR` value = <ls_selection>-pno ). ovs_callback_object->context_element->set_attribute( name = `PNAME` value = <ls_selection>-pname ). endif. endcase. endmethod.