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: 

getting first and last day of week

Former Member
0 Kudos

Dear all .

Is there any funcion module which gives first and last day of the current week .

Eg . todays day is 15.11.2006

start date of week : 13.11.2006

end date of week : 19.11.2006

in the same way I want how many days are there in month .

Eg : for Nov month :

30 days .

for dec month 31 days .

Thank you in advance

9 REPLIES 9

Former Member
0 Kudos

Hi

Check the FM starts with RP *----DAYS

0 Kudos

use fm<b> WEEK_GET_FIRST_DAY</b>, It find out the first day of a week, after you can calculate the last: last_day = first_day + 5.

Former Member

Use FM GET_WEEK_INFO_BASED_ON_DATE

Import parameters Value

DATE 15.11.2006

Export parameters Value

WEEK 200646

MONDAY 13.11.2006

SUNDAY 19.11.2006

Use FM HR_E_NUM_OF_DAYS_OF_MONTH

Import parameters Value

P_FECHA 15.11.2006

Export parameters Value

NUMBER_OF_DAYS 30

I hope it helps.

Best Regards,

Vibha

*Please mark all the helpful answers

Former Member
0 Kudos

GET_WEEK_INFO_BASED_ON_DATE

use the above function module

Former Member
0 Kudos

HR_E_NUM_OF_DAYS_OF_MONTH use this fm for getting the days in month

Former Member
0 Kudos

hi,

you can use FM week_get_first_day to get first day of current week.

Eg:

data: v_week type scal-week,

v_date type scal_date.

CALL FUNCTION 'WEEK_GET_FIRST_DAY'

EXPORTING

week = v_week

IMPORTING

date = v_date

regards,

Prema A

former_member283648
Participant
0 Kudos

hI,

You can use the FM <b>NUMBER_OF_DAYS_PER_MONTH_GET</b> to get the no. of days.

Use <b>WEEK_GET_FIRST_DAY</b> for getting first day of the week.

former_member188685
Active Contributor
0 Kudos

Hi,

the FM

GET_WEEK_INFO_BASED_ON_DATE works well.

pass any date of the week, you will get the start date and end date of week.

Check it.

Regards

vijay

dani_mn
Active Contributor
0 Kudos

HI,

check the logic below for getting first and last day of week.

report z_test2 line-size 100 line-count 50.

data: dat type datum.
data: days type p.
data: lastday type datum.
data: firstday type datum.
dat = sy-datum.

CALL FUNCTION 'DAY_IN_WEEK'
  EXPORTING
    DATUM         = dat
 IMPORTING
   WOTNR         = days
          .



lastday = dat + days + 1.
firstday = lastday - 6.


write:/ firstday, lastday.