07-07-2008 8:18 AM
Hi all
Is there any Function module or some code snippet to get last date of previous month ?
thanks in Advance ,
Naval Bhatt
07-07-2008 8:22 AM
hi,
you can do the following:
DATA : date TYPE sy-datum.
date = sy-datum. "Today
date+6(2) = '01'. "First day of this month
date = date - 1. "Previous day before first day of this month = last day of last month
hope this helps
ec
07-07-2008 8:22 AM
hi,
you can do the following:
DATA : date TYPE sy-datum.
date = sy-datum. "Today
date+6(2) = '01'. "First day of this month
date = date - 1. "Previous day before first day of this month = last day of last month
hope this helps
ec
01-10-2022 9:27 AM
07-07-2008 8:26 AM
pls use below 2 FM's
CALL FUNCTION 'MONTH_PLUS_DETERMINE'
EXPORTING
months = -1
olddate = curent_date
IMPORTING
newdate = w_prevdate.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
day_in = w_prevdate
IMPORTING
last_day_of_month = w_lastdayprevmonth
EXCEPTIONS
day_in_no_date = 1
OTHERS = 2.
07-07-2008 8:27 AM
DATE_CHECK_PLAUSIBILITY Check to see if a date is in a valid format for SAP. Works well when validating dates being passed in from other systems.
DATE_COMPUTE_DAY Returns a number indicating what day of the week the date falls on. Monday is returned as a 1, Tuesday as 2, etc.
DATE_GET_WEEK will return the week that a date is in.
DATE_IN_FUTURE Calculate a date N days in the future.
DAY_ATTRIBUTES_GET Return useful information about a day. Will tell you the day of the week as a word (Tuesday), the day of the week (2 would be Tuedsay), whether the day is a holiday, and more.(provided by Francois Henrotte)
07-07-2008 8:27 AM
07-07-2008 8:28 AM
hi
good
You can use FM OIL_LAST_DAY_OF_PREVIOUS_MONTH to get last day of previous month.
Or you can use FM HR_JP_ADD_MONTH_TO_DATE to calculate previous months date by passing -1 and current date as input parameters and then use above FM to get first and last day.
hope this would help to solve your problem.
Thanks
mrutyun^
07-07-2008 8:30 AM
Hi,
use below function module
FKK_LAST_DAY_OF_MONTH
provide any date of the month for which u need to get last day.
07-07-2008 8:30 AM
data:
w_date type sy-datum,
w_last_premonth type sy-datum,
w_days(2) type n.
w_date = sy-datum.
w_days = w_date+6(2).
w_last_premonth = w_date - w_days.
write w_last_premonth.
Edited by: jagadeesh tirumalasetti on Jul 7, 2008 9:31 AM
07-07-2008 8:31 AM
Hi,
Try this Function Module,
OIL_LAST_DAY_OF_PREVIOUS_MONTH.
Hope this helps you.
Reward points if helpfull.
Thanks & Regards.
Y.R.Prem Kumar
07-07-2008 8:39 AM