Calculate previous 12 months quantity

Hello Friends.
Preparing Consolidated Sales Order Report” for Last 12 months,
I have to show the qty(wmeng) fields in the output ,every month how much qty was there,
in my selection screen i am putting month and year,based on that i have to calculate pervious 12 month qty individivally.....
menas suppose i entered 062007 in my selection screen
means 06 month 12th
           05 month 11th
           04 month 10th .....so on
in every month i have to take qty(vbep-wmeng) added individula month , if any body know this logic please help me
Thanks
Edited by: Alvaro Tejada Galindo on Mar 25, 2008 5:25 PM

Hi,
try to use the FM  bellow to get the previous 12 months date. Then do a loop or while routine to do what you need.
CALL FUNCTION 'RE_ADD_MONTH_TO_DATE'
EXPORTING
MONTHS = '-12'
OLDDATE = s_date
IMPORTING
NEWDATE = V_DATE.
Hope this help.
Rodrigo Paisante

Similar Messages

  • With 'Revenue' Fact Column how can i calculate 'Previous 3 Months Revevue'

    Hi All ,
    i have a Column Called Revenue from Fact Table. i need to calculate Previous 3 Months Revevue
    How can i achive this ? please help me
    Thanks in advance

    Hi,
    Create one new logical coloumn bmm layer and
    1.Check Use existing logical columns as the source
    2.Click the Expression Builder button (three dots) to open the Expression Builder
    3.Select Functions > Time Series Functions > Ago.
    by using this u can create 3 months year ago revenue coloumn and use this coloumn in your formula
    hope this will help for you
    Naresh

  • Calculate Previous 12 months in ASO

    Hello All,
    I need to create members in Period dimension based on last 12 months. Like below
    MemberA = Jan2013+Dec2012+Nov2012+....+Feb2012
    MemberB= Dec2012++Nov2012+....+Feb2012+Jan2012
    MemberC=Nov2012+....+Feb2012+Jan2012+Dec2011
    etc...
    We have separate Year and Period dimensions. Below is the hierarchy
    Year
         2013
         2012
    Period
         Q1
              Jan
              Feb
              Mar
         Q2
              Apr... etc
    Can you please help me to achieve this.
    Thanks,
    Prathap

    Fixed this issue by using the below, Not sure whether this is the correct way or not but its working
    CASE
    WHEN(IS([FY13], [YEARS].CURRENTMEMBER)) and (ISLEVEL([Period].Jan,0))
    THEN Aggregate({[Period].Jan.Lag(-1):[Dec]},[Years].[FY12]) + Aggregate({[Period].Jan},[Years].[FY13])
    WHEN(IS([FY12], [YEARS].CURRENTMEMBER)) and (ISLEVEL([Period].Jan,0))
    THEN Aggregate({[Period].Jan.Lag(-1):[Dec]},[Years].[FY11]) + Aggregate({[Period].Jan},[Years].[FY12])
    WHEN(IS([FY11], [YEARS].CURRENTMEMBER)) and (ISLEVEL([Period].Jan,0))
    THEN Aggregate({[Period].Jan},[Years].[FY11])
    END
    Thanks,
    Prathap

  • FM to get previous fiscal month/year and calendar month/year for a date.

    Hi All,
    I am having a requirement to extract some data based on either the previous fiscal month/year or the previous calendar month/year. There is no company code input to find the fiscal/calendar month/year.
    At selection screen, user can select either fiscal or calendar selection.
    Based on the selection, the data will be extracted.
    For the system date, we need to calculate previous fiscal month/year or previous calendar month/year and populate the calculated data back to the selection-screen.
    Can you one of you please suggest an FM to find previous fiscal month/year and previous calendar month/year.
    Thanks in Advance,
    Regards
    Gowthami

    Hi Gowthami,
    You can use following function module to calculate previous / next day or month or year.
       call function '/SAPHT/DRM_CALC_DATE'
          exporting
            date      = sy-datum
            days      =
            months    =
            sign      = '-'
            years     =
          importing
            calc_date = .
    Here, you can give '-' to sign, if you want previous day / month / year.
    Here, you can give '+' to sign, if you want next day / month / year.
    And depending upon your requirement, you can pass suitable value to days / month / year.
    e.g. To calcualte last month,
       call function '/SAPHT/DRM_CALC_DATE'
          exporting
            date      = sy-datum
            days      =
            months    = 1
            sign      = '-'
            years     =
          importing
            calc_date = wv_prev_month.
    so it will give '23-01-2008' . Then convert it in the required format as per your requirement using string function concatenate.
    Hope this help you.
    Regards,
    Anil

  • Condition to calculate order quantity with previous 3 months history of act

    Hi,
    We have a requirement of the report is i need to calculate order quantity (SD) with condition that it should have been produced with previous 3 months with finished goods sales quantity (MM), please suggest suitable formula so that order quantity should be calculated only if it was produced with previos 3 months of finished goods quqntity. Thank you
    Regards,
    Manju

    Hi Geeta,
    Would really appreciate if you can send me sample of condition which we can restrict with order quantity which is produced with 3 months of history of finished goods production. Thank you
    Regrads,
    Manju

  • Is there any standard variable to calculate previous and current month

    hi,
    Is there any standar variable to calculate previous month and current month which will calcualte from system date (sy-date). I found standard SAP Delivered variable - 0CMONTH to calculate current month. But i want both current month and previous month.  IF it is not avialble can you please provide me the ABAP code..
    thanks in advance.

    Hi,
    Check this thread.
    ABAP routine for loading previous months data in infopackage
    Regards.

  • How to Calculate last 12 months in webi?

    Hi,
    I am working on a webi report based on oracle. My report table does not have any month field in it. Hence, I created a derived table in the universe for 12 months. Now, in my report I need to calculate last 12 months data. The month and year value will be given by the user and from that date values will be displayed for previous 12 months on a chart.
    Any ideas how achieve this in webi?
    Regards,
    C Mira

    Hi,
    Generally you can get the user values using the UserResponse() function.
    Using this, you can do some basic transformation of the user values for month and year to create a "Year_month_user" variable - e.g. in the format YYYYMM or better yet - create a date variable!
    (using the ToDate() function)
    When this variable is created, you can create a similar variable "Year_month_unv" from the universe objects.
    Then apply a custom filter on your chart with the syntax
    =[Year_month_unv] Between([Year_month_user];RelativeDate([Year_month_user];-365))
    I hope this helps.
    Btw: my first forum post - Yes!
    Edited by: Simon Steiper on Jul 28, 2010 2:25 PM (added the RelativeDate to syntax)

  • FM to get the previous fiscal month

    Hi All,
    is ther any function module to calculate the previous fiscal month from the sy-datum.
    Tnhanks in Advanc
    Moderator message: date calculation questions = FAQ, please search before posting.
    locked by: Thomas Zloch on Sep 29, 2010 2:28 PM

    Hi,
    Use the FM: RP_CALC_DATE_IN_INTERVAL
    DATA:date1 TYPE sy-datum.
    START-OF-SELECTION.
      CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
        EXPORTING
          date      = sy-datum
          days      = '00'
          months    = '04'
          signum    = '-'
          years     = '00'
        IMPORTING
          calc_date = date1.
      WRITE date1.

  • Customer exit to calculate previous quarter based on user entry in 0PCALMON

    Hi,
      I have written a CMOD code to calculate previous quarter based on user entry in 0PCALMON (0CALMONTH).  That is if 09.2008 is entered for 0PCALMON, it should fetch the months 04.2008, 05.2008,06.2008.
    But unfortunately I am getting all years and all months.
    Could you please help me debug this code.
    Global Declaration :
           z_vcalmonth(2) TYPE n ,
           z_vcalyear(4) TYPE n.
    When 'YQV_LQ'.
    if i_step = 2.
    READ TABLE i_t_var_range WITH KEY
      vnam = '0PCALMON'
      iobjnm = '0CALMONTH'
      INTO l_s_var_range.
      if sy-subrc = 0.
            z_vcalmonth = l_s_var_range-low+4(2).
            z_vcalyear = l_s_var_range-low(4).
          IF ( z_vcalmonth >= 1 AND z_vcalmonth <= 3 ).
            z_vcalyear = z_vcalyear - 1.
            CONCATENATE z_vcalyear '10' INTO l_s_range-low.
            CONCATENATE z_vcalyear '12' INTO l_s_range-high.
          ENDIF.
          IF ( z_vcalmonth >= 4 AND z_vcalmonth <= 6 ).
            CONCATENATE z_vcalyear '01' INTO l_s_range-low.
            CONCATENATE z_vcalyear '03' INTO l_s_range-high.
          ENDIF.
          IF ( z_vcalmonth >= 7 AND z_vcalmonth <= 9 ).
            CONCATENATE z_vcalyear '04' INTO l_s_range-low.
            CONCATENATE z_vcalyear '06' INTO l_s_range-high.
          ENDIF.
          IF ( z_vcalmonth >= 10 AND z_vcalmonth <= 12 ).
            CONCATENATE z_vcalyear '07' INTO l_s_range-low.
            CONCATENATE z_vcalyear '09' INTO l_s_range-high.
          ENDIF.
          l_s_range-sign = 'I'.
          l_s_range-opt = 'BT'.
          APPEND l_s_range TO e_t_range.
    endif.
    endif.

    Hi,
    U can use the FM SLIM_GET_QUARTERLY_PERIODS
    Pass the variable first date of 0PCALMON ( 09.2009 => '01.09.2009') to get the table of all the 4 period ranges in PERIODS  table in result
    and read the Last entry to get the Previous Quarter period
    PERIODS table
    S OP LOW        HIGH      
    I BT 01.07.2008 30.09.2008
    I BT 01.10.2008 31.12.2008
    I BT 01.01.2009 31.03.2009
    I BT 01.04.2009 30.06.2009
    Then pass this values in l_s_range-low l_s_range-high
    Hope this helps
    Sonal...

  • How to calculate the quota base quantity in quota arrangement?

    Hi all,
    As we all know, when a new supplier is added in the quota arrangment, we take the help of quota base qunatity so that the new supplier does not get any unfair advantage over the existing suppliers. Would you please help me on how to calculate the quota base quantity or on what basis the quota base quantity is calculated?*
    Regards,
    Ranjan

    Dear,
    Quota arrangement divides the total requirements generated over a period of time among the sources of supplied by assigning a quota.
    Quota u2013 quota is equal to a number and its represents the proportionate of requirements. Total quota of all the vendors is equal to 100% of requirements.
    This quota arrangement is also specific to material and plant level.
    Quota rating = quota allocate quantity + quota base quantity / quota.
    Quota based quantity used only when a new vendor introduced.
    In the as on date situation, the minimum quota ratings will considered as preferred vendor.
    The 2 vendors has 2 same quota rating, the vendor who is having the highest quota will considered first.
    In the running quota, a new source of supply is included. (In situation of short supply) including a new source not means to reduce the quota for existing.
    Regards,
    Syed Hussain.

  • How to get previous 2 months from current date in a dropdown?

    Hello Experts ,
                           In the application which I am developing, there is a requirement wherein , I want to Populate current month and previous two month in a drop down depending upon today's date. please help.
    Thanks & Regards,
    Pratbha Shukla

    The internal format for dates is yyyymmdd.  Therefore you can just grab the month value from the date:
    data lv_month type FCMNR.
    lv_month = lv_date+4(2).
    Just subtract from the month to get the two previous.
    data lv_previous1 type FCMNR.
    data lv_previous2 type FCMNR.
    if lv_month = 1.
    lv_previous1 = '12'.
    else.
    lv_previous1 - lv_month - 1.
    endif.
    if lv_previous1 = 1.
    lv_previous2 = '12'.
    else.
    lv_previous2 - lv_previous1 - 1.
    endif.
    Then do your lookup for the month name by reading the table returned from function module MONTH_NAMES_GET.

  • Financial Report to get data of previous 2 months

    Hi,
    I got a requirement to create a report to show the data of previous 2 months based on the prompted month and year. Suppose if user selects March and year as *2009* then my report should show data for Mar followed by Feb and Jan of *2009*. I am able to create that correctly for the current year if the prompted month is from March to December.
    But if user prompts Jan and Year as *2009* then I should retrieve the report of data*Jan* of *2009* followed by Dec and Nov of previous year that is *2008*. Similarly if user prompts Feb then my report should show the data of Jan of this year 2009 and Dec of *2008*. I have YEAR and PERIOD dimensions in the Column. Could anybody please help me how can I provide such functionality. Thanks in advance.
    Regards,
    Sravan

    Hi Sravan,
    Check the below thread...hope it will help you.
    Very Urgent FR Report
    Regards,
    Mars

  • Calculate previous Sunday from the current day

    Hi Gurus,
    Can anybody tell what is the name of the function module which caluclates the previous Sunday from the Current system date. or any other idea how to calculate previous sunday from the current system date in Query.
    Thanks
    Liza

    Hello,
    See my previous thread to you for a similar Re: Find out previous Monday based on 0CALDAY
    Thanks
    Chandran

  • How SAP calculate the outstanding PO quantity and amount.

    how SAP calculate the outstanding PO quantity and amount.

    Hi Arun Raj,
    APO does not calculate the open qty.
    Only the open qty of the PO is ciffed to APO from R/3.
    Regards,
    Ashok

  • How to calculate next 12 months

    Hi Gurus,
    If a user enters a date like : 15.05.2007, I need to calculate next 12 months values.
    i.e. low = 16.05.2007
         high= 15.05.2008.
    Any help greatly appreciated. Thanks.
    Best Regards,
    Reddy.

    data: l_month         type i,
            l_year          type i,
            l_sum_of_months type i.
    data : V_DATE TYPE  D,
             V_MONTHS TYPE  I DEFAULT 0,
             E_DATE TYPE  D.
        l_sum_of_months = v_date+4(2) + v_months.               "YREM981595
        l_month         = ( l_sum_of_months + 1 ) mod 12.       "YREM981595
        if l_month eq 0.
          l_month = 12.
        endif.
        l_year  = l_sum_of_months div 12.
        l_year  = l_year + v_date(4).
        if l_year gt 9999.
          e_date      = con_hidate.
        else.
          e_date+6(2) = '01'.
          e_date+4(2) = l_month.
          e_date(4)   = l_year.
          e_date      = e_date - 1.
        endif.
    rewards if useful,
    regards,
    nazeer

Maybe you are looking for

  • After upgrade to Itunes 7 I can no longer burn cd's that work

    I used to burn cd's just fine until I upgraded to itunes 7, now no cd works in my car or any other cd player when I burn cd's with Itunes. The show up on my Mac but are not recognized in other areas. I have the lastest updates for all other software.

  • Creating the title I want as opposed to the one FCP X wants?

    Apart from playing around with FCP X, I have more or less given up on it for serious work! However, a friend of mine has not and asked me  this question which had also given me problems. How do I make a simple title with text in the size, colour and

  • Why default panel in Spry Accordeon doesnt work ?

    The solution do the default panel when a new page is loaded seems to be: <script type="text/javascript"> var acc1 = new Spry.Widget.Accordion("Acc1", { defaultPanel: x }); </script> (x=number of the panel minus 1) This is written in many tutorials. B

  • How to see multiple levels of photo folders?

    Using my Apple TV2 and home sharing with iTunes on a Windows xp pro pc, my folder tree for ohotos has 4 levels  - my pictures, year, events, sub events; apple tv shows only the year level and groups together alll the photos in the sub folders. Is the

  • Wont install 10.5.2- has any else had this problem?

    Sent computer in for repair did all the updates and only update that wont work is 10.5.2. It talks about a patch and to contact manufactor. Has any one else had this issue or suggestions? Thanks