Skip to Content
author's profile photo Former Member
Former Member

Function module to calculate lastyear-month by passing calmonth

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.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Aug 10, 2016 at 06:50 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 10, 2016 at 06:10 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.