10-06-2008 5:49 AM
hi all,
I want to get date of Monday of last week to Sunday of last week , I got a function module 'LAST_WEEK' ,but i am unable to understand the concept of it called Factory Date..i am giving input in 'YYYYMM' , i am gettin two dates for output fields of function module MONDAY and SUNDAY. I am unable to interpret them. Is it the right func. module I am using., if not tell me the way.
with regards,
sandeep akella.
10-06-2008 6:02 AM
Hi Sandeep,
Suppose you have a date and want to get the last week's first and last date.
First use the FM DATE_GET_WEEK. Input your date in it and you will get the output as a 6 digit number containing the year and the week of the year.
Now use this output that you received from the previous FM as an input to the FM LAST_WEEK.
Now you will get the last week's first and last day.
I hope this helps.
Regards,
Surinder
10-06-2008 6:10 AM
Hi,
data : lv_current_week type SCAL-WEEK.
CALL FUNCTION 'DATE_GET_WEEK'
EXPORTING
DATE = SY-DATUM
IMPORTING
WEEK = lv_current_week
EXCEPTIONS
DATE_INVALID = 1
OTHERS = 2.
data : lv_MONDAY LIKE SY-DATUM,
lv_SUNDAY LIKE SY-DATUM.
CALL FUNCTION 'LAST_WEEK'
EXPORTING
CURRENT_WEEK = lv_current_week
IMPORTING
MONDAY = lv_MONDAY
SUNDAY = lv_SUNDAY.
Note:
Here lv_current_week is
lv_current_week+0(4) = Current Year
lv_current_week+4(2) = Current Week Number.
Try this.
Thanks,
Durai.V
Edited by: Durai V on Oct 6, 2008 7:16 AM
10-06-2008 6:12 AM
Sandeep,
The input which you give should of be of 'YYYYWW' format where WW is the current week.
For example if you give 200852 in the input, the function module, takes into consideration the last week, ie, the 51st week of 2008 and you get the output as 15th Dec 08 and 21st Dec 08.
Hope i have been helpful.
12-03-2010 8:51 AM