Application Development 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: 

FM for week number of month

Former Member
0 Kudos

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.

4 REPLIES 4

Former Member
0 Kudos

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'.

Former Member
0 Kudos

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

amit_khare
Active Contributor
0 Kudos

Refer the link, you will get couple of them -

Regards,

Amit

Reward all helpful replies.

Former Member
0 Kudos

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^