Skip to Content
0
Former Member
Nov 22, 2011 at 08:59 AM

Customer Exit for MTD

86 Views

Hi,

My requirement is to create Customer exit variable to calculate the Month to date (MTD) value (Quantity) in a query. I created a Customer exit variable for MTD (0CALDAY) in Query & wrote code in CMOD for the same as follows.

DATA: ZYEAR(4) TYPE N,

ZMON(2) TYPE N,

ZDAY(2) TYPE N.

CASE I_VNAM.

WHEN 'ZVCE_MTD'.

IF I_STEP = 2.

REFRESH E_T_RANGE.

LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE.

ZYEAR = LOC_VAR_RANGE-LOW+0(4).

ZMON = LOC_VAR_RANGE-LOW+4(2).

ZDAY = LOC_VAR_RANGE-LOW+6(2).

CLEAR L_S_RANGE.

CONCATENATE ZYEAR ZMON '01' INTO L_S_RANGE-LOW.

CONCATENATE ZYEAR ZMON ZDAY INTO L_S_RANGE-HIGH.

L_S_RANGE-SIGN = 'I'.

L_S_RANGE-OPT = 'BT'.

APPEND L_S_RANGE TO E_T_RANGE.

EXIT.

ENDLOOP.

ENDIF.

ENDCASE.

I debugged this code by putting a break point & running the query in RSRT, the code is getting executed & i am getting the From & To dates in E_T_RANGE output.

But when I execute the Query, I am getting the output Quantity for FTD only, not MTD.

For example, if i give 05-12-2009 as variable input for 0CALDAY when i execute the query, i should get the summed up quantity for 01 Dec to 05 Dec in a single cell. But now, i am getting the summed up quantity for 05 Dec only.

Help me in resolving this.

Regards,

Murali