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

VALIDATION

Former Member
0 Likes
397

HOW TO CHECK WHETHER A DATE GIVEN AS INPUT IS VALID FOR 12 MONTHS ONLY

2 REPLIES 2
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
377

Not sure what you are asking, but if you want to make sure that a date range is always a 12 month period, you can do something like this.


report zrich_0001.

data: months type i.

parameters: p_from type sy-datum.
parameters: p_to type sy-datum.

at selection-screen.

  call function 'MONTHS_BETWEEN_TWO_DATES'
    exporting
      i_datum_bis         = p_to
      i_datum_von         = p_from
*     I_KZ_INCL_BIS       = ' '
   importing
     e_monate            = months.
  if months <>  12.
    message e001(00) with 'Date Range is not for 12 months'.
  endif.

For example, here 01/01/2007 to 01/01/2008 would pass this check.

Regards,

Rich heilman

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
377

didnt get u r question...make it clear