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

function moduele for dates

Former Member
0 Likes
774

hello!

i am looking for FM to calculate number of days between dates.

I am working on 46c.

regards

yifat

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
752

Hi Yifat ,

u can use Function Module

HR_HK_DIFF_BT_2_DATES

to calculate the number of days between two dates ..

date1 --10302006

date2 --10112006

output format --02

o/p is 20 days

note that date 1 > date 2 in this Fm ..

regards,

Vijay.

6 REPLIES 6
Read only

ferry_lianto
Active Contributor
0 Likes
752

Hi Yifat,

Please check this FM.

DAYS_BETWEEN_TWO_DATES

FIMA_DAYS_BETWEEN_TWO_DATES_2

FIMA_DAYS_BETWEEN_TWO_DATES

Hope this will help.

Regards,

Ferry Lianto

Please reward points if helpful.

Read only

Former Member
0 Likes
752

Hi,

Try this..

DATA: V_CURR_DATE TYPE SYDATUM.

DATA: V_PAST_DATE TYPE SYDATUM VALUE '20061001'.

DATA: V_DIFF TYPE INT4.

V_CURR_DATE = SY-DATUM.

V_DIFF = V_CURR_DATE - V_PAST_DATE.

WRITE: / 'Number of days - ', V_DIFF.

Thanks,

Naren

Read only

anversha_s
Active Contributor
0 Likes
752

hi,

no need for any function module.

You can define a variable of type I and just subtract both dates.

ex:

Data: datehigh type sy-datum,

datelow type sy-datum.

data: diff type i.

datehigh = sy-datum.

datelow = sy-datum - 100. "just a sample date.

diff = datehigh - datelow.

write: diff.

rgds

anver

if helped pls mark points

Read only

Former Member
0 Likes
753

Hi Yifat ,

u can use Function Module

HR_HK_DIFF_BT_2_DATES

to calculate the number of days between two dates ..

date1 --10302006

date2 --10112006

output format --02

o/p is 20 days

note that date 1 > date 2 in this Fm ..

regards,

Vijay.

Read only

Former Member
0 Likes
752

you can just subtract one date from the second.(Both must be of type sy-datum).

days = date1 - date2.

Regards,

ravi

Read only

Former Member
0 Likes
752

Use FM FIMA_DAYS_BETWEEN_TWO_DATES

Best Regards,

Vibha

*Please mark all the helpful answers