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

calculating 'YearToDate-YTD" from FiscalYearPeriod

Hai

How can i calculate the YTD data from the fiscalyearperiod in query level .

please give me how can i create the restrcited keyfigure and customer exit.

kumar

Add a comment
10|10000 characters needed characters exceeded

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2007 at 01:29 PM

    Hi,

    There's a SAP exit variable delivered in BI content for Fiscal period which will give you the YTD value till current fiscal period.

    If you want to calculate YTD till the period entered by the user then you will need to go for a user exit variable. Let me know if you need help with the code. Hope this helps.

    Sumit

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2007 at 01:30 PM

    Ravi,

    In your case Date not available. Only Period available. So try to restrict againest(less than or equal to period and againest year) you can see YTD values for specified period.

    create a restricted keyfigure and restrict againest year(equal to) - should be derived from period and restrict againest period(less than & equal to).

    Hope it Helps

    Srini

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2007 at 01:50 PM

    Hi

    Do you have fiscal year variant

    Fiscal year variant determines how the posting periods are managed in the given fiscal year.If Fiscal year variant is maintained, it classifies the fiscal year into different periods like four quarters to a 0CALQUARTER. It may even manage shorter posting period periods like monthly, or shorter fiscal years

    Presence of 0FISCVARIANT will solve your problem

    Otherwise, what will be the reference for 0CALQUARTER on a year-on-year report if you just take Fiscal year and fiscal period ( If associated fiscal year variant is available,you can calculate as mentioned above)

    If the user is going to enter any value from which you have to calculate YTD, how restricted key figure can be useful? Customer exit with variable is required in case user enters a value for the output

    Regards

    N Ganesh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2007 at 01:52 PM

    Hi Sumit,

    can you give me the SAP exit code for calculating the YTD from the fiscal year and fiscal period

    kumar

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Ravi

      Create the variable for fiscal period as (single value , Mandatory) with processing type customer exit.

      the customer exit code for the period YTD is below..

      WHEN = 'your new variable'

      CLEAR: L_S_RANGE,

      LD_CURDATE,

      LD_POPER_1,

      LD_POPER_1_S,

      LD_POPER_2,

      LD_POPER_2_S,

      LD_FISCYEAR_1,

      LD_FISCYEAR_1_S,

      LD_FISCYEAR_2,

      LD_FISCYEAR_2_S.

      LD_CURDATE = SY-DATUM.

      CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'

      EXPORTING

      I_DATE = LD_CURDATE

      I_PERIV = 'UB'

      IMPORTING

      E_BUPER = LD_POPER_1

      E_GJAHR = LD_FISCYEAR_1

      EXCEPTIONS

      INPUT_FALSE = 1

      T009_NOTFOUND = 2

      T009B_NOTFOUND = 3

      OTHERS = 4.

      IF SY-SUBRC EQ 0.

      LD_POPER_1_S = LD_POPER_1.

      LD_FISCYEAR_1 = LD_FISCYEAR_1.

      LD_FISCYEAR_1_S = LD_FISCYEAR_1.

      LD_POPER_2_S = '001'.

      LD_FISCYEAR_2 = LD_FISCYEAR_1.

      LD_FISCYEAR_2_S = LD_FISCYEAR_2.

      L_S_RANGE-SIGN = 'I'.

      L_S_RANGE-OPT = 'BT'.

      L_S_RANGE-LOW = '0000000'.

      L_S_RANGE-HIGH = '0000000'.

      L_S_RANGE-HIGH(4) = LD_FISCYEAR_1_S.

      WRITE LD_POPER_1_S TO L_S_RANGE-HIGH+4(3) RIGHT-JUSTIFIED.

      L_S_RANGE-LOW(4) = LD_FISCYEAR_2_S.

      WRITE LD_POPER_2_S TO L_S_RANGE-LOW+4(3) RIGHT-JUSTIFIED.

      APPEND L_S_RANGE TO E_T_RANGE.

      ENDIF.

      Hope It Helps, Please assign points if it helps...

      Regards

  • author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2007 at 03:34 PM

    Let ZVCCYTDX be d tech name of d Exit Variable & ZVCPAXRG be the user entered variable for Fiscal Year Period.

    <b>----


    *

    User Exit: ZVCCYTDX

    • Input: ZVCPAXRG

    • Output: Jan of Accident Year Range

    • Logic Description:

    ----


    WHEN 'ZVCCYTDX'.

    if i_step = 2.

    clear loc_var_range.

    loop at i_t_var_range into loc_var_range WHERE vnam = 'ZVCPAXRG'.

    • if sy-subrc = 0.

    curr_year = loc_var_range-low(4).

    concatenate curr_year '001' into jan_accidentyear.

    CLEAR L_S_RANGE.

    L_S_RANGE-LOW = jan_accidentyear.

    L_S_RANGE-SIGN = 'I'.

    L_S_RANGE-OPT = 'EQ'.

    append l_s_range to e_t_range.

    exit.

    **endif.

    endloop.

    endif.</b>

    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.