cancel
Showing results for 
Search instead for 
Did you mean: 

calday YTD, MTD in Query Designer

former_member407089
Participant
0 Kudos

I have to show daily sell in a company + sell value from the beginning of the month, and from the beginning of the year.

how to get YTD and MTD values for specified day i Query Designer. I know I need to create variables that will work on calday, but how to do it?

Edited by: Andrzej Szaranek on Jun 2, 2011 2:09 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Andrzej

You cancheck out the below SDN thread for the MTD, YTD requirement as required by you.

Also you would find the below How-to guide for MTD, YTD calculation very helpful:

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/25d98cf6-0d01-0010-0e9b-edcd45973...

Hope this helps.

Regards,

Ninad

Answers (1)

Answers (1)

Former Member
0 Kudos

You need to create 3 input variables on calday .

1st will be a manual input ,mandatory field for e.g. : 'year'

and other two will be customer exits and intervals one for year to date and other for monthe to date .

For Year to Date :

Data :L_year type i ,

L_date type d .

.

for year to date the code should be like ,

IF i_step = 2.

CLEAR loc_var_range.

READ TABLE i_t_var_range INTO loc_var_range

WITH KEY vnam = 'year'

L_year = LOC_VAR_RANGE +0(4).

concatenate L_year '0101' into L_date.

L_S_RANGE-LOW = L_date .

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.

for Month to Date :

ata :L_month type i ,

L_date type d .

.

for year to date the code should be like ,

IF i_step = 2.

CLEAR loc_var_range.

READ TABLE i_t_var_range INTO loc_var_range

WITH KEY vnam = 'year'

L_month = LOC_VAR_RANGE +0(6) .

concatenate L_Month '01' into L_date.

L_S_RANGE-LOW = L_date .

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.

Restrict the keyfigures of month to date and year to date with this customer exits respectively