
In this section you can find examples for using variables.
You want to use a query to carry out a comparison of two years.
Year Comparison
You want to compare the costs of a year of your choice with the costs of the previous year.
Select the characteristic value variables for Calendar Year and choose New Variable from the context menu (secondary mouse button). The new variable is displayed. Choose Edit from the context menu of the new variable. The variables editor appears. For more information, seeDefining Variables.
If you always want to reference the current year automatically, use the SAP exit variable 0CALYEAR (or as appropriate for another time characteristic).
Example: Use the name of the key figure (for example, sales) for the name and use a text variable for the name of the calendar year. SeeUsing Text Variables.
When creating a new text variable, enter Replacement Path as the processing type and choose calendar year 0CALYEAR as the characteristic, with display as key.
Also use a text variable in the description in this case.
After execution, the query should appear as follows:
Variable screen entry: 2002 (or no entry when using the SAP exit variable).
Year Comparison
| Characteristic | Sales 2001 | Sales 2002 |
|---|---|---|
|
Value 1 |
100,000 |
90,000 |
|
Value 2 |
200,000 |
180,000 |
|
Value 3 |
300,000 |
400,000 |
|
… |
… |
… |
Comparison with Cumulative Previous Year Period
Example: You want to compare the periods 1-8 of a particular year with the same periods for the previous year.
Select the characteristic value variables for Fiscal Year/Period and choose New Variable from the context menu (secondary mouse button). The new variable is displayed. Choose Edit from the context menu of the new variable. The variables editor appears. For more information, seeDefining Variables.
Use the SAP exit variable Current Fiscal Year/Period (0FPER) if you always want to reference the current year. If you set the variable as input-ready in the variables editor, the variables screen appears when you execute the query. You can change the default values here if necessary.
Also use a text variable in the description in this case.
When you execute it the query should appear as follows:
Variable screen entry: 01. 2002 to 08. 2002
Comparison with Cumulative Previous Year Period
|
Characteristic |
Sales 01. - 08. 2001 |
Sales 01. - 08. 2002 |
|
Value 1 |
100,000 |
90,000 |
|
Value 2 |
200,000 |
180,000 |
|
Value 3 |
300,000 |
400,000 |
|
... |
... |
... |
Two text variables replaced with characteristic values were used for the descriptions here. One is filled with the From value for the column with an offset of 0 and a length of 3 and the other is filled with the To value with an offset of 0 and a length of 7. For more information, seeVariable Replacement Example.
Comparison of Cumulated Values for Two Years
You may want to compare the cumulated values up to the current period of the current year with those of the previous year.
For this example, use the variable 0FPER (current fiscal year period) and the variable 0P_FPER (your chosen fiscal year period). You use these two variables to set the interval limits.
Select the interval and choose Enter Variable Offsets from the context menu (secondary mouse button). Enter -12 for each.
The result is an interval that has been moved 12 periods ahead.
When you execute the query, you get a variable screen for the variable 0P_FPER. You need to enter the start period in the current fiscal year here.
You can also suppress this entry by deactivating the indicator Input-Ready in the variables editor for the variable 0P_FPER and entering a default value (for example, 001.2001 for 2001). You only have to change this value once per year.
You have now defined a query that compares the cumulative values for two years.
The variables delivered by SAP with SAP exit behave as follows:
Variable 0FPER (current fiscal year period): Displays the values of the current fiscal year period.
Variable 0P_FPER (any fiscal year period): Displays the values of any fiscal year period. You can set the fiscal year period in the variables screen when executing the query in any way you require.
Variable 0FYTCFP (fiscal year up to current fiscal year period): Displays the values of the first period up to the current period of the current fiscal year.
Variable 0FYTLFP (fiscal year up to previous fiscal year period): Displays the values of the first period up to the previous period (current period -1).
You need to use the variables 0FPER and 0P_FPER in the above example for the comparison of cumulative values for two years. When using the variables 0FYTCFP and 0FYTLFP, only values for one month are displayed for year transitions with an offset of -12.