Beruflich Dokumente
Kultur Dokumente
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 6 : Go to Window->Right click on created View container, here VC-> Click Embed View.
Step 8 : Go to view WDDOINIT method-> Go to code wizard-> Select Instantiate used component->Click F4 Select 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.
Replace ME object with Interface Controller reference lv_r_helper_class . And add code like below.
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 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 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.
"OVS Help
"OVS Help
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.
begin of lty_stru_list, VBELN type VBELN, end of lty_stru_list. data: lt_select_list ls_select_list fieldname field-symbols: type standard table of lty_stru_list, type lty_stru_list, TYPE string. type lty_stru_list, TYPE lty_stru_list, TYPE STANDARD TABLE, TYPE table, TYPE data.
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 <lt_ovs_result>. ASSIGN i_ovs_data-mt_selected_values->* TO <lt_sel_opt_result>. fieldname = i_ovs_data-m_selection_field_id. ASSIGN COMPONENT fieldname OF STRUCTURE <lt_ovs_result> TO <field>. INSERT <field> INTO TABLE <lt_sel_opt_result>. endcase. 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 :