‎2008 Aug 25 9:15 AM
Hi all
is there a FM to count weeks between 2 dates? For ex. I should have know how many weeks are between 10-November 2008 and 20-Februara 2009.
Thank you
Herbert
‎2008 Aug 25 9:35 AM
HR_99S_INTERVAL_BETWEEN_DATES: Difference between two dates in days, weeks, months
‎2008 Aug 25 9:19 AM
check this fm
HR_IE_NUM_PRSI_WEEKS
Return the number of weeks between two dates.
‎2008 Aug 25 9:20 AM
‎2008 Aug 25 9:23 AM
Hi
Check this snippet
DATA :
w_d1 TYPE sy-datum,
w_d2 TYPE sy-datum,
w_temp TYPE i,
w_week TYPE i..
w_d1 = '20080801'.
w_d2 = sy-datum.
w_temp = w_d2 - w_d1.
w_week = w_temp DIV 7.
WRITE :
/ w_week.Regards
Pavan
‎2008 Aug 25 9:29 AM
‎2008 Aug 25 9:35 AM
HR_99S_INTERVAL_BETWEEN_DATES: Difference between two dates in days, weeks, months
‎2008 Aug 25 9:35 AM
‎2008 Aug 25 9:40 AM
Hi,
We can use "HR_99S_INTERVAL_BETWEEN_DATES" function module.
hope this helps.
thanx,
dhanashri.
‎2008 Aug 25 10:03 AM
HI herbert,
you can calculate the weeks in ayear by the following formula.
first calculate the no of days between two dates.
then apply
data: no_w type i,
no_d type i.
no_d = no_d / 7.
best wishes
prasad
‎2008 Aug 25 10:05 AM
Hi,
please go through following piece of code this will help u...
*10-November 2008 and 20-Februara 2009
data: dat1 type PC26W-WEEKS.
data: p_beg type sy-datum.
data: p_end type sy-datum.
data: t_beg type sy-datum.
t_beg = '20080303'.
p_beg = '20081110'.
p_end = '20090220'.
CALL FUNCTION 'HR_IE_NUM_PRSI_WEEKS'
EXPORTING
TAX_YEAR_BEGIN = t_beg
PERIOD_BEGIN = p_beg
PERIOD_END = p_end
IMPORTING
NUM_WEEKS = dat1
EXCEPTIONS
END_LT_START = 1
END_LT_YEAR_START = 2
START_LT_YEAR_START = 3
OTHERS = 4
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
write:dat1.
Thanks & Regards
Ashu Singh