Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Select option value dynamic

Hi,

I have a select option which must have a default value. This default value is the current date -1 (yesterday...).

DATA ws_date TYPE p0001-begda. 
SELECT-OPTIONS s_date FOR ws_date DEFAULT sy-datum - 1.

But sy-datum - 1doesn't exist.

The 'RP_CALC_DATE_IN_INTERVAL' function allows to calculate a date.

I do :

SELECT-OPTIONS s_date FOR ws_date.

INITIALIZATION.
  w_current_date = sy-datum.

  CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
    EXPORTING
      date      = w_current_date
      days      = '01'
      months    = '00'
      signum    = '-'
      years     = '00'
    IMPORTING
      calc_date = w_new_date.

  s_date = w_new_date.

But the new date is not display as like a default value...

Tags:
Former Member
replied

hi Xavier,

you have to code the following way:

INITIALIZATION.

DATA : lv_datum TYPE sy-datum.

lv_datum = sy-datum - 1.

s_date-low = 'I'.
s_date-option = 'EQ'.
s_date-low = lv_datum.
APPEND s_date.

hope this helps

ec

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question