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: 

Date from week nr

Former Member
0 Kudos

Hi ,

I need to calculate date range from week numer of current year. I was looking for any FM but no one was corresponding to my requirements 😕 help

1 ACCEPTED SOLUTION

varma_narayana
Active Contributor
0 Kudos

DATA: v_start LIKE SCAL-DATE,

v_end LIKE SCAL-DATE,

v_week LIKE SCAL-WEEK. "Stores Year and Week

v_week = '200725' . "25th week in 2007

CALL FUNCTION 'WEEK_GET_FIRST_DAY'

EXPORTING WEEK = v_week

IMPORTING DATE = v_start

EXCEPTIONS WEEK_INVALID = 1.

write: v_start.

v_end = v_start + 5. "depends on the no of days

Note: This function returns the First day of the Week

Reward if Helpful

3 REPLIES 3

varma_narayana
Active Contributor
0 Kudos

DATA: v_start LIKE SCAL-DATE,

v_end LIKE SCAL-DATE,

v_week LIKE SCAL-WEEK. "Stores Year and Week

v_week = '200725' . "25th week in 2007

CALL FUNCTION 'WEEK_GET_FIRST_DAY'

EXPORTING WEEK = v_week

IMPORTING DATE = v_start

EXCEPTIONS WEEK_INVALID = 1.

write: v_start.

v_end = v_start + 5. "depends on the no of days

Note: This function returns the First day of the Week

Reward if Helpful

Former Member
0 Kudos

calendar related Function Modules

WEEK_GET_FIRST_DAY

This function module returns the first day of the week passed. (This is always a Monday, regardless of whether it is a working day or a holiday.)

FACTORYDATE_CONVERT_TO_DATE

This function module returns the calendar date for the factory date and the factory calendar passed.

DATE_CONVERT_TO_FACTORYDATE

This function module returns the factory date for the date and factory calendar passed. You can specify with a parameter whether the next or the previous working day is returned if the day is not a working day.

RP_CALC_DATE_IN_INTERVAL

Add/subtract years/months/days from a date

SD_DATETIME_DIFFERENCE

Give the difference in Days and Time for 2 dates

MONTH_PLUS_DETERMINE

Add or subtract months from a date. To subtract a month, enter a negative value for the 'months' parameter.

DATE_CHECK_PLAUSIBILITY

Check to see if a date is in a valid format for SAP. Works well when validating dates being passed in from other systems.

DATE_CONV_EXT_TO_INT

Conversion of dates to SAP internal format e.g. '28.03.2000' -> 20000328

DATUMSAUFBEREITUNG

Format date as the user settings

MONTH_NAMES_GET

It returns all the month and names in repective language.

DATE_IN_FUTURE

Calculate a date N days in the future.

regards,

srinivas

<b>*reward for useful answers*</b>

Former Member
0 Kudos

HI,

Use the FM WEEK_GET_FIRST_DAY : Get the first day of the week.

For this FM pass year with week number.Ex;200704.

This will return start day of the week.

Thanks CSR.