Escolar Documentos
Profissional Documentos
Cultura Documentos
How-To Guide
Applicable Releases:
SAP Business Objects Planning and Consolidation 7.5, version for
NetWeaver, SP04 and higher.
Version 1.1
March 2011
© Copyright 2011 SAP AG. All rights reserved. These materials are subject to change without notice.
No part of this publication may be reproduced or These materials are provided by SAP AG and its affiliated
transmitted in any form or for any purpose without the companies ("SAP Group") for informational purposes only,
express permission of SAP AG. The information contained without representation or warranty of any kind, and SAP
herein may be changed without prior notice. Group shall not be liable for errors or omissions with
Some software products marketed by SAP AG and its respect to the materials. The only warranties for SAP
distributors contain proprietary software components of Group products and services are those that are set forth in
other software vendors. the express warranty statements accompanying such
products and services, if any. Nothing herein should be
Microsoft, Windows, Outlook, and PowerPoint are
construed as constituting an additional warranty.
registered trademarks of Microsoft Corporation.
These materials are provided “as is” without a warranty of
IBM, DB2, DB2 Universal Database, OS/2, Parallel
any kind, either express or implied, including but not
Sysplex, MVS/ESA, AIX, S/390, AS/400, OS/390,
limited to, the implied warranties of merchantability,
OS/400, iSeries, pSeries, xSeries, zSeries, z/OS, AFP,
fitness for a particular purpose, or non-infringement.
Intelligent Miner, WebSphere, Netfinity, Tivoli, Informix,
i5/OS, POWER, POWER5, OpenPower and PowerPC are SAP shall not be liable for damages of any kind including
trademarks or registered trademarks of IBM Corporation. without limitation direct, special, indirect, or consequential
damages that may result from the use of these materials.
Adobe, the Adobe logo, Acrobat, PostScript, and Reader
are either trademarks or registered trademarks of Adobe SAP does not warrant the accuracy or completeness of the
Systems Incorporated in the United States and/or other information, text, graphics, links or other items contained
countries. within these materials. SAP has no control over the
information that you may access through the use of hot
Oracle is a registered trademark of Oracle Corporation.
links contained in these materials and does not endorse
UNIX, X/Open, OSF/1, and Motif are registered
your use of third party web pages nor provide any warranty
trademarks of the Open Group.
whatsoever relating to third party web pages.
Citrix, ICA, Program Neighborhood, MetaFrame,
SAP NetWeaver “How-to” Guides are intended to simplify
WinFrame, VideoFrame, and MultiWin are trademarks or
the product implementation. While specific product
registered trademarks of Citrix Systems, Inc.
features and procedures typically are explained in a
HTML, XML, XHTML and W3C are trademarks or practical business context, it is not implied that those
registered trademarks of W3C®, World Wide Web features and procedures are the only approach in solving a
Consortium, Massachusetts Institute of Technology. specific business problem using SAP NetWeaver. Should
Java is a registered trademark of Sun Microsystems, Inc. you wish to receive additional information, clarification or
JavaScript is a registered trademark of Sun Microsystems, support, please refer to SAP Consulting.
Inc., used under license for technology invented and Any software coding and/or code lines / strings (“Code”)
implemented by Netscape. included in this documentation are only examples and are
MaxDB is a trademark of MySQL AB, Sweden. not intended to be used in a productive system
SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP environment. The Code is only intended better explain and
NetWeaver, and other SAP products and services visualize the syntax and phrasing rules of certain coding.
mentioned herein as well as their respective logos are SAP does not warrant the correctness and completeness of
trademarks or registered trademarks of SAP AG in the Code given herein, and SAP shall not be liable for
Germany and in several other countries all over the world. errors or damages caused by the usage of the Code, except
All other product and service names mentioned are the if such damages were caused by SAP intentionally or
trademarks of their respective companies. Data contained grossly negligent.
in this document serves informational purposes only. Disclaimer
National product specifications may vary. Some components of this product are based on Java™. Any
code change in these components may cause unpredictable
and severe malfunctions and is therefore expressively
prohibited, as is any decompilation of these components.
Any Java™ Source Code delivered with this product is only
to be used by SAP’s Support Services and may not be
modified or altered in any way.
Document History
Document Version Description
3. Prerequisites ........................................................................................................................ 9
5. Appendix ............................................................................................................................ 20
How To… Implement the RUNLOGIC Keyword in SAP Business Objects Planning & Consolidation, version for NetWeaver
1. Business Scenario
SAP Business Objects Planning & Consolidation can be installed on either a Microsoft or a NetWeaver
platform. While both platforms offer many of the same features and functionalities, there are a few key
differences. One of these differences is the support of Script Logic Keywords that have been
delivered with the installation. Currently, the RUNLOGIC Keyword is not delivered with SAP
BusinessObjects Planning and Consolidation, version for Netweaver (hereafter refered to as: BPC
NetWeaver or BPC).
Fortunately, the BPC NetWeaver Script Logic Business AddIn (BadI) provides an enhancement option
that allows you to define your own Script Logic Keywords. Using the BAdI implementation in this
guide as an example, we will show you how to define your own custom version of the RUNLOGIC
Keyword in BPC NetWeaver (For more detailed background information about the RUNLOGIC
Keyword, and the SAP BAdI Framework, see Section 2).
1.1 Calling other Scripts and the Push vs. Pull Concept
Many businesses already have some type of central script which contains references or includes to
other scripts in the same Application – allowing them to define the exact order of scripts which are
executed in a single run. This is a very useful feature for organizing and controlling which scripts are
to be executed at what time. In fact, the RUNLOGIC Keyword allows you to do this same action on a
more global scale, giving you the powerful capability of calling any script logic file which has been
defined in the BPC NetWeaver system.
The screenshot below represents a very simple illustration of how you can use RUNLOGIC to call a
script defined in another Application (or Application Set):
Let’s say you have modeled three different Applications in BPC NetWeaver; Supply, Demand, and
Finance (a simplified sales and operational planning scenario). In the Supply Application, the data is
modeled by Product, Raw Material and Capacity Asset (for ex: production_line_1). In the Demand
Application, the data is modeled by Product and Customer. Both Applications represent valid but
different business views, each affecting the outcome of projected sales and revenue. For the sake of
this example, we can assume the following:
In the Demand Application, a planner plans Demand Volume (how much the business sells).
In the Supply Application, a planner plans Production Volume (how much the business produces).
March 2011 1
How To… Implement the RUNLOGIC Keyword in SAP Business Objects Planning & Consolidation, version for NetWeaver
During the Production planning process, the planner analyzes both Production Volume and Inventory
of Product in the Supply Application. Inventory can be defined as a calculation in the Supply
Application which is based on Production Volume and Demand Volume:
Ending Inventory = Beginning Inventory + Production Volume – Demand Volume
In order to obtain an accurate calculation of Inventory, the planner will need to know how much
product the business will sell at any point during his/her planning process. It is during this process that
the Production planner would like to pull in the most recent plan of Demand Volume from the Demand
Application in order to review and determine its impact on inventory. Furthermore, the Production
Planner would like to stay in his/her own context while performing this review without any additional
steps.
For the purposes of this example, let’s say you have already defined a script in the Demand
Application which sends the Demand Volume to the Supply Application. You can then configure the
RUNLOGIC Keyword in the Supply Application to call this script, so that the user can get the latest
Demand Volume without having to change his/her context to the Demand Application and pushing
from there. This is a subtle but useful technique in designing BPC Applications which use data from
different areas in order to obtain up to date and holistic views of the entire data model.
March 2011 2
How To… Implement the RUNLOGIC Keyword in SAP Business Objects Planning & Consolidation, version for NetWeaver
This guide will show you how to use the BPC NetWeaver version of the RUNLOGIC Keyword to
specify different data sets automatically while running these scripts in parallel. Using the approach
described in this guide can greatly improve the performance of individual scripts. While there are no
doubt many different factors that can contribute to performance, initial testing on a simple example
showed an improvement of more than ten times by using just four parallel processes.
Let’s assume the same Demand Volume planning scenario described above, where the Demand
planner is trying to define how much volume of a product the business is trying to sell. Using the
same Demand Application model described above of Customers to Products, we can assume that the
data will be spread across multiple Entities or Business Units. During the planning process, the
Demand planner has already created his/her baseline of Demand Volume as well as the projected
Price for each Product. Now the business needs to calculate a baseline Sales Amount for each
Customer and Product. This sales amount can be defined as a calculation in the Demand Application
which is based on the Projected Price and Demand Volume:
Projected Sales = Demand Volume * Projected Price
Unfortunately, if the number of combinations of Customers by Products by Entities is very high (in the
millions range) such a calculation can take hours to complete (in our internal testing it took more than
five hours to calculate a year’s worth of data across 4 Entities, 50 Customers, and 800 Products).
The solution to this problem can be implemented with the newly created RUNLOGIC Keyword. By
using a driver dimension to semantically break up the data sets (such as Entity or Business Unit) the
RUNLOGIC Keyword can execute the script logic file with multiple data sets, each using its own
dialogue process. The number of dialogue processes used by the new RUNLOGIC Keyword is
determined by a globally defined BPC Web Admin Parameter. Special care should be taken when
setting this number since using too many processes can be detrimental to overall system performance
(see Section 4.1).
In our testing, we used four parallel processes and the script took slightly over twenty minutes to run
on the same data set that was taking over five hours to run – this is a performance increase of several
orders of magnitude! You should be careful when defining the driver/s for parallel execution because
incorrect usage of this feature can lead to negative system impacts. It is highly recommended that
you study the algorithm that this new RUNLOGIC Keyword uses (See Section 2.2).
Be advised that this guide is only intended to provide you with a solution to create the RUNLOGIC
Keyword and is not intended to fix all of your particular performance problems. Individual results will
always vary, and while this guide will show improvement in many different use cases, it may not be the
answer to your exact scenario.
March 2011 3
How To… Implement the RUNLOGIC Keyword in SAP Business Objects Planning & Consolidation, version for NetWeaver
2. Background Information
The following sections go into more detail and background on some of the areas of knowledge which
are desirable for using this How To Guide.
March 2011 4
How To… Implement the RUNLOGIC Keyword in SAP Business Objects Planning & Consolidation, version for NetWeaver
The performance improvement mentioned here can greatly improve the overall perceived value of the
BPC implementation when used within DEFAULT logic (remember that DEFAULT logic is executed for
every writeback operation to a BPC Application).
For example: If a calculation defined in DEFAULT logic takes one minute then every save takes
one minute (even if you are only updating one cell for example). Parallelization of the DEFAULT logic
may take this wait time down to several seconds in an optimal scenario. This means the user
experience has been dramatically improved – instead of waiting one minute for every save, the wait
time has been reduced to several seconds, giving the user a more productive and responsive work
session.
We should also mention that this new version of the RUNLOGIC Keyword in BPC NetWeaver can be
used to speed up batch calculations as well. These batch calculations may take a really long time to
run as data volumes and models change. Normally batch calculations are executed during times
when the system activity is much lower. However, if the business users log in from multiple time
zones the batch time window may be much smaller and harder to meet. Improved script runtimes will
allow the business to schedule batch runs efficiently and in smaller time windows which will help to
increase overall business process efficiency.
1. Determine how many parallel processes can be used (based on a new Application Set Web
Admin Parameter)
For example: Web Admin Parameter was configured for two parallel processes.
For example: The RUNLOGIC BAdI “Changed” Parameter has TIME and ENTITY. In this
example, the RUNLOGIC algorithm finds the first two combinations of TIME and ENTITY
members and will dispatch a process to execute the script for each of those two data sets.
NOTE: This process will repeat until there are no more data sets available (where the total
number of data sets is the Cartesian product of the members from the dimensions defined in
the BAdI “Changed” Parameter). Keep in mind that the Cartesian product is based on the set
March 2011 5
How To… Implement the RUNLOGIC Keyword in SAP Business Objects Planning & Consolidation, version for NetWeaver
of members defined in the BAdI “Dimension” Parameters. If that dimension has not been
defined in the BAdI “Dimension” Parameters then the Cartesian product is based on the
current context which was passed to the BAdI.
Important Notes and guidelines for the BPC NetWeaver version of the RUNLOGIC Keyword:
March 2011 6
How To… Implement the RUNLOGIC Keyword in SAP Business Objects Planning & Consolidation, version for NetWeaver
Calling Logic:CALLING_LOGIC.LGF
START_BAdI RUNLOGIC
QUERY = OFF
WRITE = ON
LOGIC = CALLED_LOGIC.LGF
APPSET = APSHELL
APP = PLANNING
DIMENSION ENTITY = ENTITY_1, ENTITY_2
CHANGED = ENTITY
DEBUG = OFF
END_BAdI
Called Logic:CALLED_LOGIC.LGF
XDIM_ADDMEMBERSET ENTITY = ENTITY_3
//Aggregating/Summarizing data to ENTITY_3 could result in a locking situation:
ENTITY_3 = ENTITY_1 + ENTITY_2
March 2011 7
How To… Implement the RUNLOGIC Keyword in SAP Business Objects Planning & Consolidation, version for NetWeaver
March 2011 8
How To… Implement the RUNLOGIC Keyword in SAP Business Objects Planning & Consolidation, version for NetWeaver
3. Prerequisites
Required/recommended expertise or prior knowledge
SAP BusinessObjects Planning and Consolidation 7.5, version for SAP NetWeaver
BPC NetWeaver Script Logic
BPC NetWeaver Script Logic BAdI Framework
ABAP programming skills
Access to SAP NetWeaver transaction codes: SE20, SE19, SE37, SE80, SE24, STMS
Additional Documentation:
RKT Online Knowledge Product
http://service.sap.com/rkt On the left hand side, navigate to SAP Ramp-Up Knowledge
Transfer -> SAP BusinessObjects EPM Solutions -> SAP BO PC 7.5, version for SAP
NetWeaver
Other EPM How-To Guides
http://wiki.sdn.sap.com/wiki/display/BPX/Enterprise+Performance+Management+%28EP
M%29+How-to+Guides
SAP Help Library – Business Add Ins (BAdI)
http://help.sap.com/saphelp_nw70/helpdata/en/8f/f2e540f8648431e10000000a1550b0/fr
ameset.htm
SAP Help Library – BPC NetWeaver Business Calculations (Script Logic and Business Rules)
http://help.sap.com/saphelp_bpc75_nw/helpdata/en/94/e0f3a56f174607855bc345a45df8
47/frameset.htm
March 2011 9
How To… Implement the RUNLOGIC Keyword in SAP Business Objects Planning & Consolidation, version for NetWeaver
4. Step-by-Step Procedure
This How-To guide outlines the procedure for implementing the RUNLOGIC Keyword in BPC 7.5,
NetWeaver. The following steps we describe here show the performance benefits you can acheive by
using the RUNLOGIC Keyword parallelization technique:
1) Import the ABAP transport from Appendix A into a BPC 7.5, Version for NetWeaver System
2) Set the number of Parallel Processes to be used
3) Parallelize on a single Dimension and validate results
4) Parallelize on a different Dimension and validate results
These steps demonstrate the testing of a simple Sales calculation as described in Section 1.2. The
calculation shown in this example simply multiplies Volume by Price and stores the result in Sales. By
modifying the script syntax and trying different parallelization drivers a much better performance can
be gained at run time. As always, performance results will depend on many different factors. The
data given in this guide is just a single example and results for your particular scenario may be
different.
NOTE: The ABAP code delivered with this transport belongs to a Package named "ZBPC".
March 2011 10
How To… Implement the RUNLOGIC Keyword in SAP Business Objects Planning & Consolidation, version for NetWeaver
6. Set the number of desired Parallel Processes in the box labeled “Value” and click the button
labeled “Update”
NOTE: This number will depend on many different factors related to the system hardware, such
as the available number of CPUs and RAM, in addition to how many other processes will be
running at the same time and how many active users in the system at the time of script
execution.
March 2011 11
How To… Implement the RUNLOGIC Keyword in SAP Business Objects Planning & Consolidation, version for NetWeaver
7. This configuration will only need to be done once. You can change it later as needed.
NOTE: This script assumes that Volumes are populated for some Customer-Product combination
and that the Price is populated for all Products where Customer = NO_CUSTOMER. It will multiply
Volume by Price per Product and places the result on an account named SALES.
March 2011 12
How To… Implement the RUNLOGIC Keyword in SAP Business Objects Planning & Consolidation, version for NetWeaver
NOTE: The only thing we changed in this new script is the XDIM specification for ENTITY, using
the special key %ENTITY_SET%, i.e. entities provided through the current view. In our case the
RUNLOGIC keyword provides these values to the calling script.
March 2011 13
How To… Implement the RUNLOGIC Keyword in SAP Business Objects Planning & Consolidation, version for NetWeaver
Now the log shows that all four Entities ran in ~21 minutes, which is almost 15 times faster than the
single threaded process in Step 4.3.2!!!
You can also see how each Entity was processed in the Formula log:
March 2011 14
How To… Implement the RUNLOGIC Keyword in SAP Business Objects Planning & Consolidation, version for NetWeaver
NOTE: The only difference from the original script is that we replace the single MDX line with a
*WHEN\*REC\*ENDWHEN syntax.
March 2011 15
How To… Implement the RUNLOGIC Keyword in SAP Business Objects Planning & Consolidation, version for NetWeaver
NOTE: The only thing we changed in this new script is the XDIM specification for ENTITY, using
the special key %ENTITY_SET%, i.e. entities provided through the current view. In our case the
RUNLOGIC keyword provides these values to the calling script.
March 2011 16
How To… Implement the RUNLOGIC Keyword in SAP Business Objects Planning & Consolidation, version for NetWeaver
March 2011 17
How To… Implement the RUNLOGIC Keyword in SAP Business Objects Planning & Consolidation, version for NetWeaver
In general, parallelization is the most efficient when each piece of data takes approximately the same
time for processing.
IMPORTANT NOTE: The general rule of thumb is: don’t put dimensions in the BAdI “CHANGED”
parameter if you are collapsing/aggregating on those dimensions in your called logic. For more
information, see Section 2.2.4 on Locking Issues.
NOTE: The only thing we changed in this new script is the XDIM specification for TIME, using the
special key %TIME_SET%, i.e. periods provided through the current view. In our case the
RUNLOGIC keyword provides these values to the calling script.
March 2011 18
How To… Implement the RUNLOGIC Keyword in SAP Business Objects Planning & Consolidation, version for NetWeaver
NOTE: The only thing we changed in this new calling script is the CHANGED Parameter.
March 2011 19
How To… Implement the RUNLOGIC Keyword in SAP Business Objects Planning & Consolidation, version for NetWeaver
5. Appendix
Appendix B – CALC_SALES.LGF
CALC_SALES.LGF from Section 4.3.1
Appendix C – CAL_SALES_1ENT.LGF
CAL_SALES_1ENT.LGF from Section 4.3.3
Appendix D – PAR_SALES_ENT.LGF
PAR_SALES_ENT.LGF from Section 4.3.4
Appendix E – CALC_SALES_WHEN.LGF
CALC_SALES_WHEN.LGF from Section 4.4.1
March 2011 20
How To… Implement the RUNLOGIC Keyword in SAP Business Objects Planning & Consolidation, version for NetWeaver
Appendix G – PAR_SALES_ENT_WH.LGF
PAR_SALES_ENT_WH.LGF from Section 4.4.4
Appendix H – CAL_SLS_1TIM.LGF
CAL_SLS _1TIM.LGF from Section 4.5.1
Appendix I – PAR_SALES_PER.LGF
PAR_SALES_PER.LGF from Section 4.5.2
March 2011 21
www.sdn.sap.com/irj/sdn/howtoguides