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: 

weekly split up date

Former Member
0 Kudos

hi

My parameter options saldate order date it may be one month date

so i want data weekly wise? i want to split weekly date format ?

anybody help me

1/5/2006 - 7/5/2006 ---1st week

8/5/2006 - 15/5/2006 ---2nd week

and so on

4 REPLIES 4

Former Member
0 Kudos

Hi,

take first date add 6 to get end date

1st week

start_date , endate = start_date + 6.

2nd week

start_date = 1st_week_endate + 1 , endate = start_date + 6.

3rd week

start_date = 2nd_week_endate + 1 , endate = start_date + 6.

3th week

start_date = 4th_week_endate + 1 , endate = start_date + 6.

and so on

Date calculations are done internally.

but for that data type should be

type dats

or

like sy-datum.

Message was edited by: Manoj Gupta

Former Member
0 Kudos

Hi ,

Just Try the following FM's

DATE_GET_WEEK

regards,

Nandha

Former Member
0 Kudos

hi,

Use FM BWSO_DATE_GET_FIRST_WEEKDAY to get the first day of the week.

Then use NEXT_WEEK to get all the weeks in the month

Sameena

Former Member
0 Kudos

Hi Muthukumar,

Use the function module <b>'DATE_GET_WEEK'</b> to get week number in a year.

Use the following to code which may solve your probelm.

REPORT ZTEST_WEEKNUMBER.

parameters: p_date like sy-datum.

data v_date like sy-datum. "To get 1st date of month

data v_w1 like scal-week. "To get week number of parameter

data v_w2 like scal-week. "To get week number of 1st day of month

data v_wn type i. "To get current week number of parameter

START-OF-SELECTION.

concatenate p_date+0(6) '01' into v_date.

CALL FUNCTION 'DATE_GET_WEEK'

EXPORTING

date = p_date

IMPORTING

WEEK = v_w1

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.

CALL FUNCTION 'DATE_GET_WEEK'

EXPORTING

date = v_date

IMPORTING

WEEK = v_w2

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.

v_wn = v_w1 - v_w2 + 1.

write:/ v_wn.

Thanks,

Vinay