You are on page 1of 31

win

How To Create Customer measure formulas for Fiscal Periodic, QTD and YTD
SAP Product Name: Applicable Product Versions: Document Version Last Updated: SAP Business Planning and Consolidation , version for NetWeaver 7.0 SP2 and above 1.0 Apr, 2009

Enterprise Performance Management


www.sdn.sap.com/irj/sdn/bpx-cpm

Copyright 2009 SAP AG. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. Microsoft, Windows, Outlook,and PowerPointare registered trademarks of Microsoft Corporation. IBM, DB2, DB2 Universal Database, OS/2, Parallel Sysplex, MVS/ESA, AIX, S/390, AS/400, OS/390, OS/400, iSeries, pSeries, xSeries, zSeries, z/OS, AFP, Intelligent Miner, WebSphere, Netfinity, Tivoli, and Informix are trademarks or registered trademarks of IBM Corporation in the United States and/or other countries. Oracle is a registered trademark of Oracle Corporation. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc. HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C, World Wide Web Consortium, Massachusetts Institute of Technology. Java is a registered trademark of Sun Microsystems, Inc. JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. MaxDB is a trademark of MySQL AB, Sweden. SAP, R/3, mySAP, mySAP.com, xApps, xApp, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data

contained in this document serves informational purposes only. National product specifications may vary. These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty. These materials are provided as is without a warranty of any kind, either express or implied, including but not limited to, the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. SAP shall not be liable for damages of any kind including without limitation direct, special, indirect, or consequential damages that may result from the use of these materials. SAP does not warrant the accuracy or completeness of the information, text, graphics, links or other items contained within these materials. SAP has no control over the information that you may access through the use of hot links contained in these materials and does not endorse your use of third party web pages nor provide any warranty whatsoever relating to third party web pages. SAP How-to Guides are intended to simplify the product implementation. While specific product features and procedures typically are explained in a practical business context, it is not implied that those features and procedures are the only approach in solving a specific business problem using SAP products. Should you wish to receive additional information, clarification or support, please refer to SAP Consulting. Any software coding and/or code lines / strings (Code) included in this documentation are only examples and are not intended to be used in a productive system environment. The Code is only intended better explain and visualize the syntax and phrasing rules of certain coding. SAP does not warrant the correctness and completeness of the Code given herein, and SAP shall not be liable for errors or damages caused by the usage of the Code, except if such damages were caused by SAP intentionally or grossly negligent.

1 Scenario
Today, within BPC NW, there exist the concept of measure formulas to be used within applications for reporting. This guide will show how to customize these measure formulas and create your own. The delivered (system generated) Periodic & QTD measures in an YTD Storage type application work only for calendars which start with January (JAN). In this how to, we will create custom periodic & QTD measures for the calendar which does not begin in January.

2 Introduction
Customers can have YTD Storage type application which allows to input/store YTD measure. In this type of application, Periodic & QTD are derived through measure formula. The default measure formula created for Period & QTD in this type of application works for the calendar which starts in January. However, customers may have fiscal calendar which does not start in January. This how to guide walks through step-by-step implementation of custom measure. This solution is applicable for SAP Business Planning and Consolidation 7.0 Version for NetWeaver SP02 & higher.

3 Prerequisites
An installed & implemented SAP Business Planning and Consolidation 7.0, Version for NetWeaver SP02 & higher. SAP ABAP layer access Knowledge in MDX syntax.

4 Restrictions of Measure Maintenance Program


Pre-delivered measures cannot be deleted Pre-delivered PERIODIC on a Periodic cube and YTD on a YTD cube measures cannot be changed. Other measures can be changed at your own risk. Note that these changes will be overwritten when you make any changes from Admin client for that application. SAP advises to create your own custom measures instead of changing the pre-delivered measures. Formula names cannot be duplicated Formula names must be entered in upper case Usage of Parent node inside the formula is not supported.

5 The Step By Step Solution - Set up YTD Storage Application.


In this section, we will create a YTD storage application. We will create a YTD application by copying PLANNING application delivered in APSHELL
1. Launch BPC AdminClient.

2. Choose your AppSet

3. Click on Application

4. Then, click on Add a new application or Copy an Application if you want to use any existing application. Here, we will copy from PLANNING application of APSHELL.

5. Choose the existing application to duplicate as PLANNING and provide name & description for the new application and click on Copy an Application.

6. System will create the new application.

7. Now, open internet explorer and Launch the Web Admin client. User you server URL (typically, http://<your server:port>/osoft/Admin)

8. Then, go to the application which we just created by clicking on CV application and changing to YTD_PLANNING application.

9. Then, click OK.

10. Then, Click on Set Application Parameters. If you are not seeing this option, you dont have access to maintain the parameters.

11. Locate YTDINPUT parameter. Then, change to Yes.

12. Click on Update button to save this change. Now, we completed to set up a YTD Application.

13. Make sure that your security is adjusted to have access to members of this application. In this example, we do not secure any members. To do this, choose the application we just created and click on Modify Application.

14. Secured Dimensions have Y on the secured column.

15. Choose each dimension and click Secured button in the bottom to remove the security on these dimensions. Then, click on Modify Application to save the changes.

6 The Step By Step Solution Create Custom measures


You can create the custom measures either hard-coding your start period (not year) in the measure formula or creating an additional property in the TIME dimension which has your periods maintained & using this in the custom measure. Here, we will show both the methods. 6.1 Hard-coding the start period in the custom measure

1. Log in ABAP layer from SAP Logon pad.

2. Once logged in, go to transaction SE38.

3. Type UJA_MAINTAIN_MEASURE_FOR MULA as program name and click execute button. If you dont have this program in your system, you will have to upgrade to Support Package 02.

4. Provided AppSet, Application ID and user id. Then, click Execute.

5. In the next screen, double click on Periodic. Here, you can see that first period is assumed as JAN. We will use this measure as template for the custom measure.

6. Copy the measure formula from the previous screen and paste in a notepad.

7. Go back to measure formula maintenance program and click on Create .

8. Provide Name and Description. Then, paste the measure formula from notepad in the Formula box.

9. Locate the JAN period in the formula and change to your first period of your calendar

10. For this example, we changed this to MAY.

11. Locate the PERIODIC measure name.

12. Replace this with your custom measure name. In this case, we used CUSTOMPER

13. Click on Save formula.

button to save this

14. Now the formula will be saved successfully.

15. Repeat similar steps custom QTD Measures starting from pre-delivered QTD Measure. Here, we will be changing the period value first.

16. Then, wherever PERIODIC measure is referred, we will be replacing that with Custom Periodic measure name (in this case CUSTOMPER).

17. Then, change QTD measure name to your custom QTD name. We will use CUSTOMQTD in this example.

18. Then, save the formula.

The MDX codes of custom formulas created here are provided in the appendix.

6.2

Using a new property of TIME dimension

Here, we will a new property in TIME dimension where we will have to maintain each beginning period. In the measure formula, we will use this property to determine the first period of each year.
1. Go to Admin client for the AppSet you want to make change. Expand Dimension Library & locate your TIME dimension.

2. Click on Maintain dimension property.

3. Add a new property. In our example, we will add a property called BEGINPERIOD with length of one character. Please do not name this field as ISBEGINNING as this is reserved field name and SAP uses this field for other purpose.

4. Click on Modify Dimension Property to save the change.

5. Once completed, go to Maintain dimension members.

6. Maintain X for Beginning periods. In case of ApShell, this would be TOTAL, Q1, and beginning month for each year.

7. Once all years are maintained, save to server and process dimension.

8. Log in ABAP layer from SAP Logon pad.

9. We will need technical name of the field we added to refer this field in the formula. To find this, Go to transaction MDXTEST.

10. Choose Infoprovider as catalog. Then, locate you CUBE.

11. Expand TIME dimension and then, expand PROPERTIES.

12. Locate the property we added and drag and drop to right hand side window.

13. Technical name of the property is highlighted. Have this name copied to a notepad.

14. Go to transaction SE38.

15. Type UJA_MAINTAIN_MEASURE_FOR MULA as program name and click execute button. If you dont have this program in your system, you will have to upgrade to Support Package 02.

16. Provided AppSet, Application ID and user id. Then, click Execute.

17. In the next screen, double click on Periodic.

18. Copy the measure formula from the previous screen and paste in a notepad.

19. Go back to measure formula maintenance program and click on Create .

20. Provide Name and Description. Then, paste the measure formula from notepad in the Formula box.

21. Replace the PERIODIC measure name with your customer measure name.

22. Replace
([%TIME%].CURRENTMEMBER.PROPERT IES("2/CPMB/PERIOD")="TOTAL" OR [%TIME%].CURRENTMEMBER.PROPERTI ES("2/CPMB/PERIOD")="Q1" OR [%TIME%].CURRENTMEMBER.PROPERTI ES("2/CPMB/PERIOD")="JAN" )

With
([%TIME%].CURRENTMEMBER.PROPERT IES("<tech name>")="X"). <tech name> - technical name from step 13.

23. Press save.

24. Click OK.

25. Now, we will create QTD formula. Double-click on QTD formula.

26. Copy the formula to a notepad.

27. Click on Create button.

28. Provide Formula Name, Description and paste QTD formula from the notepad.

29. Change all the PERIODIC measures to custom measure name. In this example, this will be CUSTOMPER.

30. Change QTD measure name to your custom measure name. In this example, we will use CUSTOMQTD.

31. Replace
([%TIME%].CURRENTMEMBER.PROPERT IES("2/CPMB/PERIOD")="TOTAL" OR [%TIME%].CURRENTMEMBER.PROPERTI ES("2/CPMB/PERIOD")="Q1" OR [%TIME%].CURRENTMEMBER.PROPERTI ES("2/CPMB/PERIOD")="JAN" )

With
([%TIME%].CURRENTMEMBER.PROPERT IES("<tech name>")="X"). <tech name> - technical name from step 13.

32. Press save to save the formula.

33. Click OK to confirm.

34. Now, the custom measures are created.

Example Measure formula are provided in the appendix.

7 Appendix
Hard-coding first period in the measure formula: Elements in bold are changed from the standard formula. Periodic Formula:
MEMBER [MEASURES].[YTD] AS 'IIF(([%P_ACCT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="INC" OR [%P_ACCT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="LEQ"),([MEASURES].[/CPMB/SDATA], CLOSINGPERIOD([%TIME%].[LEVEL02])), ([MEASURES].[/CPMB/SDATA], CLOSINGPERIOD([%TIME%].[LEVEL02])))' SOLVE_ORDER=3##MEMBER [MEASURES].[CUSTOMPER] AS 'IIF(([%P_ACCT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="INC" OR [%P_ACCT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="EXP") AND NOT ([%TIME%].CURRENTMEMBER.PROPERTIES("2/CPMB/PERIOD")="TOTAL" OR [%TIME%].CURRENTMEMBER.PROPERTIES("2/CPMB/PERIOD")="Q1" OR [%TIME%].CURRENTMEMBER.PROPERTIES("2/CPMB/PERIOD")="MAY" ), [MEASURES].[YTD]([MEASURES].[YTD],[%TIME%].LAG(1)), [MEASURES].[YTD])' SOLVE_ORDER=3

QTD Formula:
MEMBER [MEASURES].[YTD] AS 'IIF(([%P_ACCT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="INC" OR [%P_ACCT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="LEQ"),([MEASURES].[/CPMB/SDATA], CLOSINGPERIOD([%TIME%].[LEVEL02])), ([MEASURES].[/CPMB/SDATA], CLOSINGPERIOD([%TIME%].[LEVEL02])))' SOLVE_ORDER=3##MEMBER [MEASURES].[CUSTOMPER] AS 'IIF(([%P_ACCT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="INC" OR [%P_ACCT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="EXP") AND NOT ([%TIME%].CURRENTMEMBER.PROPERTIES("2/CPMB/PERIOD")="TOTAL" OR [%TIME%].CURRENTMEMBER.PROPERTIES("2/CPMB/PERIOD")="Q1" OR [%TIME%].CURRENTMEMBER.PROPERTIES("2/CPMB/PERIOD")="MAY" ), [MEASURES].[YTD]([MEASURES].[YTD],[%TIME%].LAG(1)), [MEASURES].[YTD])' SOLVE_ORDER=3## MEMBER [MEASURES].[CUSTOMQTD] AS 'IIF(([%P_ACCT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="INC" OR [%P_ACCT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="EXP"),IIF([%TIME%].CURREN TMEMBER.PROPERTIES("2/CPMB/TILEVEL")="QUARTER",[MEASURES].[CUSTOMPER],IIF([%TIME% ].CURRENTMEMBER.PROPERTIES("2/CPMB/TILEVEL")="MONTH" OR [%TIME%].CURRENTMEMBER.PROPERTIES("2/CPMB/TILEVEL")="WEEK" OR [%TIME%].CURRENTMEMBER.PROPERTIES("2/CPMB/TILEVEL")="DAY",SUM(PERIODSTODATE([%T IME%].CURRENTMEMBER.PARENT.LEVEL, [%TIME%].CURRENTMEMBER),[MEASURES].[CUSTOMPER]),NULL)),[MEASURES].[YTD])' SOLVE_ORDER = 3

Using TIME dimensions property in the measure formula: Elements in bold are changed from the standard formula. Periodic Formula:
MEMBER [MEASURES].[YTD] AS 'IIF(([%P_ACCT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="INC" OR [%P_ACCT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="LEQ"),([MEASURES].[/CPMB/SDATA], CLOSINGPERIOD([%TIME%].[LEVEL02])), ([MEASURES].[/CPMB/SDATA], CLOSINGPERIOD([%TIME%].[LEVEL02])))' SOLVE_ORDER=3##MEMBER [MEASURES].[CUSTOMPER] AS

'IIF(([%P_ACCT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="INC" OR [%P_ACCT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="EXP") AND NOT ([%TIME%].CURRENTMEMBER.PROPERTIES("2/CPMB/MOPOFSI")="X"), [MEASURES].[YTD]([MEASURES].[YTD],[%TIME%].LAG(1)), [MEASURES].[YTD])' SOLVE_ORDER=3

QTD Formula:
MEMBER [MEASURES].[YTD] AS 'IIF(([%P_ACCT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="INC" OR [%P_ACCT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="LEQ"),([MEASURES].[/CPMB/SDATA], CLOSINGPERIOD([%TIME%].[LEVEL02])), ([MEASURES].[/CPMB/SDATA], CLOSINGPERIOD([%TIME%].[LEVEL02])))' SOLVE_ORDER=3##MEMBER [MEASURES].[CUSTOMPER] AS 'IIF(([%P_ACCT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="INC" OR [%P_ACCT%].CURRENTMEMBER.PROPERTIES ("2/CPMB/ACCTYPE")="EXP") AND NOT ([%TIME%].CURRENTMEMBER.PROPERTIES("2/CPMB/MOPOFSI")="X"), [MEASURES].[YTD]([MEASURES].[YTD],[%TIME%].LAG(1)), [MEASURES].[YTD])' SOLVE_ORDER=3## MEMBER [MEASURES].[CUSTOMQTD] AS 'IIF(([%P_ACCT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="INC" OR [%P_ACCT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="EXP"),IIF([%TIME%].CURREN TMEMBER.PROPERTIES("2/CPMB/TILEVEL")="QUARTER",[MEASURES].[CUSTOMPER],IIF([%TIME% ].CURRENTMEMBER.PROPERTIES("2/CPMB/TILEVEL")="MONTH" OR [%TIME%].CURRENTMEMBER.PROPERTIES("2/CPMB/TILEVEL")="WEEK" OR [%TIME%].CURRENTMEMBER.PROPERTIES("2/CPMB/TILEVEL")="DAY",SUM(PERIODSTODATE([%T IME%].CURRENTMEMBER.PARENT.LEVEL, [%TIME%].CURRENTMEMBER),[MEASURES].[CUSTOMPER]),NULL)),[MEASURES].[YTD])' SOLVE_ORDER = 3

You might also like