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: 

Calculating day of week

Former Member
0 Kudos

Hi Experts,

I have a scenario in which I am giving Week no on the selection screen.

Week _______ to _______.

This is a field of table S012-SPWOC.

Now I have to calcualte the date on First Monday in the given range.

Say user enters

Week 04/2008 to 16/2008.

Now I have to calculate the date on the first Monday in this range.

Regards,

Krishan

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Try this.

Use the function module 'WEEK_GET_FIRST_DAY' and give the value of WEEK as 200804, you wil get the date of the first monday.

Sharin.

4 REPLIES 4

Former Member
0 Kudos

Hi,

Try this.

Use the function module 'WEEK_GET_FIRST_DAY' and give the value of WEEK as 200804, you wil get the date of the first monday.

Sharin.

Former Member
0 Kudos

hi,

use FM "VELO03_WEEK_OR_MONTH_TO_DATE"

give week as 04 and year as 2008.

you will get the correct output.

Former Member
0 Kudos

it is not possible to calculate Month from week, as a week can be in 2 months. (example week 31 is partly in juli and august)

Without more information (e.g. day) it is just not possible.

Therefore you will not find any routines that can do that.

The same with week to quarter.

For calweek to week just leave the year out.

in the above told case we cant give week number as 16 if user gaved 16/2008 to 45/2008

Edited by: Midhun Abraham on Sep 24, 2008 8:44 AM

Former Member
0 Kudos

Hi,

try this:

PARAMETERS: WEEKF LIKE S012-SPWOC.

*

DATA: DATEF LIKE SY-DATUM.

*

CALL FUNCTION 'WEEK_GET_FIRST_DAY'

EXPORTING

WEEK = WEEKF

IMPORTING

DATE = DATEF.

*

WRITE: / WEEKF, DATEF.

*

Regards, Dieter