How to substract one month from a given date

Question: Hi,

How can I substract exactly one month from a given date. Is there any function module to get this.

Here is my code copy paste. I would like to get know if there is any fucntion module is available.


move l_run_dt+4(2) to i_month.
move l_run_dt+0(4) to i_year.

compute i_month = i_month - 1.
move i_month to c_month.

if c_month = '0'
compute i_year = i_year -1.
move i_year to c_year.
endif.


concatenate c_year c_month l_run_dt+6(2) into header_rec-date.

Thank you,
Srini

Answer:
Hi,

How can I substract exactly one month from a given date. Is there any function module to get this.

Here is my code copy paste. I would like to get know if there is any fucntion module is available.


move l_run_dt+4(2) to i_month.
move l_run_dt+0(4) to i_year.

compute i_month = i_month - 1.
move i_month to c_month.

if c_month = '0'
compute i_year = i_year -1.
move i_year to c_year.
endif.


concatenate c_year c_month l_run_dt+6(2) into header_rec-date.

Thank you,
Srini
There is FM I remember, something with subtract date, use the search in the forum or SE37 in SAP .
_________________
Only sheep and Tuly Idiots need a leader

Answer:
Try function module RE_ADD_MONTH_TO_DATE
Hope this helps.

Answer:
FAQ has some links on that topic.
_________________
ilya

More input data: http://abaplog.wordpress.com
Sapfans ABAP FAQ: /forums/viewtopic.php?t=94198
R's ABAP Knowledge Corner: http://www.Rard-harper.net/kb/kb.html
Function modules documentation: http://www.se37.com
Copyright ?2007 - 2008 www.jt77.com