on 08-02-2012 10:48 PM
Hi gurus,
my users want to raport their sales according to two different calendars:
- one is a standard factory calendar, the month starts on the 1st day od a calendar month.
- the second one is a bit different, a month starts on Monday of the week that "contains" the 1st day od a calendar month (i.e. 1st of April is on Wednesday, so the month "April" starts on Monday, 30th of March).
Do you have any ideas how to model this requirement?
Regards,
Dorota
Hi
There is a FM which will return the day of the date.
The FM is date_to_day.
below is the pseudo code ,
when 'zvar1'. "zvar1 is the customer exit variable.
if i_step = 2.
data wa1 like line of e_t_range.
data wa2 like line of i_t_var_range.
data day1 type d.
read table i_t_var_range into wa2 with key vnam = 'zday1'. "zday1 is the manual entry.
data cday1 type dtresr-weekday. " this will hold the day name which is used as export param in FM.
day1 = wa2-zday1.
CALL FUNCTION 'DATE_TO_DAY' "
EXPORTING
date = day1
IMPORTING
weekday = cday1.
if cday1 == 'MONDAY'.
ldate = day1.
elseif cday1 == 'TUESDAY'.
ldate = day1 - 1.
elseif cday1 = 'WEDNESDAY'.
ldate = day1 - 2.
else if cday1 = 'THURSDAY'.
ldate = day1 - 3.
elseif cday1 = 'FRIDAY'.
ldate = day1 - 4.
elseif cday1 = 'SATURDAY'.
ldate = day1 - 5.
else .
ldate = day1 - 6.
endif.
data wa1 like line of e_t_range.
wa1-low = ldate.
wa1-sign = 'I'.
wa1-opt = 'EQ'.
append wa1 to e_t_range.
endif.
Now execute the code and run the query and please once check it.
Note : Please once check the output of the FM date_to_day. I thought that this FM will return the outuput as MONDAY, TUESDAY, .....SUNDAY. As a result , i wrote the same in the If .... else... endif statement.
if it returns M , T, ... etc.. .
Please make the modification as per the output in the if ..else statement.
Hope you got it,
Regards,
RaviChandra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.