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: 

How to restrict date

Former Member
0 Kudos

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

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos


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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos


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

Former Member
0 Kudos

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

Rob