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

Date difference help!

0 Likes
832

Hi all,

I have to calculate the difference between two date. It's simply:

data A - date B = days

(20061212 - 20061205 = 7)

but what i have to do if I want the difference without saturday, sanday and all holiday's day (Christmas, etc..)?

In a few words, I need only the working days. Is it possible?

example: if 20061206 is saturday and 20061207 is sunday, then 20061212 - 20061205 = 5

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
802

Hi ,

I am not sure how u can find the diff in such a way.

One simple solution is to get the list of all days between these days and use the FM <b>DATE_CONVERT_TO_FACTORYDATE</b> , this check whether the entered date is a working date or not based in the calarande set . If it is a working day then workingday indicator paramtered will be blank , else it will have some value.

Regards

Arun

8 REPLIES 8
Read only

Former Member
0 Likes
802

Use Fm SD_DATETIME_DIFFERENCE.

It is not giving the difference exctly in minutes but it returns the diiference as days and hours. so u can use that for ur requirement. Just check it...

Read only

Former Member
0 Likes
802

data : wa_date type sy-datum.

call function 'RP_CALC_DATE_IN_INTERVAL'

exporting

date = sy-datum

days = 04 -


> give ur required date

months = 0

years = 0

signum = '-'

importing

calc_date = wa_date.

write 😕 wa_date. -> new minised date

Note

signum = '+' "

signum = '-' "

Read only

Former Member
0 Likes
802

Hello,

Use this FM

CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'

EXPORTING

I_DATUM_BIS = G_T_PURO-AEDAT

I_DATUM_VON = G_T_EBAN-BADAT

IMPORTING

E_TAGE = G_F_DIFF

EXCEPTIONS

DAYS_METHOD_NOT_DEFINED = 1

OTHERS = 2.

If useful reward.

Vasanth

Read only

Former Member
0 Likes
802

Hi

try to see

Read only

srinivas_akiri
Active Participant
0 Likes
802

HI,

Use the FM, DAYS_BETWEEN_TWO_DATES

regards

srini

Read only

Former Member
0 Likes
804

Hi ,

I am not sure how u can find the diff in such a way.

One simple solution is to get the list of all days between these days and use the FM <b>DATE_CONVERT_TO_FACTORYDATE</b> , this check whether the entered date is a working date or not based in the calarande set . If it is a working day then workingday indicator paramtered will be blank , else it will have some value.

Regards

Arun

Read only

0 Likes
802

Ok, good idea..now it works!

Thanks

Message was edited by:

Gilbert Ceppo

Read only

0 Likes
802

great that it works now

Message was edited by:

Arun Ramachandran