09-28-2005 12:27 PM
I want to get the last date in a month. I let the user choose a date, for example 20050509 and want the "result" to be 20050531.
09-28-2005 12:29 PM
Hi
there are several fm find out the last day of month:
LAST_DAY_OF_MONTHS
RE_LAST_DAY_OF_MONTH for example
Max
Message was edited by: max bianchi
09-28-2005 12:32 PM
Sounds nice. Is it function modules, so I can write it in SE37 and get more information?
09-28-2005 12:34 PM
Hi
Yes you can try these function by SE37.
But they want a date and then they return last day:
PARAMETER MY_DATE LIKE SY-DATUM.
DATA: LAST_DAY LIKE SY-DATUM.
CALL FUNCTION 'LAST_DAY_OF_MONTHS'
EXPORTING
DAY_IN = MY_DATE
IMPORTING
LAST_DAY_OF_MONTH = LAST_DAY.
WRITE LAST_DAY.
Max
Message was edited by: max bianchi
Message was edited by: max bianchi
09-28-2005 12:38 PM
I write LAST_DAY_OF_MONTHS in SE37, but do not get any result. Any idea what I do wrong?
09-28-2005 12:40 PM
Hi
the function are:
LAST_DAY_OF_MONTHS
RE_LAST_DAY_OF_MONTH
Which your release is?
Max
09-28-2005 12:32 PM
Hi,
data: date type d.
date = sy-datum.
date+6(2) = '01'.
date = date + 31.
date+6(2) = '01'.
date = date - 1.
Svetlin
09-28-2005 12:37 PM
09-28-2005 12:41 PM
Hi
the format of day is YYYYMMDD, so
DATE+6(2) is DD,
DATE+4(2) is MM
DATE(4) is YYYY
Max
09-28-2005 12:33 PM
Hi,
You can also use NUMBER_OF_DAYS_PER_MONTH_GET to get the number of days in any month.
The last day will of course be the last date for the month. This FM also works for leap yrs.
Sudha
09-28-2005 12:41 PM
Hi,
Further to this if you want to find the name of the day
that LAST_DAY_OF_MONTHS gives out use the FM
<b>RH_GET_DATE_DAYNAME</b>.
Ex:
For today's date <b>09/28/2005</b> it gives out
<b>Wednesday</b>.
Please reward points if you find this explanation useful.
Regards,
Siva
09-28-2005 12:47 PM
Also u can do as
DATA: ws_c_date(8) TYPE c,
s_date = '20050509'
p_list = s_date+6(2).
p_list1 = s_date+0(4).
CALL FUNCTION <b>'NUMBER_OF_DAYS_PER_MONTH_GET'</b>
EXPORTING
par_month = p_list
par_year = p_list1
IMPORTING
par_days = ws_n_days.
<i>* For Concatenating the month and year into the date format</i>
CONCATENATE p_list1 p_list ws_n_days INTO ws_c_date.
Hope this too helps u.
Kindly reward points for the helpful answer and close the thread.
09-28-2005 12:57 PM
Hi,
Here's example how you can use FM RE_LAST_DAY_OF_MONTH:
data: w_last_day(2) type c.
CALL FUNCTION 'RE_LAST_DAY_OF_MONTH'
EXPORTING
I_DATUM = sy-datum
IMPORTING
* E_KZ_ULT =
E_TT = w_last_day
.
write: w_last_day.
Regards,
Ville
09-28-2005 1:24 PM
09-28-2005 1:31 PM
Hi Linn,
SDN way of saying thanks can be found here
/people/mark.finnern/blog/2004/08/10/spread-the-love
Regards
Raja
09-28-2005 1:41 PM
If your question has been solved, please close the thread and kindly award points for helpful answers.
Svetlin
10-04-2005 7:45 AM
> I have now solved it. Thanks everybody!
Hi Linn,
If you found any of these answers useful please close the post and reward points.
Regards,
Ville