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 for a given Week

Former Member
0 Kudos

how can i get the start date and end date for a given week

like if i give week no. 28 then it will return the dates of the week like

start date = 10-07-2006

end date = 16-07-2006.

abhishek

1 ACCEPTED SOLUTION

oliver
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Abhishek,

try using function group SCAL and in it FM like this:

call function 'DATE_GET_WEEK'

exporting

date = date_in

importing

week = week

exceptions

date_invalid = 1

others = 2.

call function 'WEEK_GET_FIRST_DAY'

exporting

week = week

importing

date = date_out

exceptions

week_invalid = 1

others = 2.

Last day of the next week you can get by just SUBTRACT 1 FROM date_out of next week.

Hope that helps,

Oliver

6 REPLIES 6

Former Member
0 Kudos

Hello,

U can try with this FM DAY_IN_WEEK

If useful reward points.

Regards,

Vasanth

0 Kudos

hi,

Check FM <b>DAY_IN_WEEK</b>

CALL FUNCTION 'DAY_IN_WEEK'
EXPORTING
DATUM = P_DATE
IMPORTING
WOTNR = DAY_NUM.

IF DAY_NUM <> 1.
MESSAGE I000(ZICPR).
LEAVE LIST-PROCESSING.
ENDIF.

Check date section of

http://www.geocities.com/victorav15/sapr3/abapfun.html

Regards,

Santosh

naimesh_patel
Active Contributor
0 Kudos

Hello,

For first date : WEEK_GET_FIRST_DAY

Give input as 200628.

FOr last date = first date + 6.

Regards,

Naimesh

oliver
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Abhishek,

try using function group SCAL and in it FM like this:

call function 'DATE_GET_WEEK'

exporting

date = date_in

importing

week = week

exceptions

date_invalid = 1

others = 2.

call function 'WEEK_GET_FIRST_DAY'

exporting

week = week

importing

date = date_out

exceptions

week_invalid = 1

others = 2.

Last day of the next week you can get by just SUBTRACT 1 FROM date_out of next week.

Hope that helps,

Oliver

dani_mn
Active Contributor
0 Kudos

WEEK_GET_FIRST_DAY

week = '200628'.

It will return the first date.

last_date = first_date + 6.

Regards,

Wasim Ahmed

former_member188685
Active Contributor
0 Kudos

Hi,

You can use the FM <b>GET_WEEK_INFO_BASED_ON_DATE</b>

                                                   
  Import parameters               Value            
                                                   
  DATE                            07/13/2006                                                                                
Export parameters               Value            
                                                   
  WEEK                            200628           
  MONDAY                          07/10/2006       
  SUNDAY                          07/16/2006       
                                                 

Regards

vijay