cancel
Showing results for 
Search instead for 
Did you mean: 

Request for YTD Average at Bex query Level

0 Kudos

Hi All,

My requirement is to get the avg qty for YTD.


I tried going thru many posts but cannot find the required solution.


I have written code in cmod to get the no.of days based on calday input, can anyone help me how to use this customer exit in the query designer so as to get the avg quantity for the year.


I have tried different approaches and was unsuccessful, If any one can provide me with screen shots to maintain at query level would be much helpful


Thanks in Advance


Code used in the Query


WHEN 'ZNUMMTD'.

     IF I_STEP = 2. "after the popup

       LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE

       WHERE VNAM = 'ZMPDATE'." User Input (For Ex: 20160205 YYYYMMDD)

         CLEAR L_S_RANGE.

         LV_DATE1 = LOC_VAR_RANGE-LOW." Range High (For Ex: 20160205 YYYYMMDD)

         LV_DATE = LOC_VAR_RANGE-LOW.

         LV_DATE+6(2) = '01'." Range Low (For Ex: 20160205 YYYYMMDD)

         V_LOC_DATE = LV_DATE1 - LV_DATE." DIfference between Start date and end date

         L_S_RANGE-LOW = V_LOC_DATE.

         L_S_RANGE-SIGN = 'I'.

         L_S_RANGE-OPT = 'EQ'.

         APPEND L_S_RANGE TO E_T_RANGE.

         EXIT.

       ENDLOOP.

     ENDIF.




Regards,

Madhu

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi All,

for the above issue i used the above code and created a restricted keyfigure as below.

1. create a rkf for the required keyfigure with restriction on no of days(MTD ) logic same as above, change the opt from  eq to bt and pass high and low value as above.

2. Create a CKF with formula variable.

     Formula variable name should be same of customer exit name.

3. create another ckf to calculate the avg as RKF created in first step/ckf created in second step.

Same steps can be used for the YTD and YTD avg also

Thanks,

Madhu

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Madhu,

The above thread will be helpful for you.

Regards,

Gopal