05-22-2008 10:53 AM
Hi Guys,
What is the function module to get the Week day of sy-datum?
Warm Regards,
Mohandoss P.
05-22-2008 11:00 AM
Hi Mohan,
Try this function module 'DAY_IN_WEEK' , 'DATE_TO_DAY' and 'GET_WEEK_INFO_BASED_ON_DATE'
Pls reward if it is useful.
Regards,
Boobalan Suburaj.
Edited by: Boobalan Suburaj on May 22, 2008 1:02 PM
05-22-2008 11:10 AM
Hi Suburaj,
Is there any other FM to find out the previous weeks start and end date if i give only system date?
Previous answer has been rewarded!!
Warm Regards,
Mohandoss P
05-22-2008 11:26 AM
Hi Mohan,
There is no function module to find out the Pervious week info. so that create a custom function module use the below logic.
use the Function Module
'GET_WEEK_INFO_BASED_ON_DATE' to get the week number, start date and end date of the week. once you get this details subtract 7 from start date and end date then you will get the previous week start date and end date.
Regards,
Boobalan Suburaj.
05-22-2008 11:36 AM
hi
this is simple FM to get the week based on the date.
DATE_GET_WEEK.
plz reward me if this helpful.
regards
munvar
05-22-2008 11:17 AM
hi Mohan
u can use
DATE_COMPUTE_DAY
Returns weekday for a date
DATE_GET_WEEK : Returns week for a date
RP_CALC_DATE_IN_INTERVAL : Add days / months to a date
END_OF_MONTH_DETERMINE_2 : Determines the End of a Month
MONTH_NAMES_GET : Get the names of the month
Reward points if help ful,
Amit
05-22-2008 11:24 AM
hi
find below the functions used for calendar computations...
DATE_COMPUTE_DAY -This function module returns the day of the week for the date passed.
DATE_GET_WEEK
This function module returns the week for the date passed.
WEEK_GET_FIRST_DAY
This function module returns the first day of the week passed. (This is always a Monday, regardless of whether it is a working day or a holiday.)
RP_CALC_DATE_IN_INTERVAL
Add/subtract years/months/days from a date
SD_DATETIME_DIFFERENCE
Give the difference in Days and Time for 2 dates
MONTH_PLUS_DETERMINE
Add or subtract months from a date. To subtract a month, enter a negative value for the 'months' parameter.
DATE_CHECK_PLAUSIBILITY
Check to see if a date is in a valid format for SAP. Works well when validating dates being passed in from other systems.
DATE_CONV_EXT_TO_INT
Conversion of dates to SAP internal format e.g. '28.03.2000' -> 20000328
DATUMSAUFBEREITUNG
Format date as the user settings
MONTH_NAMES_GET
It returns all the month and names in repective language.
DATE_IN_FUTURE
Calculate a date N days in the future.
hope it helps
reward if helpful
regards
niharika
05-22-2008 11:43 AM
Hi,
To get the current and previous week dates.
DATA: v_week LIKE scal-week,
v_last_week LIKE scal-week,
v_curr_mon TYPE sy-datum,
v_curr_sun TYPE sy-datum,
v_prev_mon TYPE sy-datum,
v_prev_sun TYPE sy-datum.
CALL FUNCTION 'GET_WEEK_INFO_BASED_ON_DATE'
EXPORTING
date = sy-datum
IMPORTING
week = v_week
monday = v_curr_mon
sunday = v_curr_sun.
CALL FUNCTION 'LAST_WEEK'
EXPORTING
current_week = v_week
IMPORTING
last_week = v_last_week
monday = v_prev_mon
sunday = v_prev_sun.
WRITE:/ 'Current week monday', v_curr_mon.
WRITE:/ 'Current week sunday', v_curr_sun.
WRITE:/ 'Previous week monday', v_prev_mon.
WRITE:/ 'previous week sunday', v_prev_sun.
05-22-2008 11:47 AM
Hi,
clear: hold_day_of_week.
CALL FUNCTION 'DATE_COMPUTE_DAY'
EXPORTING
DATE = workdate
IMPORTING
DAY = day_of_week_num
EXCEPTIONS
OTHERS = 8.
CASE day_of_week_num.
WHEN 1.
hold_day_of_week = 'Monday'.
WHEN 2.
hold_day_of_week = 'Tuesday'.
WHEN 3.
hold_day_of_week = 'Wednesday'.
WHEN 4.
hold_day_of_week = 'Thursday'.
WHEN 5.
hold_day_of_week = 'Friday'.
WHEN 6.
hold_day_of_week = 'Saturday'.
WHEN 7.
hold_day_of_week = 'Sunday'.
WHEN OTHERS.
hold_day_of_week = 'invalid'.
ENDCASE.
or
You can use DATE_COMPUTE_DAY to get the day number of the week (for example, today gives 5)
then use WEEKDAY_GET which returns an itab with seven entries (one for each day of the week.)
You enter in this itab and get the field langt to get the day name.
Hope this helps.
Reward if helpful.
Regards,
Sipra
04-23-2013 12:58 PM
Hi,
You can use FM DATE_TO_DAY.
DATA: ld_day TYPE c.
CALL FUNCTION 'DATE_TO_DAY'
EXPORTING
date = sy-datum
IMPORTING
weekday = ld_day.
Regards,
Satish.
04-23-2013 1:10 PM