badi implementation

Download BADI Implementation

Post on 07-Mar-2015

555 views

Category:

Documents

5 download

Embed Size (px)

TRANSCRIPT

How To Pass parameters to custom logic BADI using START_BADISAP Product Name: Applicable Product Versions: Document Version Last Updated: SAP Business Planning and Consolidation 7.0, version for SAP NetWeaver 7.0 SP1 & above 1.1 Jan, 2009

Enterprise Performance Managementwww.sdn.sap.com/irj/sdn/bpx-epm

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 PowerPoint are 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 ScenarioAt 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 IntroductionThere 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.

3 Details and UsageThe START_BADI and END_BADI syntax can be used to pass parameters to the ABAP custom logic. Between these tags, we can pass on multiple parameters and they all will be available inside the BADI implementation. Syntax:*START_BADI = = .. *END_BADI

where filter_value_of_your_BADI_implementation is the name of the filter you provided during the BADI implementation of UJ_CUSTOM_LOGIC BADI. There are two optional parameters you can use within a *START_BADI / *END_BADI instruction.*START_BADI 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 SolutionWe will first create the BADI implementation for the Declining Depreciation function and then, use the function in the ApShell Planning Applications script logic.

4.1 Implement UJ_CUSTOM_LOGIC BADI1. Log in to ABAP layer o your BPC through SAP Log on pad.

2. Go to transaction SE19.

3. Provide the Enhancement Spot as UJ_CUSTOM_LOGIC and click on Create Impl..

4. In the next screen, Provide name and description for Enhancement Implementation. You dont have to provide the Composite Enhancement Implementation, if you are not doing one. In this case, we are calling the enhancement implementation ZBPC_DECD, with short text BPC: Declining-Balance Depreciation.

5. Click the Green Check. NOTE: You will need a developer key to be able to create this implementation.

6. Provide your package name and click on Save button in the bottom.

7. In the next screen, provide name for BADI Implementation and Implementation Class. Choose BADI Definition as BADI_UJ_CUSTOM_LOGIC from the drop down. In this case, were specifyingBADI Implementation: ZBPC_DECD Implem entation Class: ZCL_BPC_DECD BADI Definition: BADI_UJ_CUSTOM_LOGIC

8. Click the Green check to continue.

9. Provide package information for the implementation class and then, click on Save.

10. Inside the Enhancement Implementation screen, expand the BADI Implementation.

11. Double click on Filter Val

12. Click on the Create Filter Combination button.

13. Double click on the ???? under the value 1 column.

14. Fill in the Value 1. This is the name users will be using to the BADI from the script. Use a name which will make sense to business users. Then, click OK. In this example, we will specify DECD.

15. Now double click on Implementing Class.

16. Double click on method IF_UJ_CUSTOM_LOGIC~EXECUT E to create the implementation class.

17. System will ask for confirmation to create the implementation. Click on yes.

18. System will then prompt for saving Enhancement Implementation so far. Click on Yes.

19. System will take to EXECUTE method implementation. Click on the pencil button to go into change mode. Copy and the sample code provided in the Appendix or code your own.

20. Then, click on Activate button.

21. System will prompt for all the objects which you created. Choose the objects related to this whole implementation (Shown in the screen for this example) and click OK in the bottom. With successful Activation, we are ready with BADI implementation.

4.2 Create a new process chain template In this step, we will create a new process chain template to execute a script logic file. In this guide, we go through the process of creating it manually, but if you want, you can begin by copying a delivered process chain. If you copy a delivered process chain, then you must be careful of all changes you make to shared process variants, as those changes will affect all process chains that