Application Development and Automation 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: 
Read only

Need a Function Module for Week Calculation

Former Member
0 Likes
1,572

Dear Experts,

I want a function module which calculate the week number.

Suppose for date 04.05.2010

week is 19...........

i want to fetch through function module.

i have already tried function module like GET_WEEK_INFO_BASED_ON_DATE & DATE_GET_WEEK

throgh both function module output is come out is 18.

but i need 19.

when i pass 02.01.2010

then it giving 53 week of 2009.

plz. help me as soon as possible.

Thanks,

7 REPLIES 7
Read only

Former Member
0 Likes
953

Hi shalini..

Use this Fm: GET_WEEK_INFO_BASED_ON_DATE....and ad 1

but why you need 19?because 04/05/2010 is the 18 week

Best regards

Marco

Read only

0 Likes
953

run 02.01.2010.

it is the 1st week of 2010.

But Function return 53 week of 2009.

Edited by: Shalini Singh on May 4, 2010 1:16 PM

Read only

0 Likes
953

hi Shalini,

All the FM given in sap standard for calulating week start calulating week from monday and if u see 02.01.2010 is saturday and that week start in 2009 so it is 53 th week of 2009. And 04.01.2010 is Ist week of 2010 .

So wat i would suggest is that either u get week from fm and change it according to requirement .

Read only

0 Likes
953

Jan 2 2010 was indeed 53rd week of 2009, so SAP FMs are returning right value. I would strongly recommend to consult your functional consultant before assuming Jan1 2010 as week 1 of 2010.

[quote from wikipedia|http://en.wikipedia.org/wiki/ISO_8601#Week_dates]

'If 1 January is on a Monday, Tuesday, Wednesday or Thursday, it is in week 01. If 1 January is on a Friday, Saturday or Sunday, it is in week 52 or 53 of the previous year (there is no week 00). 28 December is always in the last week of its year.'

Regards,

Pawan.

Edited by: Pawan Kesari on May 4, 2010 4:56 PM

Read only

0 Likes
953

HI

what are saying Pawan is correct....and how i said in my last post the Fm work correctly...

the Fm use the SAP standard week calculation.....

Regards

Marco

Read only

Former Member
0 Likes
953

Check FM HRIQ_DATE_GET_WEEK

Read only

ThomasZloch
Active Contributor
0 Likes
953

basic date question, "as soon as possible"...

Please don't reply to such questions!

Thread locked.

Thomas