Skip to Content
0
Former Member
Oct 05, 2009 at 07:10 AM

MTD Variable

20 Views

I have written a code in CMOD for calculating Month to date (MTD). I have created 2 variables in BEX - ZPUTMTH and ZPDATE. I am passing the date in ZPDATE.

For some reason it is not working. I dragged a key figure and restricted it with ZPDATE variable and executed the report. I got the selection screen and I enterd a date. It is just showing me the values for the date entered and not MTD.

Here is the code:

-


DATA: L_S_RANGE TYPE RSR_S_RANGESID.

DATA: LOC_VAR_RANGE LIKE RRRANGEEXIT.

Data: v_loc_date type d.

Data: v_loc_date1 type d.

Data: v_loc(4) type c.

CASE I_VNAM.

*----


  • to calculate "month to date" user input is "Calday" Key Date

*----


WHEN 'ZPUTMTH'.

IF I_STEP = 2. "after the popup

LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE

WHERE VNAM = 'ZPDATE'.

CLEAR L_S_RANGE.

L_S_RANGE-LOW = LOC_VAR_RANGE-LOW(6).

L_S_RANGE-LOW+6(2) = '01'.

L_S_RANGE-HIGH = LOC_VAR_RANGE-LOW.

L_S_RANGE-SIGN = 'I'.

L_S_RANGE-OPT = 'BT'.

APPEND L_S_RANGE TO E_T_RANGE.

EXIT.

ENDLOOP.

ENDIF.

Edited by: Rohini Khurana on Oct 5, 2009 9:10 AM

Edited by: Rohini Khurana on Oct 5, 2009 9:26 AM