Professional Documents
Culture Documents
Enterprise Performance
Management
www.sdn.sap.com/irj/sdn/bpx-epm
© Copyright 2009 SAP AG. All rights reserved. contained in this document serves informational purposes
only. National product specifications may vary.
No part of this publication may be reproduced or transmitted
in any form or for any purpose without the express permission These materials are subject to change without notice. These
of SAP AG. The information contained herein may be changed materials are provided by SAP AG and its affiliated companies
without prior notice. ("SAP Group") for informational purposes
only, without representation or warranty of any kind, and SAP
Some software products marketed by SAP AG and its Group shall not be liable for errors or omissions with respect to
distributors contain proprietary software components of other the materials. The only warranties for SAP Group products
software vendors. and services are those that are set forth in the express warranty
statements accompanying such products and services, if any.
Microsoft, Windows, Outlook, and PowerPoint are registered Nothing herein should be construed as constituting an
trademarks of Microsoft Corporation. additional warranty.
IBM, DB2, DB2 Universal Database, OS/2, Parallel Sysplex, These materials are provided “as is” without a warranty of any
MVS/ESA, AIX, S/390, AS/400, OS/390, OS/400, iSeries, pSeries, kind, either express or implied, including but not limited to,
xSeries, zSeries, z/OS, AFP, Intelligent Miner, WebSphere, the implied warranties of merchantability, fitness for a
Netfinity, Tivoli, and Informix are trademarks or registered particular purpose, or non-infringement.
trademarks of IBM Corporation in the United States and/or SAP shall not be liable for damages of any kind including
other countries. without limitation direct, special, indirect, or consequential
damages that may result from the use of these materials.
Oracle is a registered trademark of Oracle Corporation. SAP does not warrant the accuracy or completeness of the
information, text, graphics, links or other items contained
UNIX, X/Open, OSF/1, and Motif are registered trademarks of within these materials. SAP has no control over the
the Open Group. information that you may access through the use of hot links
contained in these materials and does not endorse your use of
Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, third party web pages nor provide any warranty whatsoever
VideoFrame, and MultiWin are trademarks or registered relating to third party web pages.
trademarks of Citrix Systems, Inc. SAP “How-to” Guides are intended to simplify the product
implementation. While specific product features and
HTML, XML, XHTML and W3C are trademarks or registered procedures typically are explained in a practical business
trademarks of W3C®, World Wide Web Consortium, context, it is not implied that those features and procedures are
Massachusetts Institute of Technology. the only approach in solving a specific business problem using
SAP products. Should you wish to receive additional
Java is a registered trademark of Sun Microsystems, Inc. information, clarification or support, please refer to SAP
Consulting.
JavaScript is a registered trademark of Sun Microsystems, Inc., Any software coding and/or code lines / strings (“Code”)
used under license for technology invented and implemented included in this documentation are only examples and are not
by Netscape. intended to be used in a productive system environment. The
Code is only intended better explain and visualize the syntax
MaxDB is a trademark of MySQL AB, Sweden. and phrasing rules of certain coding. SAP does not warrant the
correctness and completeness of the Code given herein, and
SAP, R/3, mySAP, mySAP.com, xApps, xApp, and other SAP SAP shall not be liable for errors or damages caused by the
products and services mentioned herein as well as their usage of the Code, except if such damages were caused by SAP
respective logos are trademarks or registered trademarks of intentionally or grossly negligent.
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
1 Scenario
At customers, there often needs the ability to have custom exits to perform a certain piece of business logic
or to optimize performance by working with some of the lower level operations of the system. This guide is
an introduction to the exit framework with allows customers to utilize ABAP custom logic within their BPC
Script Logic. In addition, it describes how these exits can be made generic and be parameter driven.
Meaning that parameters can be passed from BPC Script Logic into these ABAP programs.
In this scenario, we will pass parameters to ABAP custom logic using START_BADI statements within
Script Logic. As an example, we will be implementing Declining Depreciation function (Similar to DECD
keyword from FOX) using BADI implementation.
2 Introduction
There will be multiple scenarios where we want to pass parameters from script logic to ABAP BADI
implementation. For example, an BPC User wants to calculate rates from the Finance cube and post the
results to rate cube. During this calculation, the administrator may want to pass the target AppSet and
Application (cube) when calling the BADI. As of Business Planning and Consolidation 7.0 Version for
NetWeaver Support Package 1 (Released on Dec 12 2008), we are introducing new keywords called
*START_BADI and *END_BADI.
Syntax:
*START_BADI <filter_value_of_your_BADI_implementation>
<key1> = <value1>
<key2> = <value2>
..
*END_BADI
There are two optional parameters you can use within a *START_BADI / *END_BADI
instruction.
*START_BADI <filter_value_of_your_BADI_implementation>
QUERY=ON/OFF //optional; default is OFF
WRITE=ON/OFF //optional; default is OFF
*END_BADI
Query performs a default query and Write automatically writes back the data. Set QUERY parameter to
OFF if you want to perform your own read inside the BADI implementation; set WRITE to OFF to not write
back query results automatically. You may code to write to another application from the BADI.
This how to guide walks through a step-by-step example in the ApShell Planning cube. Please note you
must have appropriate NetWeaver BI and BPC authorizations to perform the required steps.
4 The Step By Step Solution
We will first create the BADI implementation for the “Declining Depreciation” function and then, use the
function in the ApShell Planning Application’s script logic.
2. Go to transaction SE19.
3. Provide the Enhancement Spot as
“UJ_CUSTOM_LOGIC” and click on
“Create Impl.”.
2. Click New.
9. Click OK.
10. Click save. In the whole process
chain creation, remember to save
your work for every step. Then,
change the right hand side view to
process type by clicking on the chain
button.
15. Click OK
16. System would have added the new
variant in the right hand side.
2. Click Refresh.
3. Click OK.
4. Depending upon your current view
selection, data will get pulled.
METHOD if_uj_custom_logic~execute.
CLEAR ls_param.
READ TABLE it_param WITH KEY hashkey = 'YEAR' INTO ls_param.
IF sy-subrc NE 0.
l_log = 'You have not specified the parameter ''YEAR'' which is required.'.
cl_ujk_logger=>log( i_object = l_log ).
RAISE EXCEPTION TYPE cx_uj_custom_logic.
EXIT.
ENDIF.
l_year = ls_param-hashvalue.
CLEAR ls_param.
READ TABLE it_param WITH KEY hashkey = 'PERCENTAGE' INTO ls_param.
IF sy-subrc NE 0.
l_log = 'You have not specified the parameter ''PERCENTAGE'' which is required.'.
cl_ujk_logger=>log( i_object = l_log ).
RAISE EXCEPTION TYPE cx_uj_custom_logic.
EXIT.
ENDIF.
l_percentage = ls_param-hashvalue.
* Send the result data back. BPC always over-writes existing value. So, send
* the latest values.
ct_data = <lt_final>.
ENDMETHOD.
*START_BADI DECD
QUERY = ON
WRITE = ON
YEAR = 1
PERCENTAGE = $PERCT$
*END_BADI
PROMPT(SELECTINPUT,,,,"%ACCOUNT_DIM%,%ENTITY_DIM%,%CATEGORY_DIM%,%CURRENCY_DIM%,%TIME_DIM%")
PROMPT(TEXT,%SCRIPT_FILE%,"Choose Script Logic File",)
PROMPT(TEXT,%PERCT%,"Input Depreciation Percentage",)
INFO(%EQU%,=)
INFO(%TAB%,;)
TASK(ZBPC_RUN_LOGIC,TAB,%TAB%)
TASK(ZBPC_RUN_LOGIC,EQU,%EQU%)
TASK(ZBPC_RUN_LOGIC,SUSER,%USER%)
TASK(ZBPC_RUN_LOGIC,SAPPSET,%APPSET%)
TASK(ZBPC_RUN_LOGIC,SAPP,%APP%)
TASK(ZBPC_RUN_LOGIC,SELECTION,%SELECTION%)
TASK(ZBPC_RUN_LOGIC,LOGICFILENAME,%SCRIPT_FILE%)
TASK(ZBPC_RUN_LOGIC,REPLACEPARAM,PERCT%EQU%%PERCT%)