03-10-2009 11:37 AM
Hi,
I have date, month number, and week number of that particular month. with these details i need to get the date of any one day of that particular week. Can any one suggest for this scenari any function module is there.
ex: year (2008)
month (1.....12)
week (1.....5)
2008 12 02
yr month week number
I am passing as above then I need to get the output as any one of the dates between (08/12/2008 ....14/12/2008).
I searched some of FM's GET_WEEK_INFO_BASED_ON_DATE, WEEKDAY_GET but all these are asking input parameter as date. I don't have any date with me. I have week number of particular month. pls suggest if any other FM is there.
Thanks in advance.
03-10-2009 11:42 AM
03-10-2009 11:42 AM
hi rajesh pammi,
GET_WEEK_INFO_BASED_ON_DATE
this should be helpful..
Regards,
Sravan
03-10-2009 11:44 AM
hi,
Check this Code..
CONCATENATE p_month+3(4) p_month(2) '01' INTO l_fdate.
IF p_month IS NOT INITIAL.
* Read last day of month
PERFORM get_last_day_of_month USING l_fdate
CHANGING l_ldate.
PERFORM get_week_nr USING l_fdate CHANGING l_week_min.
PERFORM get_week_nr USING l_ldate CHANGING l_week_max.
p_week_total = l_week_max - l_week_min + 1.
p_week_nr = l_week_min + p_week - 1.
ENDIF.
PERFORM get_week_dates USING g_week_nr
CHANGING pn-begda pn-endda.
FORM get_last_day_of_month USING value(p_period) TYPE sy-datum
CHANGING value(p_period_out) TYPE sy-datum.
CALL FUNCTION 'LAST_DAY_OF_MONTHS' "#EC
EXPORTING
day_in = p_period
IMPORTING
last_day_of_month = p_period_out
EXCEPTIONS
day_in_no_date = 1
OTHERS = 2.
IF sy-subrc <> 0. "#EC NEEDED
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "Get_last_day_of_month
FORM get_week_nr USING p_date TYPE sy-datum
CHANGING p_week_nr TYPE n2.
DATA: l_week TYPE scal-week.
CALL FUNCTION 'DATE_GET_WEEK'
EXPORTING
date = p_date
IMPORTING
week = l_week
EXCEPTIONS
date_invalid = 1
OTHERS = 2.
IF sy-subrc = 1.
WRITE:/1 'Error: Date Invalid'(e16).
ELSEIF sy-subrc = 2.
WRITE:/1 'Error getting week number using date'(e17).
ENDIF.
p_week_nr = l_week+4(2).
ENDFORM.
FORM get_week_dates USING p_week_nr TYPE n2
CHANGING p_fdate TYPE sy-datum
p_ldate TYPE sy-datum.
DATA: l_date TYPE sy-datum,
l_week TYPE scal-week.
CONCATENATE p_month+3(4) p_week_nr INTO l_week.
CALL FUNCTION 'HRIQ_WEEK_GET_FIRST_DAY'
EXPORTING
week = l_week
IMPORTING
date = l_date
EXCEPTIONS
week_invalid = 1
OTHERS = 2.
IF sy-subrc = 1.
WRITE:/1 'Error: Week Invalid'(e11).
ELSEIF sy-subrc = 2.
WRITE:/1 'Error getting first day of week'(e12).
ENDIF.
MOVE l_date TO p_fdate.
p_ldate = p_fdate + 6.
ENDFORM.
03-10-2009 1:47 PM
Hi PAMMI!!!!!!!
Please check out the following FM
VELO03_WEEK_OR_MONTH_TO_DATE
But while test it either give week number or month number along with the year.
While give week number keep month number as 00 and while give month number give week number as 00.
Hope the FM solve your problem.
Thanks and Regards.
Sarbajit.
03-16-2009 7:29 AM
Hi Pammi,
are you still watching the thread? Please search in Code gallery with the following sentence
Tutorial Report Program to get date list of a year's particular months' particular week. You get a code developed by me. Hope it solve your problem.
Thanks and Regards.
Sarbajit.
03-16-2009 7:33 AM
Hi,
please check this link
http://www.saptechies.com/abap-function-modules/
u can check your fm
'Thanks and regards
Durga.K