cancel
Showing results for 
Search instead for 
Did you mean: 

Fiscal YTD Variable

Former Member
0 Kudos

I need to calculate the Month to date and Year to date from my fiscal calendar, if the end date is given as a variable user input.

Eg.,

If my end date variable1 --> was 01Aug 07 and end date 2 --> 01Aug 08

Output

AUG 08 AUG 07 VAR

$400 $500 $100

Pls send me your insights!!

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Please follow the following steps for MTD:

1.You can create a variable on Calendar Day which is of type "manual Input/default values".In the "Details tab check-"Mandatory" and it should be of type "single value".

Say variable name is ZDAY.

Now you can restrict your query with this variable.

So you would get a screen where the user can enter a date.

2.Now create another variable on Calendar Year/Month which is of type "Customer Exit".In the "Details" tab check-"Mandatory" and it should be of type "single value".

Say variable name is ZMTD.

3.You can create a restricted keyfigure using your keyfigure and restricting it with ZMTD.

4.Go to CMOD-->Proceed to your customer exit code and you can add this code:

******************************************************

when 'ZMTD'.

data: loc_var_range LIKE RRRANGEEXIT,

d type sy-datum.

If i_step = 2.

loop at i_t_var_range into loc_var_range where vnam = 'ZDAY' .

d = loc_var_range-low(6).

clear ra_l_s_range.

ra_l_s_range-low = d.

ra_l_s_range-high = d.

ra_l_s_range-sign = 'I'.

ra_l_s_range-opt = 'EQ'.

APPEND RA_L_S_RANGE TO E_T_RANGE.

endloop.

endif.

*******************************************************

Similarly you can create another variable on calendar year for YTD and use it in the restriction for keyfigure.

You can also refer the link:

<<https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/25d98cf6-0d01-0010-0e9b-edcd4597335a>>

Thanks,

Divya.

Former Member
0 Kudos

Hi,

SAP has provide the YTD variables check it ( can't remember the name right now).

Best Regards,

Hima

Former Member
0 Kudos

Thanks Hima. But the SAP delivered YTD would calculate from the current system date, correct?

But I need to customize it, so that when I enter any fiscal date it should calculate from the beginning of the year to the entered date

Edited by: Raadooo on Sep 30, 2008 2:21 AM