cancel
Showing results for 
Search instead for 
Did you mean: 

Select Options

former_member184112
Active Contributor
0 Kudos

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.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

refer to this example

wdr_select_options

Former Member
0 Kudos

Hi,

This is my code plzzz check.

*************************************************************************************************

                • Data Declarations *********************************************************************

*************************************************************************************************

TYPES:

BEGIN OF lty_stru_list,

  • add fields for the selection list here

  • projectid TYPE zmis_prog-progcode,

  • projectdesc TYPE zmis_prog-progdescription,

projectid TYPE ZMIS_PROJ-SEPROJCODE,

projectdesc TYPE ZMIS_PROJ-PROGDESC,

END OF lty_stru_list.

DATA: ls_search_input TYPE lty_stru_list,

lt_select_list TYPE STANDARD TABLE OF zmis_proj,

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: <ls_query_params> TYPE zmis_proj,

<ls_selection> TYPE zmis_proj.

DATA : lt_sel TYPE TABLE OF zmis_proj.

DATA : lo_nd_projcode TYPE REF TO if_wd_context_node.

***modified here progcode to projcode

******************************************************************************************************

                                                      • OVS ********************************************************************

CASE ovs_callback_object->phase_indicator.

******************************************************************************************************

WHEN if_wd_ovs=>co_phase_0. "configuration phase, may be omitted

******************************************************************************************************

lv_window_title ='Value Help'. " wd_assist->get_text( `003` ).

lv_group_header ='Select Level'. " wd_assist->get_text( `004` ).

lv_table_header ='Possible Value'. "wd_assist->get_text( `005` ).

ovs_callback_object->set_configuration(

group_header = lv_group_header

window_title = lv_window_title

table_header = lv_table_header

col_count = 2

row_count = 20 ).

******************************************************************************************************

WHEN if_wd_ovs=>co_phase_1. "set search structure and defaults

******************************************************************************************************

  • ovs_callback_object->set_input_structure( input = ls_search_input ).

******************************************************************************************************

WHEN if_wd_ovs=>co_phase_2.

******************************************************************************************************

ASSIGN ovs_callback_object->query_parameters->* TO <ls_query_params>.

CALL FUNCTION 'ZMIS_PROJECT'

EXPORTING

i_role = wd_comp_controller->gv_roleid

i_userid = wd_comp_controller->gv_userid

TABLES

et_project = lt_select_list.

ovs_callback_object->set_output_table( output = lt_select_list ).

  • i_role = 'PM' " wd_comp_controller->gv_roleid

  • i_userid = '58878' " wd_comp_controller->gv_userid

******************************************************************************************************

WHEN if_wd_ovs=>co_phase_3.

******************************************************************************************************

ASSIGN ovs_callback_object->selection->* TO <ls_selection>.

IF <ls_selection> IS ASSIGNED.

***modified here (name = wd_this->wdctx_progcode) to projcode

lo_nd_projcode = wd_context->get_child_node( name = wd_this->wdctx_projcode ).

lo_nd_projcode->bind_structure( new_item = <ls_selection> ).

ENDIF.

ENDCASE.

ENDMETHOD.