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: 

Reg : Date

Former Member
0 Kudos

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.

4 REPLIES 4

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

nil