Skip to Content
0
May 14, 2008 at 06:57 AM

Select Options

58 Views

Hi,

I am not able to open select options F4 for search help.

This is code, Can you advise me where is the mistake in my code.

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 t_stru_input,

quote type VBAK-VBELN,

soldto type VBAK-KUNNR,

ponum type VBKD-BSTKD,

date type VBAK-AUDAT,

salesorg type VBAK-VKORG,

reference type VBAK-IHREZ,

end of t_stru_input,

  • add fields for the selection list here

begin of t_stru_list,

quoteno type VBAK-VBELN,

soldto type VBAK-KUNNR,

pono type VBKD-BSTKD,

date type VBAK-AUDAT,

salesorg type VBAK-VKORG,

reference type VBAK-IHREZ,

netvalue type vbak-netwr,

currency type vbak-waerk,

conno type likp-bolnr,

end of t_stru_list.

data: l_search_input type t_stru_input,

l_select_list type standard table of t_stru_list,

l_text type wdr_name_value,

l_label_texts type wdr_name_value_list,

l_column_texts type wdr_name_value_list,

l_window_title type string,

l_group_header type string,

l_table_header type string.

field-symbols: <query_params> type t_stru_input,

<selection> type t_stru_list.

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)

l_text-name = `quote`. "must match a field name of search

l_text-value = `Quotation Number:`. "wd_assist->get_text( `001` ).

insert l_text into table l_label_texts.

l_text-name = `soldto`. "must match a field in list structure

l_text-value = `Sold To Party`. "wd_assist->get_text( `002` ).

insert l_text into table l_column_texts.

Endcase.

CASE OVS_CALLBACK_OBJECT->PHASE_INDICATOR.

WHEN 0.

*//declare all text related to the selection dialog box

DATA : TEXT1 TYPE STRING,

TEXT2 TYPE STRING.

*<< assign appropriate values to these text strings >>

*//Export all text to the OVS Component through the set_configuration()

CALL METHOD OVS_CALLBACK_OBJECT->SET_CONFIGURATION

EXPORTING

WINDOW_TITLE = 'Search Help'

GROUP_HEADER = 'Results'

COL_COUNT = 1 .

WHEN 1.

*//Declare structure containing the fields that should be present on the selection dialog screen as input fields.

types: begin of lst_struct,

quote type VBAK-VBELN,

soldto type VBAK-KUNNR,

ponum type VBKD-BSTKD,

date type VBAK-AUDAT,

salesorg type VBAK-VKORG,

reference type VBAK-IHREZ,

*<< declare fields>>

end of lst_struct.

*//Create corresponding object

data: ls_struct type lst_struct,

quote type VBAK-VBELN,

soldto type VBAK-KUNNR,

ponum type VBKD-BSTKD,

date type VBAK-AUDAT,

salesorg type VBAK-VKORG,

reference type VBAK-IHREZ.

*<<If required,pass any default value for the fields declared in structure >>

*//pass this structure to the OVS Component

CALL METHOD ovs_callback_object->set_input_structure

EXPORTING

input = ls_struct.

WHEN 2.

*//dereferencing the data contained in the query_parameters of callback object

FIELD-SYMBOLS: <LF_INPUT_QUERY> TYPE LST_STRUCT.

ASSIGN OVS_CALLBACK_OBJECT->QUERY_PARAMETERS->* TO <LF_INPUT_QUERY> CASTING.

*<< Use some Bapi for fetching data according to the values contained in the above field symbol and take the output in some table >> .

*//exporting data to be displayed as value help list to the OVS component

CALL FUNCTION 'ZBAPIQUOTEDATA'

EXPORTING

VBELN = <LF_INPUT_QUERY>-quote

  • IMPORTING

  • RETURN =

TABLES

ITAB = l_select_list

.

CALL METHOD ovs_callback_object->set_output_table

EXPORTING

output = l_select_list

  • table_header =

  • column_texts =

.

when 3.

**//dereferencing the data contained in the selection parameter of callback object

*field-symbols: <lfs_selection_struct> type <<as required>>.

ASSIGN OVS_CALLBACK_OBJECT->selection-> TO <lfs_selection_struct> CASTING.

**//write selection from value help list back to context attributes

**<< Read the Context node and bind structure <lfs_selection_struct> to the node >>

data: l_vbak_node type ref to if_wd_context_node,

l_struc_vbak type ig_componentcontroller=>element_search_results,

l_element type ref to if_wd_context_element.

if ovs_callback_object->selection is not bound.

endif.

assign ovs_callback_object->selection->* to <selection>.

if <selection> is assigned.

l_element = l_vbak_node->get_element( ).

l_element->set_attribute( name = 'VBELN').

*value = <selection>-VBELN ).

endif.

wd_this->value_help_finished = abap_true.

ENDCASE.

endmethod.