10-26-2007 10:52 AM
hello frnds,
my requirement is like this.
i want run a report. if i run the report on tuesday(15-03-07) the date should start from monday(14-03-07).
ho w can in achieve this functionality?
10-26-2007 10:54 AM
10-26-2007 10:56 AM
i dont know on wat day i may run.
let us say i run 2 day i.e., friday even though i should get starting date of the week i.e, monday
10-26-2007 11:00 AM
I understand your requirement...
Just use this FM..this returns always that week monday...
CALL FUNCTION 'GET_WEEK_INFO_BASED_ON_DATE'
EXPORTING
date = sy-datum
IMPORTING
monday = pdat.
10-26-2007 11:02 AM
Hi Madan,
chk this
REPORT YCHATEST2.
DATA : V_DATE LIKE SY-DATUM.
CALL FUNCTION 'GET_WEEK_INFO_BASED_ON_DATE'
EXPORTING
DATE = SY-DATUM
IMPORTING
* WEEK = WEEK
MONDAY = V_DATE.
* SUNDAY = SUNDAY.
WRITE : / 'First day of week is ' , V_DATE.
10-26-2007 11:03 AM
Hi Madan..
These are the Hints:
First Call the FM <b>DATE_GET_WEEK "</b>Returns the Week No of the Given Date
Call the FM <b>WEEK_GET_FIRST_DAY</b> "Returns the First day of the week
reward if Helpful.
10-26-2007 11:13 AM
how can i add 7 days to a date.
suppose v_date is type sy-datum
contains date as 22.10.2007.
how can i add 1 week to that date.
10-26-2007 11:17 AM
Hi,
To add 7 days to your date
Use the function module
<b>RP_CALC_DATE_IN_INTERVAL</b>
Sample code:
DATA V_DATE TYPE SY-DATUM.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
DATE = SY-DATUM
DAYS = 7
MONTHS = 0
SIGNUM = '+'
YEARS = 0
IMPORTING
CALC_DATE = V_DATE.
write:/ v_date.
10-26-2007 11:20 AM
Hi Madan,
chk this
REPORT YCHATEST2.
DATA : V_DATE1 LIKE SY-DATUM,
V_DATE2 LIKE SY-DATUM.
V_DATE1 = SY-DATUM + 7.
CALL FUNCTION 'GET_WEEK_INFO_BASED_ON_DATE'
EXPORTING
DATE = V_DATE1
IMPORTING
* WEEK = WEEK
MONDAY = V_DATE2.
* SUNDAY = SUNDAY.
WRITE : / 'First day of week is ' , V_DATE2.
10-26-2007 10:56 AM
Hi madam,
create select screen using sy-datum,
fetch data based on sy-daum - 1.
If useful, reward points,
Regards,
Bhaskar
10-26-2007 11:05 AM
You can use the FM - BWSO_DATE_GET_FIRST_WEEKDAY.
That will give the first day of the week.
10-26-2007 11:06 AM
Hi Madan,
If you want the Start Date to be the 1st day of the week on which you run the report, then you can use the following FMs:
DATE_GET_WEEK: To get the week in which a date lies.
WEEK_GET_FIRST_DAY :To return first day for a particular week
Reward points for useful answers.
10-26-2007 11:07 AM
Hi,
PARAMETERS: p_date TYPE sy-datum.
DATA: v_wotnr TYPE p.
INITIALIZATION.
p_date = sy-datum.
DO.
CALL FUNCTION 'DAY_IN_WEEK'
EXPORTING
datum = p_date
IMPORTING
wotnr = v_wotnr.
IF v_wotnr = 1.
EXIT.
ELSE.
p_date = p_date - 1.
ENDIF.
ENDDO.
10-26-2007 11:08 AM
use the below FM: it will always give you the monday,
CALL FUNCTION 'GET_WEEK_INFO_BASED_ON_DATE'
EXPORTING
date = sy-datum
IMPORTING
monday = l_monday.
*reward if solved*
10-26-2007 11:15 AM
Hi,
Please use the FM 'DATE_COMPUTE_DAY'.
With this FM you can get the day of the week using the current date.
for e.g. 0 stands for Monday,1 for Tuesday, 2 for Wednesday,3 for Thursday.
Once you get the day then you can subtract the exact no of days to get the get of Monday.
Hope it was useful.
Thanks,
Sandeep.