04-25-2008 12:02 PM
Hi ABAPers,
Is there any standard Function module to display
years months days if we r given total days as input.
regards,
kishore
04-25-2008 12:06 PM
try the FM
Compute completed years between two dates
call function 'HR_SGPBS_YRS_MTHS_DAYS'
exporting
beg_da = date1
end_da = date2
importing
no_day = comp_days
no_month = comp_mnths
no_year = comp_yrs.
anya
04-25-2008 12:09 PM
Try this code..
* Local Data
DATA: l_years type n length 2, "Years
l_mons type n length 2, "Months
l_days type n length 2,
l_int type i. "Integer variable
* The variable with days should be type I say, g_days
* Years
l_int = g_days / 365. " Assuming 365 days per year
l_years = l_int.
*Months
g_days = g_days - l_years * 365.
l_int = g_days / 30. "Assuming 30 days a month
l_mons = l_int.
* Days
g_days = g_days - l_mons * 30.
l_days = g_days.
This should work..
Thanks..Reward points pls..
Rahul
09-15-2011 10:59 AM
04-25-2008 12:09 PM
Hi Kishore Kumar,
you can first convert it into no of hours by FM:
RSSM_CONVERT_DAYSEC2TIMESTAMP
RRBA_DAYS_TO_TIMESTAMP_ADD
and then convert these into date by FM:
RP_CALC_DATE_IN_INTERVAL
Regards,
Sunil