Skip to Content
0
Mar 27, 2014 at 05:05 AM

Quarter calculations based on input month in formula variable customer exit

100 Views

Hello,

I have a requirement to calculate different quarters (Q1, Q2, Q3, Q4) based on input month from the user.

If user selects Period 01.2014

Q1 = Jan + Feb + Mar / 1

If user selects Period 03.2014

Q1 = Jan + Feb + Mar / 3

If user selects Period 04.2014

Q2 = Apr + May + Jun / 1

I have created a formula variable ( ZFV) and insert this into my calculation ( Q1 = JAN + FEB + MAR / ZFV ) and wrote a customer exit

Customer EXIT

..........................................................................................................................................................................................

WHEN 'ZFV'. “formula variable

DATA znum(2) type n.

IF i_step = 2.

CLEAR l_s_range.

LOOP AT i_t_var_range INTO loc_var_range


WHERE vnam = 'ZINPUT_MONTH'. “input month from the user


CASE loc_var_range-low+4(2).

WHEN '01' OR '04' OR '07' OR '10'.
znum = '01'.

WHEN '02' OR '05' OR '08' OR '11'.

znum = '02'.

WHEN '03' OR '06' OR '09' OR '12'.

znum = '03'.

ENDCASE.


l_s_range-low = 'znum'. “This should be the value for the division on quarters
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
APPEND l_s_range TO e_t_range.
ENDLOOP.


ENDIF.


.................................................................................................



But I got empty values. does any one know how I can resolve it or if there are other solutions.


thanks

Bhat