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: 

Any Date function to find date on last friday?

Former Member
0 Kudos

Hi all,

Is there any date function module to find out the date on last friday....

And one more thing....any function module to findout the range of dates for the last week...(i.e) date from last week monday to last week friday.

Thanking u all in advance.

Regards,

Chandra Sekhar

4 REPLIES 4

Former Member
0 Kudos

REPORT ZSN_FRIDAYTEST .

data: days type p.

data: date type sy-datum.

parameters: p_date like sy-datum default sy-datum.

*-- Get the last Friday

call function 'DAY_IN_WEEK'

exporting

datum = p_date

IMPORTING

WOTNR = days.

days = days + 2.

date = p_date - days.

write:/ '(Assuming Monday is the first day of the week)'.

write:/ 'Date Entered:', p_date.

write:/ 'Last Friday:', date.

*- Range of dates in last week

data: date1 type sy-datum.

data: date2 type sy-datum.

data: days1 type p.

data: days2 type p.

call function 'BWSO_DATE_GET_FIRST_WEEKDAY'

exporting

date_in = p_date

IMPORTING

DATE_OUT = date1

.

date1 = date1 - 7.

date2 = date1 + 4.

write:/ 'Range:', date1, '-', date2.

Former Member
0 Kudos

Hi

<b>DATE_COMPUTE_DAY</b>---> Returns day of the week for a particular date(1=Monday, 5=Friday etc.)

you can use this Functio module, if you execute this on monday, then it will give you the result as <b>'1'</b>, so by this one, you can that this is monday, so just decrease it by 2 days, i mean decrease the SY-DATUM , you will find the last friday date.

think it about the FM, and the result of the FM, you will solve your Problem

Thanks

Sudheer

Former Member
0 Kudos

Thank you guys....

I had the same idea...but i was looking for a standard fm to get that date on last friday...I searched for it & didn't find any...

Thanks for ur time...

Regards,

Chandru

Former Member
0 Kudos

Hi Sekhar,

u can use FM RH_GET_DATE_DAYNAME. input the last date of the month n get the day for that. n u can subtract the appropriate no. of days from this to get the date on last friday.

eg if 31.03.2006 gives saturday

subtract 1 for this to get 30.03.2006 as friday & so on.

similarly u can use this for ur 2nd query too.

Regards,

Bikash