‎2007 Jan 04 5:25 AM
Hi,
Could anyone pls tell me a function module which gives date of previous month of input date ?
Thx and Regds,
Bapi bobby
‎2007 Jan 04 5:30 AM
Please try with FM: <b>RE_ADD_MONTH_TO_DATE</b>
Below code might help you understand in using the same:
parameters: p_date type datum.
CALL FUNCTION 'RE_ADD_MONTH_TO_DATE'
EXPORTING
MONTHS = '-1'
OLDDATE = p_date
IMPORTING
NEWDATE = p_date.
write:/ p_date.Regards
Eswar
‎2007 Jan 04 5:31 AM
data: date like sy-datum,
date1 like sy-datum.
date = sy-datum. " here pass ur i/p
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = date
days = 00
months = 01
SIGNUM = '-' "add(+) or substract(-)
years = 00
IMPORTING
CALC_DATE = date1. " new date
write:/ 'new date', date1
.
‎2007 Jan 04 5:33 AM
Hi,
Use this FM
CALCULATE_DATE.
and pass month parameter as
CALL FUNCTION 'CALCULATE_DATE'
EXPORTING
DAYS = '0'
MONTHS = '-1'
START_DATE = SY-DATUM
IMPORTING
RESULT_DATE = lv_date.
write lv_date
Rgds,
Prakash
‎2007 Jan 04 5:34 AM
Hi Bobby,
Following FM will definitely solve your purpose.
<b>RP_CALC_DATE_IN_INTERVAL</b>
Just provide <b>date </b>(any date), <b>Signum</b>(<b>-</b>) and <b>month</b>(<b>1</b>). and execute.
It will give you date of previous month of input date
Code:
<b>CALL FUNCTION </b>'<b>RP_CALC_DATE_IN_INTERVAL</b>'
<b>EXPORTING</b>
date = date
days = 00
months = 01
SIGNUM = '-'
years = 00
<b>IMPORTING</b>
CALC_DATE = prev_date.
Hope this helps,
Pragya
null
‎2007 Jun 12 7:17 PM
Thanks a lot,
One last question, how can I get a date wich is the last day of the month of a
given date??
‎2007 Jun 12 7:22 PM