cancel
Showing results for 
Search instead for 
Did you mean: 

BEx query_Calculated key figure

Former Member
0 Kudos

Hi ,

I have CalMonth/Year as the time characteristics and Sales amount as keyfigure.When is give a particular month in prompt ie.,Say September ,it should calculate the sales of previus months ie.,Jan to August...and so on ...If April then Jan to March...How do I design it in BEx query designer?Kindly help

Thanks,

Arun Uday

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Arun,

You will have to design this using Customer Exit Variable in following way,

1) Create a customer exit type variable on 0CALMONTH and make it "ready to input" also.

2) Create a RKF with 0CALMONTH and restrict it with newly created customer Exit variable and include your key figure i.e. sales amount in same RKF.

3) Now we will have to do coding in Customer Exit in following manner,

When 'Variable create on calmonth'.

If I_step = '2'.

Data: lv_year type i,

lv_month type i.

loop at i_t_var into wa_var where vname = 'Variable created on calmonth'.

lv_year = wa_var+0(4).

lv_month = wa_var+4(2).

  • Now populate the required value in 0calmonth variable.

concatenate '01' lv_year into l_wa_data-low.

l_wa_data-sign = 'I'.

l_wa_data-option = 'BT'.

l_wa_data-high = wa_var-high.

append l_wa_data to e_t_data.

exit.

endif.

Regards,

Durgesh.

Former Member
0 Kudos

Hi Durgesh,

Thanks for your reply!

I have another concern.

My fiscal period starts in July. So what ever month I give it should calculate from July..

For eg:

If I am giving January 2011-Then the output should be from July 2010.

Kindly help me on this too.

Thanks,

Arun Uday

Former Member
0 Kudos

Hi Arun,

Let us say that your user input is 0Fiscper and user enters January 2011 i.e. 007.2011, then you can apply following logic.

wa_var is your input variable value.

input_year = wa_var+0(4).

input_month = wa_var+4(3).

if input_month >= 6.

lv_year = input_year - 1.

else.

lv_year = input_year.

endif.

lv_month = 001.

concatenate lv_month lv_year into l_wa_data-low.

l_wa_data-high = wa_var.

rest of the things will be as usual.

Regards,

Durgesh.

Answers (0)