Skip to Content
0
Sep 27, 2010 at 10:11 AM

How to set default values in select-option UI element?

266 Views

Hi Experts,

I am using a select-option in the view for date range. i have used the component usage for this.

Now I want to set default value to this select-option so that it displays From date = yesterday's date and To date = current date.

i have return the code so far as below.

Data: i_RANGE_TABLE TYPE REF TO DATA.

*Get reference to select option 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.

*Get reference to select option component

wd_this->o_wdr_so_component = wd_this->wd_cpifc_select_options( ).

*Get reference to select option handler

wd_this->o_so_handler =

wd_this->o_wdr_so_component->init_selection_screen( ).

*Set global options for select option

CALL METHOD wd_this->o_so_handler->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.

*Create a range table for date range select option

i_RANGE_TABLE = WD_THIS->o_so_handler->CREATE_RANGE_TABLE( I_TYPENAME =

'ydatede').

WD_THIS->o_so_handler->ADD_SELECTION_FIELD( I_ID = 'DATE'

IT_RESULT = i_RANGE_TABLE

I_READ_ONLY = READ_ONLY ).