How to Use OVS Help For Multiple Input Fields in Select-Options.
This Document helps you to create OVS Help for multiple inputs in Select-Options.
Step 1 : Create WD Component with view and window.
Step 2 : Go to component, under used components use WDR_SELECT_OPTIONS and WDR_OVS as Components with SELECT_OPTIONS and OVS as Component use, as like below screenshot.
Step 3 : Go to view->properties tab->click on create controller usage.
Step 4 : Select OVS and SELECT_OPTIONS Component.
Step 5 : Go to view layout->create view container ui element.
Step 6 : Go to Window->Right click on created View container, here VC-> Click Embed View.
Step 7 : F4 on view to be Embeded->Select WND_SELECTION_SCREEN View.
Step 8 : Go to view WDDOINIT method-> Go to code wizard-> Select Instantiate used component->Click F4 Select Select_options.
Step 9 : Go to code wizard->Select Method call in Used Controller->Select Component WDR_SELECT_OPTIONS.
Step 10 : Select Method Name-> INIT_SELECTION_SCREEN.
Code in WDDOINT Method after Method call.
Click on Pattern->Select ABAP Objects Pattern->Give Interface name IF_WD_SELECT_OPTIONS.
Select Method->SET_GLOBAL_OPTIONS.
Replace ME object with Interface Controller reference lv_r_helper_class .
Change all Exporting Parameters to ABAP_FALSE. If you want any button required on selection screen make it abap_true.
Again go to pattern->Select CREATE_RANGE_TABLE Method.
Replace ME object with Interface Controller reference lv_r_helper_class .
And add code like below.
Create another range table for KUNNR.
Complete Sample Code in WDDOINT Method.
method WDDOINIT .
*– Instantiate the used component –*
data lo_cmp_usage type ref to if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_select_options( ).
if lo_cmp_usage->has_active_component( ) is initial.
lo_cmp_usage->create_component( ).
endif.
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( ).
CALL METHOD 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.
DATA : rt_vbeln TYPE REF TO data.
DATA : rt_kunnr TYPE REF TO data.
CALL METHOD lv_r_helper_class->CREATE_RANGE_TABLE
EXPORTING
I_TYPENAME = ‘VBELN’
RECEIVING
RT_RANGE_TABLE = rt_vbeln.
lv_r_helper_class->add_selection_field(
i_id = `VBELN`
I_DESCRIPTION = ‘Sales Document’
i_value_help_type = if_wd_value_help_handler=>co_prefix_ovs “OVS Help
it_result = rt_vbeln ).
FREE rt_vbeln.
CALL METHOD lv_r_helper_class->CREATE_RANGE_TABLE
EXPORTING
I_TYPENAME = ‘KUNNR’
RECEIVING
RT_RANGE_TABLE = rt_kunnr.
lv_r_helper_class->add_selection_field(
i_id = `KUNNR`
I_DESCRIPTION = ‘Customer’
i_value_help_type = if_wd_value_help_handler=>co_prefix_ovs “OVS Help
it_result = rt_kunnr ).
FREE rt_kunnr.
ENDMETHOD.
Step 11 : Go to Methods->Create OVS Event Handler->Under Event click F4->Select ON_OVS Event for Select Options.
Step 12 : Under this method write code like below.
Sample code :
method OVS.
IF i_ovs_data-m_selection_field_id = ‘VBELN’.
OVS_VBELN( i_ovs_data ).
ELSEIF i_ovs_data-m_selection_field_id = ‘KUNNR’.
OVS_KUNNR( i_ovs_data ).
ENDIF.
endmethod.
Step 13 : Now we have to write code to get OVS for both VBELN and KUNNR.
Step 14 : Go to Methods tab-> create two methods OVS_VBELN and OVS_KUNNR.
Step 15 : Go to OVS_VBELN Method->Create Importing Parameter
I_OVS_DATA TYPE IF_WD_SELECT_OPTIONS=>T_OVS_DATA. And Write code for OVS_VBELN.
Sample Code OVS_VBELN.
method OVS_VBELN .
types:
begin of lty_stru_list,
VBELN type VBELN,
end of lty_stru_list.
data: lt_select_list type standard table of lty_stru_list,
ls_select_list type lty_stru_list,
fieldname TYPE string.
field-symbols:
case i_ovs_data-m_ovs_callback_object->phase_indicator.
when if_wd_ovs=>co_phase_0.
when if_wd_ovs=>co_phase_1.
when if_wd_ovs=>co_phase_2.
SELECT VBELN FROM VBAK
INTO TABLE lt_select_list.
i_ovs_data-m_ovs_callback_object->set_output_table( output = lt_select_list ).
WHEN if_wd_ovs=>co_phase_3.
ASSIGN i_ovs_data-m_ovs_callback_object->selection->* TO
fieldname = i_ovs_data-m_selection_field_id.
endmethod.
Step 16 : Repeate step 15 for OVS_KUNNR. Add Importing Parameter, in code declare kunnr field types and fetch kunnr in select query.
Output :
New NetWeaver Information at SAP.com
Very Helpfull