Application Development 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: 

Calculate number of days

Former Member
0 Kudos

Hi Experts,

I want to calculate the no. of days by passing period and year only.

I do not have date.

Please let me know if there is any function module to fulfill my requirements.

For example:

Number of days between 09/2008 to 07/2007

Thanks in advance.

Regards

Swati

1 ACCEPTED SOLUTION

Pawan_Kesari
Active Contributor
0 Kudos

Use FM WEEK_GET_FIRST_DAY to get the first day of week. then subtract those dates to get number of days.

5 REPLIES 5

Pawan_Kesari
Active Contributor
0 Kudos

Use FM WEEK_GET_FIRST_DAY to get the first day of week. then subtract those dates to get number of days.

matt
Active Contributor
0 Kudos

How are you going to do it without knowing the date?

The number of days between 1/11/2008 and 31/12/2008 is different to the number of days between 30/11/2008 and 31/12/2008

The question as it stands, doesn't really make sense.

former_member745780
Active Participant
0 Kudos

Hello check these FM

HR_SGPBS_ADD_TIME_TO_DATE

HR_MX_DAYS_PER_YEAR

FIMA_DAYS_BETWEEN_TWO_DATES

Thanks

Former Member
0 Kudos

There is no straight function module to give that value but you can use the function module

NUMBER_OF_DAYS_PER_MONTH_GET to get the number of days per given month and arrive at your requirement

You need to loop between the range and and iteratively accumulate the no of days and then can find the number of days between the periods

Former Member
0 Kudos

Hi

CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'

EXPORTING

date1 = date1

date2 = date2

  • OUTPUT_FORMAT = '01'

  • IMPORTING

  • YEARS =

  • MONTHS =

  • DAYS =

  • EXCEPTIONS

  • INVALID_DATES_SPECIFIED = 1

  • OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Hope it solves your problem

~hitesh