11-12-2007 1:46 PM
Hi all,
Could you suggest me a FM for for finding the week number of a month.
I can see FM which shows week number of an year .But i want the week number with reference to a month.
Thanks
Sam.
11-12-2007 1:50 PM
try GET_WEEK_INFO_BASED_ON_DATE
try this code....
data: week type scal-week.
data: week1 type scal-week.
data: date like sy-datum.
*
date = sy-datum.
call function 'DATE_GET_WEEK'
exporting
date = date
importing
week = week.
week1 = week.
date+6(2) = '01'.
call function 'DATE_GET_WEEK'
exporting
date = date
importing
week = week.
week1 = week1 - week + 1.
*
write:/ sy-datum, 'is in week', week1, 'of the month'.
11-12-2007 1:53 PM
Hi,
A sample using function DATE_GET_WEEK
Report try05.
DATA: xweek(6) TYPE n,
xdt TYPE d.
xdt = '20050101'.
CALL FUNCTION 'DATE_GET_WEEK'
EXPORTING
DATE = xdt
IMPORTING
WEEK = xweek
EXCEPTIONS
DATE_INVALID = 1
OTHERS = 2
.
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:/ xdt.
WRITE:/ xweek.
Hope this helps.
Reward if helpful.
Regards,
Sipra
11-12-2007 1:54 PM
11-12-2007 2:07 PM
hi
good
try this
GET_WEEK_INFO_BASED_ON_DATE
-
See this FM..
WEEKNR_GET Calendar: Fetch Week Number
-
CALL FUNCTION 'GET_WEEK_INFO_BASED_ON_DATE'
EXPORTING
date = s_date
IMPORTING
week = woche
monday = monday1
sunday = sunday1.
thanks
mrutyun^