04-01-2009 5:22 AM
Hi ,
I have a requirement where I have to fetch number of Wednesdays in a month .
Can anyone help me as to how can i do that ?
EX .
We have
5 Wednesdays in April.2009
4 in May 2009 .
and so on.
04-01-2009 7:20 AM
Juhi,
Alternatively you can use the following FMs and count it by looping for a month.
DATE_TO_DAY
RH_GET_DATE_DAYNAME
ISP_GET_WEEKDAY_NAME
DATE_COMPUTE_DAY
Hope the above information will help you
Thanks,
Babu Kilari
04-01-2009 5:43 AM
hi:
The function module DATE_TO_DAY give the day of the date. for days count, if you have to put the logic like
if 01-04-2009 (d1) : days wednesday then
08-04-2009 (d2 = d1+7) = wednesday
15-04-2009 (d3= d2+7) = wednesday
22-04-2009 (d4 =d3+7) = wednesday
29-04-2009 (d5 =d4+7) = wednesday
The first required day you should find then add like above till the month end.
Regards
Shashi
04-01-2009 6:55 AM
Hi,
The solution to your query would be run a loop starting with the 1st date of the month till the last date.
Call any of the FMs:
DATE_COMPUTE_DAY - This determines the day of the week for a date
DAY_IN_WEEK - This returns the day of the week for a date
When the FM returns a day, keep a check on if its wednesday, keep count and you will get your result.
Get back to me if you face any difficulties.
Regards.
04-01-2009 7:17 AM
Juhi,
Check this out
DATA : lv_start TYPE sy-datum VALUE '20080714',
lv_end TYPE sy-datum VALUE '20080814'.
WHILE lv_start LE lv_end.
CALL FUNCTION 'FTR_DAY_GET_TEXT'
EXPORTING
pi_date = lv_start.
IMPORTING
PE_DAY_TEXT1 =
PE_DAY_TEXT2 =
PE_DAY =
.
you have to summarize the output here somehow...
lv_start = lv_start + 1.
ENDWHILE.
04-01-2009 7:20 AM
Juhi,
Alternatively you can use the following FMs and count it by looping for a month.
DATE_TO_DAY
RH_GET_DATE_DAYNAME
ISP_GET_WEEKDAY_NAME
DATE_COMPUTE_DAY
Hope the above information will help you
Thanks,
Babu Kilari
04-28-2009 11:55 AM
Hi Juhi,
Are u still watching this thread? If you have got your answer please mark this thread as 'Answered'.
Regards.
05-01-2009 6:44 AM