Search code examples
dateselectionabapsap-selection-screens

select options with today's date as default?


I'm trying to show todays date as the default value in a select date.

INITIALIZATION.
select-OPTIONS: so_date FOR sy-datlo.

START-OF-SELECTION.
so_date-sign = 'I'.
so_date-option = 'BT'.
so_date-low = sy-datum.
so_date-high = sy-datum.
APPEND so_date.

This isn't working though. Any ideas?


Solution

  • You must set the value before START-OF_SELECTION:

    select-OPTIONS: so_date FOR sy-datlo.
    
    INITIALIZATION.
      so_date-sign = 'I'.
      so_date-option = 'EQ'.
      so_date-low = sy-datum.
      CLEAR so_date-high.
      APPEND so_date.
    

    Did you try the easy version:

    select-OPTIONS: so_date FOR sy-datlo default SY-DATUM.
    

    I think it should work (can't test is actual).