cancel
Showing results for 
Search instead for 
Did you mean: 

Function module to calculate lastyear-month by passing calmonth

Former Member
0 Kudos

Hi,

  My requirement is I/P : CalMonth  and required O/P : Last year-Month . Ex :  I/p: 032016  O/p : 032015.

Is there any standard Function module available to achieve this.

Thanks in Advance.

Accepted Solutions (1)

Accepted Solutions (1)

kohesco
Active Contributor
0 Kudos

HI,

FM: https://scn.sap.com/thread/1060098 you can find here, the output will be dte, zo you can ..

move date(6) to result.

Answers (1)

Answers (1)

ziolkowskib
Active Contributor
0 Kudos

I'm not really sure if I understood you correctly but based on the given example what you want to achieve is to decrease year by one which can be done as presented below.

DATA lv_year TYPE i.

DATA lv_date(6) TYPE c.

lv_date = '032016'.

lv_year = lv_date+2(4).

lv_year = lv_year - 1.

lv_date+2(4) = lv_year.