2007 Jun 18 7:48 AM
Hi,
How to find difference between two specified dates. I tried to use function module
CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
EXPORTING
i_datum_bis = start
i_datum_von = end
i_kz_excl_von = '0'
i_kz_incl_bis = '1'
IMPORTING
e_tage = days.
But its giving wrong answers.
For example :
This function module giving 30 days as output for both dates,
01.10.2007 to 31.10.2007 ( wrong, it should give 31 days)
and
01.11.2007 to 30.11.2007
Is there any other func to find this? Can anyone help me?
Thanks in Advance.
2007 Jun 18 7:52 AM
Hi
Why you need a fun module for this purpose
it is a simple operation
to find difference between two specified dates
declare a variable
data days type i
days = date2 - date1.
it straight away gives the correct days
no need of fun module any more
Reward points for useful Answers
Regards
Anji
Hi,
How to find difference between two specified dates. I tried to use function module
CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
EXPORTING
i_datum_bis = start
i_datum_von = end
i_kz_excl_von = '0'
i_kz_incl_bis = '1'
IMPORTING
e_tage = days.
But its giving wrong answers.
For example :
This function module giving 30 days as output for both dates,
01.10.2007 to 31.10.2007 ( wrong, it should give 31 days)
and
01.11.2007 to 30.11.2007
Is there any other func to find this? Can anyone help me?
Thanks in Advance.
2007 Jun 18 7:52 AM
Hi
Why you need a fun module for this purpose
it is a simple operation
to find difference between two specified dates
declare a variable
data days type i
days = date2 - date1.
it straight away gives the correct days
no need of fun module any more
Reward points for useful Answers
Regards
Anji
2007 Jun 18 7:54 AM
Hi Siva,
Try this,
DATA : DATE1 LIKE SY-DATUM,
DATE2 LIKE SY-DATUM,
DAYS1 TYPE I.
DATE1 = '01012005'.
DATE2 = SY-DATUM.
CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'
EXPORTING
BEGDA = DATE1
endda = DATE2
IMPORTING
DAYS = DAYS1
WEEKS = WEEKS1
MONTHS = MONTHS1
YEARS = YEARS1.
write : days1.
Thanks,
Reward If Helpful.
2007 Jun 18 7:54 AM
Hi Siva,
The easiest way is to declare two variables of type sy-datum and populate the twoo variables.
You'll know which variable contains the higher date.
Subtract the lower variable from the higher variable and you get to know the number of days.
Divide it by 365 to get interms of the number of years.
This logic I used in one of my reports.
Hope this solves your query.
Reward Points if useful.
Thanks,
Tej..
2007 Jun 18 8:05 AM
hi,
You can FIMA_DAYS_BETWEEN_TWO_DATES_2 and use the parameters
I_DATUM_VON --> start date
I_DATUM_BIS --> end date
I_STGMETH --> 2 (this parameter is to determin the number of days in a year. I advise to use 2)
<b>Reward points</b>
regards
2007 Jun 18 8:06 AM
Hi Siva,
Use this FM : HR_99S_INTERVAL_BETWEEN_DATES
instead of DAYS_BETWEEN_TWO_DATES
Reward Points for helpful answers.
Thanks.
Hari krishna
2007 Jun 18 8:56 AM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |