Customer Exit for 13 month from current month

Hi Gurus,
I need a customer exit for 13 months from current month. Based on the requirement I have written following code
When 'VPI_13CALYRMON'.
    IF i_step = 1.
      l_s_range-sign = 'I'.
      l_s_range-opt = 'BT'.
      l_s_range-low = sy-datum+0(6).
      l_s_range-high = sy-datum+0(6) + 13.
      append l_s_range to e_t_range.
    endif.
Please could you guide me the code.
Thanks
Ganesh Reddy.

Hi,
I think you can do it in below way.
When 'VPI_13CALYRMON'.
IF i_step = 1.
temp1 = sy-datum+0(4).
temp1 = temp1 +1. (because adding 13 months would take year to next year)
temp2 = sy-datum+4(2).
temp2 = temp2 + 1. (after adding 13 months, the month would be one more than of previous year)
concatenate temp1 temp2 into temp3.
l_s_range-sign = 'I'.
l_s_range-opt = 'BT'.
l_s_range-low = sy-datum+0(6).
l_s_range-high = temp3.
append l_s_range to e_t_range.
endif.
Hope this helps.

Similar Messages

  • Customer Exit for 15 month from current month

    Hi Gurus,
    I have a requirement to write customer exit for 15 months from current month based on todays day.
    if current day is less than 10 then we have to get 15 months from current month other wise from next month to 15 months.
    this exit I am writing on calendar year/month.
    Please assist for logic.
    Thanks
    Ganesh Reddy.

    I hope this code will do the trick.
    DATA: L_S_RANGE TYPE RSR_S_RANGESID,
    LOC_VAR_RANGE LIKE RRRANGEEXIT,
    zcalmonth(6) type c.
    zcurrentmonth(6) type c.
    zyear(4) type n,
    znextyear(4) type n,
    zyear1(4) type c,
    znextyear1(4) type c,
    zmonth(2) type n,
    zmonth1(2) type n,
    zmonth2(2) type c,
    zmonth3(2) type n,
    zmonth4(2) type c,
    IF i_step = 2.
    CASE i_vnam.
    WHEN '<VARNAME>'.
    zyear = sy-datum+0(4).
    znextyear = zyear + 1.
    zyear1 = zyear.
    znextyear1 = zlastyear.
    zmonth = sy-datum+4(2).
    if sy-datum+6(2) LE 10.
    zmonth1 = zmonth + 2.
    if zmonth1 GT 12.
    zmonth1 = zmonth1 - 12.
    zmonth2 = zmonth1.
    zcurrentmonth = sy-datum+0(6).
    endif
    concatenate znextyear1 zmonth2 into zcalmonth.
    else.
    zmonth1 = zmonth + 3.
    ZMONTH3 = ZMONTH + 1.
    if zmonth1 GT 12.
    zmonth1 = zmonth1 - 12.
    zmonth2 = zmonth1.
    endif
    if zmonth3 GT 12.
    zmonth3 = zmonth3 - 12.
    zmonth4 = zmonth3.
    endif
    concatenate znextyear1 zmonth2 into zcalmonth.
    concatenate znextyear1 zmonth4 into zcurrentmonth.
    endif.
    l_s_range-low = zcurrentmonth.
    l_s_range-high = zcalmonth.
    l_s_range-sign = 'I'.
    l_s_range-opt = 'BT'.
    APPEND l_s_range TO e_t_range.
    ENDIF.
    ENDIF.
    rgds, Ghuru

  • To show previous 12 months from current month.

    I have one column Time.Month (Char column) with values in the format 2011 / 09. In my report i want to show previous 12 months from the current month. I dont have any date prompts in my report. Pls help.

    Use the below query in init block to create a repository variable as PREVIOUS_12_MONTH
    SELECT PRV.PER_NAME_MONTH FROM VALUEOF(OLAPTBO).W_DAY_D PRV , VALUEOF(OLAPTBO).W_DAY_D CUR WHERE convert(char(12),PRV.DAY_DT)=convert(char(12),CUR.YEAR_AGO_DT) AND convert(char(12),CUR.DAY_DT)=convert(char(12),getdate()-valueof(time_offset))
    Variable PREVIOUS_MONTH: Use the below query in init block
    SELECT PRV.PER_NAME_MONTH FROM VALUEOF(OLAPTBO).W_DAY_D PRV , VALUEOF(OLAPTBO).W_DAY_D CUR WHERE convert(char(12),PRV.DAY_DT)=convert(char(12),CUR.MONTH_AGO_DT) AND convert(char(12),CUR.DAY_DT)=convert(char(12),getdate()-valueof(time_offset))
    Create a filter in Answers as below and use where ever you wish:
    Month is between PREVIOUS_12_MONTH and PREVIOUS_MONTH
    Use it in the report with current month Or previous month as per your requirements.
    Pls mark if helps

  • Subtraction 3 months from current month and store in a report output

    Hi Gurus,
    Currently my requirement is my clinet is having 2 sales organization one in usa and one in china.
    They are using one report for sales comparison. The issue is  when client enter the sales organization number like 1002 for china the output should like
    Period 06 => SEP (usa spetember amount should come in 1002 organization june filed in the report
    Period 07 => OCT(like wise oct amount for in august. This process should continue for every month.
    provide sample program or logic.

    Subtracting days to determine month is not a good idea, as each month can have different number of days.
    If you want to be precise act on month value in date like this:
    data: period type i, "data for stroing period
            c_period(2) type n. "period in format 01,02, 03
    period = sy-datum+4(2) - 3. "take 3 months before actual date
    "if the result is less or equal 0 (then we have to back to to previous year)
    "it will be applicable only for JAN, FEB and MARCH months
    if period le 0.  
    ADD 12 to period.
    endif.
    c_period = period.  "now in c_period you have 3 months before today

  • Customer Exit for Calendar Month based on the day (system Date)

    Hello,
    I need help in creating a customer exit for Calendar month without the user input. The logic is as follows:
    For the BEx variable created with customer exit option and no user input:
    If the day on the system date falls in between 1 to 14 take the calendar year/month value as previous month.
    If the day on the system date falls in between 15 through 31 then take the calendar year/month as current month.
    eg if report is run on March 24th2009 the calendar year/month variable should be calculated as 03/2009 (March 2009)
    if the report is run on March 1st2009 the calendar year/month should be calculated as 02/2009 (Feb 2009).
    The code should be effective when run in the first 15 days of Jan when the previous month would contain the previous year as well.
    Thank You
    Srishti

    Thanks Shanthi. I am trying to incorporate the logic when the query is run in beginning of Jan when the year should be the previous year.Following is the code.please let me know if it would work. Is there a way I can test it as well?
    CASE I_VNAM.
    WHEN 'ZCURCALMON'.
    IF i_step = 2.
    data: mm(2),
            dd(2),
            yy(4),
            FM(6).
    if sy-datum+4(2) EQ 1.
    sy-datum(4) = sy-datum(4) - 1.
    else.
    sy-datum(4) = sy-datum(4).
    endif.
    if sy-datum+6(2) LE 15.
      mm = sy-datum+4(2) - 1.
      concatenate sy-datum(4) mm into FM.
    else.
      concatenate sy-datum(4) sy-datum+4(2)  into FM.
    endif.
    l_s_range-low = FM.
    l_s_range-sign = 'I'.
    l_s_range-opt = 'EQ'.
    append l_s_range to e_t_range.
    Endif.
    ENDCASE.
    Thanks
    Srishti

  • Customer exit code to populate three month's fiscal period

    Dear frns,
    I need an ABAP customer exit code to populate three month's fiscal period.
    Please update on this...thanks
    Cheers! Shana

    Dear,
    Thank u for all replies.
    My requirement is simple.
    Rows:
    Fiscal Year
    Columns
    GR Value
    Filters
    Material Number
    Input Paramters:
    Material No.
    Fiscal Year
    Using customer exit if we populate current fiscal year in the selection screen output be like this....
    FISCAL YEAR    GR Value(in crores)
    2009                     4000
    2008                     3000
    2007                     2000
    2006                     1000
    The cube name Custom Cube ZBBP_C03.
    But I dont have time char 0FISCYEAR in my Cube.In my cube avaiable chars are Calender Year,Calender Year/Month,Calender Year/Quarter,Fiscal Period
    Please let me know if you need any information.
    Waiting for replies,
    Thanks & Regards,
    Praveen.K

  • How to get name of the month from current date.

    Hi,
       How to get the name of the month from current date.
    Thanks,
    Senthil

    Sethil,
    Use your date(let us say Date1) instead of sy-datum.
    CALL FUNCTION 'MONTH_NAMES_GET'
    EXPORTING
    LANGUAGE = SY-LANGU
    IMPORTING
    RETURN_CODE =
    TABLES
    MONTH_NAMES = itab_month
    EXCEPTIONS
    MONTH_NAMES_NOT_FOUND = 1
    OTHERS = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    READ TABLE itab_month
    WITH KEY MNR = date1+4(2).
    itab_month-LTX will contain the value you are looking for
    Good luck
    Raghava

  • Formula to subtract current month from previous month

    Hi
    I would like to how to subtract current month from previous month in Crystal 10.  Basically am looking at the variations that between the two month .   I would also like to know the 12 m onth rolling data formula.  Using the same formula, you need to get the difference between the two month.
    Any help on this is very much appreciated.
    Thanks
    Regards
    Cauvery

    Hi Thanks for reponding.
    Though the formula is correct, I don't think it will work out in that way because I have a 12 months rolling data  formula and using this formula  I have to subtract the current month from previous month.
    This the formula that am currently using for 12 months rolling data
    {HPD_HelpDesk.Arrival Time} >= DATEADD ("yyyy", -1, CURRENTDATE)
    Please advise.
    Regards
    Cauvery

  • Retrieving remaning months of current year from current month

    Hi,
    I would like te retrieve the remaining months of current year from current date.
    I can I achieve this?
    For example today is 23 july 2012.
    Then I would like to have:
    August
    September
    October
    November
    December
    Thanks,
    Diana

    Something like this:
    with generate_months as (select to_char(add_months(trunc(sysdate, 'mm'), level -1), 'fmMonth', 'nls_date_language=english') months, level lvl
                             from   dual
                             connect by level <= months_between(add_months(trunc(sysdate, 'yyyy'), 12), trunc(sysdate, 'mm')))
    select months
    from   generate_months
    where  lvl != 1;
    MONTHS  
    August  
    September
    October 
    November
    December Edited by: Boneist on 23-Jul-2012 16:42
    Fixed the query so that it wouldn't show any months when sysdate is in December.
    Also, this is a duplicate of retrieving remaning months of current year from current month (shame I didn't spot that before adding my solution! Oh well...)

  • How to select data from an aggregate in a customer exit for a query?

    Hi,
    I have written a virtual key figure customer exit for a query. Earlier the selection was from the cube, where there was severe performance issue. So I have created an aggregate, activated and have loaded the data.
    Now when I select that data I find that the Key table is different in development and production. How do I resolve this.
    My code is attached below. The table in developemnt is KEY_100027 and in production is KEY_100004. This code is activated and running in BW development server.
    SELECT
        F~KEY_1000041 AS K____035
         F~KEY_1000271 AS K____035
         F~QUANT_B AS K____051
         F~VALUE_LC AS K____052
    INTO (xdoc_date, xval1, xqty1)
    UP TO 1 ROWS
    FROM
    FROM
    */BIC/E100004 AS F JOIN
    /BIC/E100027 AS F JOIN
    /BIC/DZMM_CGRNU AS DU
    ON FKEY_ZMM_CGRNU = DUDIMID
    JOIN /BI0/SUNIT AS S1
    ON  DUSID_0BASE_UOM = S1SID
    JOIN /BI0/SCURRENCY AS S2
    ON DUSID_0LOC_CURRCY = S2SID
    JOIN /BI0/SMATERIAL AS S3
    *ON FKEY_1000042 = S3SID
    ON FKEY_1000272 = S3SID
    JOIN /BI0/SMOVETYPE AS S4
    *ON FKEY_1000043 = S4SID
    ON FKEY_1000273 = S4SID
    JOIN /BI0/SPLANT AS S5
    *ON FKEY_1000044 = S5SID
    ON FKEY_1000274 = S5SID
    JOIN /BIC/D100004P AS DP
    *ON FKEY_100004P = DPDIMID
    ON FKEY_100027P = DPDIMID
    WHERE
    WHERE
    ( ( ( ( F~KEY_1000041 BETWEEN 20051230 AND 20060630  ) ) AND  ( (
    ( ( ( ( F~KEY_1000271 BETWEEN 20051230 AND 20060630  ) ) AND  ( (
             S3~MATERIAL = <l_0material> ) ) AND  ( (
                s2~movetype BETWEEN '101' AND '102' OR
             s4~movetype BETWEEN '921' AND '922' OR
             s4~movetype BETWEEN '105' AND '106' OR
             s4~movetype BETWEEN '701' AND '701' OR
             s4~movetype BETWEEN '632' AND '632' ) ) AND  ( (
             S5~PLANT = <l_0plant> ) ) AND  ( (
             DP~SID_0RECORDTP = 0  ) ) ) )
    GROUP BY
        ORDER BY F~KEY_1000271 DESCENDING.
          IF sy-subrc NE 0.
            EXIT.
          ENDIF.
        ENDSELECT.
    How do I transport the code and make it work?
    Whats the reason that the two key fields are different.
    I had transported the aggregate from development to production. Activated it and filled the data.
    What is the way out? Please help.
    Regards,
    Annie.

    Hi Sonu,
    The main task is to move the contents of the one internal table to another with some condition.
    First sort and delete the duplicate entries from the First Internal table like below : 
    sort it_tab by material ascending date_modified descending.
    delete adjacent duplicates from it_tab.
    Then move that Internal table contents to another internal table.
    Define another internal table with the same structure as you have first internal table and then
    Second Step :
    it_itab1 = it_itab.
    If you are using seperate Header line and Body then you can do like below :
           it_itab1[] = it_itab[].
    This will fix the issue.
    Please let me know if you need any further explonation.
    Regards,
    Kittu
    Edited by: Kittu on Apr 24, 2009 12:21 PM

  • Query for fiscal month till current month of year

    Hi,
    can you please help me to show only fiscal months till current month of year?
    e.g. Current month is Apr of 2012.
    I have to show the fiscal months till the Apr 2012 of year 2012.
    if the date is 24th of Apr then it would show May month also.
    Regards,
    Nilesh

    with t as (
    select to_date('04232012','MMDDYYYY') d from dual union all
    select to_date('04252012','MMDDYYYY') from dual)
    select
    d,
    case
    when to_char(d,'DD') >= 24 then
    to_char(trunc(add_months(d,1),'MONTH'),'MM-YYYY')
    else
    to_char(d,'MM-YYYY')
    end fin_month
    from t
    D     FIN_MONTH
    23.04.2012     04-2012
    25.04.2012     05-2012

  • Customer Exit for Deriving Current Fiscal Period, Period+1 and Period+2

    Hi all,
    I have created three customer exit variables in my query for custom info object ZFISCPER (Fiscal Year PEriod), Fiscal 1, Fiscal 2 and Fiscal 3. I want to write a customer exit to derive the current period, current 1 and current2 period's respectively for these variables based on the system date. The format of the period is YYYY0MM ( 2009004). Could someone give me the exact code i can plug in CMOD for these
    Thanks a lot
    Rashmi.

    Hi Rashmi,
    I think you need only one customer exit variable. Other can be derived by setting an offset to current Fiscal Period.
    Check the BI content variable for current fiscal period. Use this variable with an offset for derving the other periods (e.g. SAP Exit variables (0FPER, 0FYTCFP, 0FYTLFP). So you have to write no own code...
    Other option is to check how SAP exit is working and building own variable based on this code.
    Check the following link to get information how to do this:
    Reg Variable 0FYTCFP
    Regards
    Andreas

  • Display three prior months starting from current month

    Hello All,
    I came across the requiremnt:
    The report looks like:
    2014-Jan
    2014-Feb
    2014-Mar
    2014-Apr
    2014-May
    2014-June
    2014-July
    2014-Aug
    2014-Sep
    2014-oct
    2014-Nov
    2014-Dec
    A
    122
    233
    233
    233
    233
    233
    233
    233
    233
    233
    233
    233
    B
    22
    33
    33
    33
    33
    33
    33
    33
    33
    33
    33
    33
    C
    33
    33
    33
    33
    33
    33
    33
    33
    33
    33
    33
    33
    D
    333
    3333
    3333
    3333
    3333
    3333
    3333
    3333
    3333
    3333
    3333
    3333
    The requirement is to display the prior 3 months ,current month, next 3 months.
    Assume that current month is SEPTEMBER, the report should look like:
    2014-June
    2014-July
    2014-Aug
    2014-Sep
    2014-oct
    2014-Nov
    2014-Dec
    A
    233
    233
    233
    233
    233
    233
    233
    B
    33
    33
    33
    33
    33
    33
    33
    C
    33
    33
    33
    33
    33
    33
    33
    D
    3333
    3333
    3333
    3333
    3333
    3333
    3333
    Share your thoughts.
    Thanks

    Hello All,
    I got this resolved using the below formula to get either prior 3 months or the next 3 months from current date:
    3rd month from current date:
    =LastDayOfMonth(RelativeDate(LastDayOfMonth(RelativeDate(LastDayOfMonth(RelativeDate(LastDayOfMonth(CurrentDate()); 1));1));1))
    Prior 3rd month from current date:
    =ToDate(FormatDate(RelativeDate(ToDate(FormatDate(RelativeDate(ToDate(FormatDate(RelativeDate(ToDate(FormatDate(CurrentDate();"MM/yyyy");"MM/yyyy");-1);"MM/yyyy");"MM/yyyy");-1);"MM/yyyy");"MM/yyyy");-1);"MM/yyyy");"MM/yyyy")
    and used these objects to restrict my date field(date object between "Prior 3rd month from current date:" and
    "Prior 3rd month from current date:"
    Thanks,
    Vijay

  • Subtracting months from current date

    how to subtract months from current date in mysql

    You are in an Oracle forum, so the Oracle answer is: use add_months(sysdate,-2) to subtract two months from the current date.
    Regards,
    Rob.

  • Get last august month from current date

    Hi,
    I need to get last august month from current date.
    e.g if current date is 1-OCT-2013 need to get last August date i.e.1-AUG-2013
    e.g. if current date is 1-MAY-2013 need to get last August date i.e.1-AUG-2012

    Something like this?
    SQL> WITH table_x AS(
      2     SELECT SYSDATE dt from dual UNION ALL
      3     SELECT TO_DATE('20-05-2013','dd-mm-yyyy') from dual
      4  )
      5  --
      6  ---
      7  --
      8  SELECT  dt,
      9    CASE
    10      WHEN (dt >= Add_Months(TRUNC(dt,'YEAR'),7)) THEN
    11          Add_Months(TRUNC(dt,'YEAR'),7)
    12      WHEN (dt < Add_Months(TRUNC(dt,'YEAR'),7)) THEN
    13          Add_Months(TRUNC(dt,'YEAR'),7) - 365
    14    END cs
    15  FROM table_x;
    DT        CS
    24-OCT-13 01-AUG-13
    20-MAY-13 01-AUG-12

Maybe you are looking for

  • How to plot an ellipse with the equation in Robert H. Bishop's book

    Hi, I've been trying to plot the ellipse with the equation on Page 232, Q E7.3 of Dr. Robert H. Bishop's book. I am currently stuck as I am unable to find a solution for this. Below is the equation which is required to  be used. r^2= A^2*B^2/(A^2*sin

  • Zzzzzrrr..... CRASH! Motion crashing!?

    Ok, I JUST installed motion onto my new MBP and motion is crashing when it tries to load the main interface, BUT i dont get a notice that pops up saying that it crashed, it just closes and no Motion Quit Unexpectedly message.... What should i do???

  • New to mac and wondering...

    Hi everone, I am trying to become a convert. Tell me what iam missing!!! I am new to mac. It is the choice of my superisor. And after 5 weeks of using my iBook, i am wondering what all the hype is about. I have been using computers for 20 years. I st

  • Using BlurFilter

    Hi, I'm trying to create a "motion blur" effect on a movie clip that contains a child clip/ sprite whose child clips/ sprite contain bitmap data using this function quote: private function dispatchOnEnterFrame(e) { if (Math.round(Math.abs(finalX-cX))

  • What is BC SET in SAP BASIS related to SAP Security.....................

    Hi All, Please explain me what is BC SET in SAP Basis which is related to SAP Security. Can anyone explain in detail... Thanks Much. Swapna.D