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

FM for Date Comparision

rahul2000
Contributor
0 Likes
578

Dear all,

I want a FM for comparing a date with today's date

that is if the date passed to the FM is less than sy-datum, i want to throw a warning message.

Can any one suggest

Dear all,

I want a FM for comparing a date with today's date

that is if the date passed to the FM is less than sy-datum, i want to throw a warning message.

Can any one suggest

3 REPLIES 3
Read only

former_member156446
Active Contributor
0 Likes
554

you do a direct condition no need to any fm

if date GR sy-datum.

error message....

endif.

else check this FM

CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'
EXPORTING
date1 = wa_citm_b-venddat
date2 = wa_citm_b-vbegdat
output_format = '04'
IMPORTING
months = lv_period
EXCEPTIONS
invalid_dates_specified = 1
OTHERS = 2.

Read only

vinod_vemuru2
Active Contributor
0 Likes
554

Hi Rahul,

We will use FMs only if putting ur own logic is complex because somany things will happens in back end when u call a FM like it has to load whole function group to application server for first time execution in a session. So in this case do a direct comparision instead of FM.

IF w_date GT sy-datum..

MESSAGE w000 WITH 'Date must be less than or equal to current date.'

ENDIF.

Thanks,

Vinod.

Read only

Former Member
0 Likes
554

why you want to use function module..use can if condition..

if urdate < sy-datum.

'Warning message'.

endif.

Regards

Sugumar G