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 module

Former Member
0 Likes
658

hi,

Iam using function module DAYS_BETWEEN_TWO_DATES to calculate and place the difference between 2 dates in a variable

it's working well for all dates except 31st jan2008 and 30th jan 2008 . The difference between these 2 dates should be 1.But iam unable to get the output.Please do the needful

5 REPLIES 5
Read only

Former Member
0 Likes
522

Hi,

Please try using HR_AUPBS_MONTH_DAY.

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
522

Hi,

You don't need this function module (which has status 'not released') to find the difference in days between two dates. Just subtract one date from the other and the result will be the difference in days.

Regards,

Nick

Read only

Former Member
0 Likes
522

Hi,

you can use FIMA_DAYS_AND_MONTHS_AND_YEARS, Try this FM also HR_HK_DIFF_BT_2_DATES.

Check this sample code

REPORT ZDATEDIFF.

DATA: EDAYS LIKE VTBBEWE-ATAGE,

EMONTHS LIKE VTBBEWE-ATAGE,

EYEARS LIKE VTBBEWE-ATAGE.

PARAMETERS: FROMDATE LIKE VTBBEWE-DBERVON,

TODATE LIKE VTBBEWE-DBERBIS DEFAULT SY-DATUM.

call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'

exporting

i_date_from = FROMDATE

i_date_to = TODATE

*I_FLG_SEPARATE = ' '

IMPORTING

E_DAYS = EDAYS

E_MONTHS = EMONTHS

E_YEARS = EYEARS.

WRITE:/ 'Difference in Days ', EDAYS.

WRITE:/ 'Difference in Months ', EMONTHS.

WRITE:/ 'Difference in Years ', EYEARS.

INITIALIZATION.

FROMDATE = SY-DATUM - 60.

Regards,

Satish

Read only

Former Member
0 Likes
522

Hi,

DATA: s_date like VTBBEWE-DBERBIS,

e_date like VTBBEWE-DBERVON.

s_date = '20080130'.

e_date = '20080131'.

DATA: diff type i.

CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'

EXPORTING

I_DATUM_BIS = s_date

I_DATUM_VON = e_date

*set End Date is included flag I_KZ_INCL_BIS

I_KZ_INCL_BIS = '1'

IMPORTING

E_TAGE = diff

write:/ diff.

output: 1

Reward if Helpful.

Edited by: prosenjit chaudhuri on Feb 4, 2008 1:56 PM

Read only

Former Member
0 Likes
522

Try like this...


DATA :  l_tage(5).
DATA :date1 LIKE VTBBEWE-DBERBIS value '20080131'.
DATA : date2 LIKE VTBBEWE-DBERVON value '20080130'.

CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
  EXPORTING
    i_datum_bis                   = date1
    i_datum_von                   = date2
    I_KZ_EXCL_VON                 = '0'
    I_KZ_INCL_BIS                 = '1'  "<<<<<<<<  include end date

 IMPORTING
   E_TAGE                        =  l_tage.

WRITE  :/ l_tage.