cancel
Showing results for 
Search instead for 
Did you mean: 

HOW TO GET FISCAL PERIOD WISE DATA BY GIVING FISCAL YEAR AS INPUT

Former Member
0 Kudos

Hi All,

I am creating a report where input field is FiscYear(0FISCYEAR). My fiscal year is Oct to Sep and 4 spl periods.

  If we give input as 2014 (current FY) it has to show all fiscal periods as on date. i.e., Oct’13 to Feb’14.  Which should show in columns each period
separately, like Oct 13, Nov’13, …. Feb’14.

   If we give 2013, it has to show all fiscal periods separately each period in columns. i.e., Oct’12 to Sep’13.

InfoProvider Data: We have a cube, containing data for 0CALMONTH and Fiscal Year. No fiscperiod in the cube.

  Could any one assist here as it’s a bit odd scenario never come across. All your suggestions and assistance are highly appreciable.

Best Regards

Venkat...

Accepted Solutions (1)

Accepted Solutions (1)

anshu_lilhori
Active Contributor
0 Kudos

First you need to tell the relation between fiscal year period and calmonth..

Please understand you can display the data based on calmonth only as you do not have fiscal year period wise data.

Based on the year input we can fetch the data as required.

Regards,

AL

Former Member
0 Kudos

Thank you so much Anshu.

Yes, you are exactly correct as we always displays calmonth's data only. Here my doubt is how can achieve the month wise data by passing the fiscal year. Could you pls show me a light on this.

Best Regards

Venkat...

anshu_lilhori
Active Contributor
0 Kudos

If you let me know the relation between fiscal year and calmonth then it will be easy for me to get the logic.

Assuming if you have one is to one relation like if month is 01.2014 then fiscal year period will also be 001.2014 this is the case when you use K4 variant.

So now assuming that is the relation and as you described in your post that if the year is current then you need data from Sep'13 to feb'14 and if its other than current year then the complete data from sep to oct.

You can restrict the calmonth with a cmod variable of type interval.

Create a dummy kf--and restrict with user input variable on fiscal year.

Now based on this user will value we will populate the data in 0calmonth variable.

Hope this gives an idea.

Regards,

AL

Former Member
0 Kudos

We are following Oct to Sep fiscal year. Relation between calmonth and fiscal year period are as follows.

FYP               Calmonth

001.2013       10.2012

002.2013       11.2012

012.2013       09.2013

Hope this is clear. As you said, I will define a dummy KY which is restricted on FY (user input). One more variable on 0CALMONTH with interval.  Here the logic is bit confusing. whether to compare the FY (user input) value to sy-datum+0(4) or calmonth = sy-datum+0(6). Can you pls confirm, am I correct?

Best Regards

Venkat...

anshu_lilhori
Active Contributor
0 Kudos

Yes so far seems to be correct.You need to compare fiscal year with sy-datum+0(4)

If that is equal to it then get the data from 201310 to whichever month you need as per your requirement.

It that is not equal then get the data from 201210 to 201309.

Hope it gets you the desired result.

Regards,

AL

Former Member
0 Kudos

Here are 2 challenges we may face.

1. If the user is giving any random FY, say 2009, that time it may not work. So we need to check the given FY in all cases except the given FY is greater than curretn FY.

2. We have to show this data month wise in columns as below.

If the variable value is: 2013.10 (Oct-13), 2013.11 (Nov-13),  2013.12 (Dec-13) and so on....

Final display in column looks like Oct-13          Nov-13       Dec-13 till current month for current fiscal year and all months for any previous years.

I am not pretty sure, how we can achieve this. It would be great if anyone suggest the work around. Thank you in advance!

Best Regards

Venkat...

anshu_lilhori
Active Contributor
0 Kudos

Let me be more precise in my understanding of your requirement.

I would suggest to put calmonth above the column structure.With the code we will restrict the data and also will make it dynamic in nature which i guess is required in your case.

Suppose if user enter 2013 then you need data from 0ct-12 to sep-13 correct.

And if they enter 2014 then you need to display data from oct-13 to current month or current month-1.

It will work in all cases..and if user is entering 2009 then arent you expecting data from 0ct-08 to sep-09.

Please confirm the same.

Regards,

AL

Former Member
0 Kudos

Yes, that is what we required. Ok, I will add the 0CALMONTH in the columns pane above the KF structure.Thank you so much for your time and patience Anshu. Could you pls suggest any idea on the logic for dynamic values.

Best Regards

Venkat...

anshu_lilhori
Active Contributor
0 Kudos

Ok i can provide you a rough code.


DATA:YY type /BI0/OICALYEAR,

         PY type /BI0/OICALYEAR,

         MM(2) type n.

WHEN 'VAR1'.---Cmod variable on 0calmonth

     READ TABLE i_t_var_range INTO loc_var_range WITH KEY vnam = 'VAR2'.--User input variable on fiscal year

      IF sy-subrc = 0.

       YY =loc_var_range-low.

       PY = loc_var_range-low - 1.

       MM = SY-DATUM+4(2).

IF SY-DATUM+0(4) = YY.

      

        Concatenate PY '10' into l_s_range-low.

        Concatenate YY  MM  into l_s_range-high.

      ELSE.

       Concatenate PY '10' into l_s_range-low.

       Concatenate YY '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.

Hope this helps.

Regards,

AL

Former Member
0 Kudos

Thank you a lot Anshu.

I will try and update. Once again thank you for your time and the concern.

Best Regards

Venkat...

Former Member
0 Kudos

Hi Anshu,

I am getting the below error when I try to execute in Analyser.

"No value could be determined for variable". Here is my code in CMOD.

*-----------------------------------------------------------------------

*Variables for ESAS Project

*-----------------------------------------------------------------------

DATA: curr_yy TYPE /BI0/OICALYEAR,

      input_yy TYPE /BI0/OICALYEAR,

      prev_yy TYPE /BI0/OICALYEAR,

      zmonth(2) TYPE N.

WHEN 'ZCALMONTH_ESAS'.

    IF i_step = 2. "tried with i_step 1 also, same error message is showing



READ TABLE i_t_var_range INTO loc_var_range

          WITH KEY vnam = 'ZFISCYEAR_ESAS'.

IF sy-subrc EQ 0.

  curr_yy = loc_var_range.

  prev_yy = curr_yy - 1.

  zmonth = SY-DATUM+4(2).

  IF SY-DATUM+0(4) = curr_yy.

    CONCATENATE prev_yy '10' into l_s_range-low.

    CONCATENATE curr_yy month into l_s_range-high.

  ELSEIF prev_yy EQ loc_var_range.

    input_yy = loc_var_range.

    prev_yy = input_yy - 1.



    CONCATENATE prev_yy '10' INTO l_s_range-low.

    CONCATENATE input_yy '09' INTO l_s_range-high.

  ENDIF.

    l_s_range-opt = 'BT'.

    l_s_range-sign = 'I'.



APPEND l_s_range TO e_t_range.

ENDIF.

ENDIF.

Everything is fine in CMOD. However, its giving error in execution. Any idea on this pls...

Best Regards

Venkat...

anshu_lilhori
Active Contributor
0 Kudos

curr_yy = loc_var_range-low.


Write the else part as i describe in my code.

Your user input variable is single entry correct.

And your cmond variable on calmonth is interval type--mandatory.and not ready for input.

ALso try to debug the code and see if the values are getting populated accordingly or not.

Regards,

AL

Former Member
0 Kudos

Yes, single entry and cmod variable calmonth is interval type.

Best Regards

Venkat...

anshu_lilhori
Active Contributor
0 Kudos

I have tested the code on my system and its working perfectly.

Make sure to write the code in the same format as i have written.Moreover also make sure to give the correct technical name of variables with caps on.

Regards,

AL

Former Member
0 Kudos

Thank you very much!!!,  Anshu. Its working fine. Highly appreciating your patience and the apt solution given.

Best Regards

Venkat...

Answers (1)

Answers (1)

former_member182470
Active Contributor
0 Kudos

You need to enhance your cube by Fiscper and populate the data to it. You may write small field level routine to convert to fiscper from your available source time char.

After that you can keep Fiscyear(User entry based variable) in Filter. Drag Fiscper to KF pane and put your KF under it like umbrella. This will split into all periods accordingly.

Former Member
0 Kudos

Thank you for your reply Suman.

I guess, Anshu's cmod work around will work. I will try that and update the post accordingly.

Best Regards

Venkat...