Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Select option value dynamic

Former Member
0 Kudos

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...

1 ACCEPTED SOLUTION

JozsefSzikszai
Active Contributor
0 Kudos

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

2 REPLIES 2

JozsefSzikszai
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi,

You need to write the code like this.

data : ws_date type sy-datum.

Select-options : S_date for ws_date.

Initialization.

s_date-option = 'EQ'.

s_date-Sign = 'I'.

s_date-low = sy-datum - 1.

append s_date.

Hope this helps.

Regards,

Pramod