05-22-2007 3:12 PM
Hi All,
Can you suggest a function module that calculates the difference between the dates in days, weeks, months etc in the BI system. Thanks!
05-22-2007 3:16 PM
Hi
DATA: DAY1 LIKE SY-DATUM,
DAY2 LIKE SY-DATUM,
DAYS TYPE I.
DAYS = DAY2 - DAY1.
Max
05-22-2007 3:18 PM
Hi,
Please check these FM.
HRCM_TIME_PERIOD_CALCULATE
MONTHS_BETWEEN_TWO_DATES
DAYS_BETWEEN_TWO_DATES
Regards,
Ferry Lianto
05-22-2007 3:28 PM
DATA: VDAYS LIKE VTBBEWE-ATAGE,
VMONTHS LIKE VTBBEWE-ATAGE,
VYEARS LIKE VTBBEWE-ATAGE.
PARAMETERS: DATEFROM LIKE VTBBEWE-DBERVON,
DATETO LIKE VTBBEWE-DBERBIS DEFAULT SY-DATUM.
CALL FUNCTION 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
EXPORTING
I_DATE_FROM = DATEFROM
I_DATE_TO = DATETO
IMPORTING
E_DAYS = VDAYS
E_MONTHS = VMONTHS
E_YEARS = VYEARS.
WRITE:/ 'DIFFERENCE IN DAYS: ', VDAYS,
/ 'DIFFERENCE IN MONTHS: ', VMONTHS,
/ 'DIFFERENCE IN YEARS: ', VYEARS.
06-14-2007 1:51 AM
try this FM,
I think it fulfills your requirement...
HR_ECM_GET_PERIOD_BETW_DATES.
07-31-2007 7:11 AM
Hi,
Use the FM
HR_HK_DIFF_BT_2_DATES
Regards,
Irfan
Pls reward points if found suitable.
07-31-2007 7:20 AM
Hi,
the appropriate function module is
<u><b>HR_SGPBS_YRS_MTHS_DAYS</b></u>
<b><i>regards
Debjani
Rewards point for helpful answer</i></b>
07-31-2007 7:20 AM
HR_HK_DIFF_BT_2_Dates -- Days, months and years between two dates
example pro..
CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'
EXPORTING
DATE1 = KEYDATE
DATE2 = G_HIRE_DATE
OUTPUT_FORMAT = '01'
IMPORTING
years = l_years
months = l_months
days = l_days
EXCEPTIONS
others = 1.
date funcation
Add_Time_To_Date -- Adds months/days/years to a date
93 (2)
C14B_Add_Time -- Adds a time value to a date and time
95 (1)
Compute_Years_Between_Dates -- Number of years between two dates
95 (1)
Conversion_Exit_Ldate_Output -- Converts date format
96 (1)
Convert_Date_Input -- Conversion exit routine for inverted date
97 (1)
Convert_Date_To_External -- Formats date from internal to display format
98 (1)
Convert_Date_To_Internal -- Formats date from display to internal format
99 (1)
COPF_Determine_Duration -- Calculates difference between date and time
100 (1)
Date_Check_Plausibility -- Checks if the value of a field is a date format
101 (1)
Date_Check_Workingday -- Determines if a single date is a working day
102 (1)
Date_Check_Workingday_Muliple -- Checks date across multiple factory calendars
103 (2)
Date_Compute_Day -- Determines the day of the week for a date
105 (1)
Date_Conv_Ext_To_Int -- Conversion of dates to SAP's internal format
106 (1)
Date_Convert_To_Factorydate -- Converts calendar date into factory day
107 (2)
Date_Convert_To_Workingday -- Converts a calendar date into working day
109 (1)
Date_Create -- Calculates a date from the input parameters
110 (1)
Date_Get_Week -- Determines the week in a year for a date
110 (2)
Date_In_Future -- Calculates a future or past date
112 (1)
Date_To_Period_Convert -- Returns the period of a date
113 (2)
Datumsaufbereitung -- Formats date as per the user settings
115 (1)
Day_Attributes_Get -- Returns information about a day
116 (1)
Day_In_Week -- Returns the day of the week for a date
117 (1)
Days_Between_Two_Dates -- Calculates number of days between two dates
118 (1)
Easter_Get_Date -- The date of Easter Sunday
118 (1)
Factorydate_Convert_To_Date -- Converts factory day into calendar date
119 (1)
Fima_Days_And_Months_And_Years -- Calculates the difference between two dates
120 (1)
First_And_Last_Day_In_Year_Get -- First and last days of a period
121 (1)
First_Day_In_Period_Get -- Gets first day of a period
122 (1)
Get_Current_Year -- Gets the current fiscal year for a company
122 (1)
Holiday_Check_And_Get_Info -- Determines if a date is a holiday
123 (1)
Holiday_Get -- All holidays in a factory calendar
124 (2)
HR_BEN_Get_Date_Intersection -- Checks if dates overlap another date range
126 (2)
HR_Get_Leave_Data -- Gets all leave information
128 (2)
HR_HK_DIFF_BT_2_Dates -- Days, months and years between two dates
130 (1)
HR_IE_Num_PRSI_Weeks -- Number of weeks between two dates
131 (1)
HR_Payroll_Periods_Get -- Gets the payroll period for a particular date
132 (2)
HR_Time_Results_Get -- Gets the time results for a payroll period
134 (1)
Last_Day_In_Period_Get -- Gets last day of a period
135 (1)
Month_Names_Get -- Names of all the months
135 (2)
Month_Plus_Determine -- Adds or subtracts months to/from a date
137 (1)
Period_Day_Determine -- Starts and finishes date for period-fiscal year
137 (1)
RE_Add_Month_To_Date -- Adds or subtracts months to/from a date
138 (1)
RH_Get_Date_Dayname -- Returns the day based on the date provided
139 (1)
RKE_Add_To_Period -- Calculates period from any period
139 (1)
RKE_Timestamp_Convert_Input -- Converts display to Timestamp fields
140 (1)
RKE_Timestamp_Convert_Output -- Converts Timestamp fields for display
141 (1)
RP_Calc_Date_In_Interval -- Adds/subtracts years, months, days to/from date
142 (1)
RP_Check_Date -- Checks if value is in date format
142 (1)
RP_Last_Day_Of_Months -- Gets the last day of the month
143 (1)
SD_Datetime_Difference -- Difference in days and time for two dates
144 (1)
Subtract_Time_From_Date -- Subtracts months, days, and years from a given date
145 (1)
SWI_Duration_Determine -- The time between two events in seconds
146 (1)
WDKAL_Date_Add_Fkdays -- Number of working days in a date range
147 (1)
Week_Get_First_Day -- Returns the date of the Monday of a week
148 (1)
Week_Get_NR_Of_Workdays -- The number of workable days in a week
149 (1)
Weekday_Get -- Names of all the days of the week
150 (1)
07-31-2007 11:40 AM
Hi,
Try with this program:
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,
Bhaskar