04-30-2009 5:15 PM
Hi Friends,
Is there any function module exists if I will enter any date as input parameter
the last thursday date should come as output ?
For example 1: The input parameter is 15.04.2009 (15th is Wednesday) so the output is 09.04.2009(bcz last thrusday is 9th)
2. Suppose if the input parameter is 17.04.2009 (17th is friday) so the output is 16.04.2009(bcz last thrusday is 16th)
Thanks
Raj
04-30-2009 5:36 PM
Hi ,
You can use the following code:
data : v_date type datum,
v_day(10) type c.
v_date = pass whatever date you want in format yyyymmdd .
do .
CALL FUNCTION 'DATE_TO_DAY'
EXPORTING
date = v_date
IMPORTING
WEEKDAY = v_day
if v_day <> 'Thursday'.
v_date = v_date - 1 .
else.
write: v_date .
exit.
endif.
enddo.
Regardrs,
Ashish Arora
04-30-2009 5:37 PM
Welcome to SCN.
Please search the forum for the query before posting it.
Just a hint as this is your first post...
use the fm DAY_IN_WEEK, it return the number of the day of the week
1 (Monday) & 7 (Sunday)
now do some calculation to get thursday...