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

validating the date field

Former Member
0 Likes
717

Hi Friends,

i am facing problem while validating the date field,

i want to restrict the user to maximum of one year of intervel of his given date.

Regards,

Saleem

5 REPLIES 5
Read only

sharadendu_agrawal
Active Participant
0 Likes
689

use the fm to get the difference between the 2 dates in terms of number of days and check the value as 365.

reward if helpful

cheers

sharadendu

Read only

Former Member
0 Likes
689

hi

have a try with this fm

data st2_date type sy-datum.

CALL FUNCTION 'CALCULATE_DATE'

EXPORTING

days = '0'

months = '+12'

start_date = sy-datum

IMPORTING

result_date = st2_date.

if s_date-high > st2_date.

message 'Error' type 'E'.

endif.

if helpful, reward

Sathish. R

Read only

Former Member
0 Likes
689

call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'

exporting

i_date_from = p_lv_start_date

  • I_KEY_DAY_FROM =

i_date_to = p_lv_date1

  • I_KEY_DAY_TO =

  • I_FLG_SEPARATE = ' '

importing

  • E_DAYS =

e_months = p_lv_month_diff

  • E_YEARS =

.

using this FM u can find the diff between dates.

Read only

Former Member
0 Likes
689

Hi saleem,

Use FM FIMA_DAYS_AND_MONTHS_AND_YEARS .

THis will Give differnece between two dates.

IF the number of days Gretaer than 365 OR 366 then give a error message.,

I hope it will solve your problem.

Thanks,CSR.

PS:Reward if helpful.

Read only

Former Member
0 Likes
689

hi

use this FM

CALL FUNCTION 'HR_ECM_ADD_PERIOD_TO_DATE'

EXPORTING

ORIG_DATE = 'your date'

NUM_DAYS = 0

NUM_MONTHS = 0

NUM_YEARS = 1 " add one year to it. it will automatically add one year irrespective of leap year

SIGNUM = '+' for addition

MESSAGE_HANDLER = MESSAGE_HANDLER

IMPORTING

RESULT_DATE = your_result

now check the date for futher processing

<b>reward points plz</b>

Message was edited by:

Fazeel