Application Development and Automation 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: 
Read only

How to restrict date

Former Member
0 Likes
786

I have a select option to choose date range,

s_dat-high should not be more than 2 days from s_dat-low.

How to do this

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
716


report  zrich_0001.

select-options: s_datum for sy-datum.

at selection-screen.

  read table s_datum index 1.
  data: days type i.
  days = s_datum-high  - s_datum-low .
  if days > 2.
    message e001(00) with 'Range can not be > 2 days'.
  endif.

Regards,

RIch Heilman

4 REPLIES 4
Read only

Former Member
0 Likes
716

hi,

data : lv_nextday type sy-datum.

at selection-screen.

lv_nextdat = s_date-low + 2.

if s_date-high > lv_nextdat.

message e000.

endif.

Read only

Former Member
0 Likes
716

Can you post the declarations of DATA, SELECT... and others?

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
717


report  zrich_0001.

select-options: s_datum for sy-datum.

at selection-screen.

  read table s_datum index 1.
  data: days type i.
  days = s_datum-high  - s_datum-low .
  if days > 2.
    message e001(00) with 'Range can not be > 2 days'.
  endif.

Regards,

RIch Heilman

Read only

Former Member
0 Likes
716

You may also want to use FM select_options_restrict depending on your exact requirements.

Rob