how to pass parameters

Upload: anirban-devburman

Post on 07-Apr-2018

231 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 How to Pass Parameters

    1/33

    Pass dynamic parameters to scriptlogic

    SAP Pr od u c t Nam e: SAP Bus in e ss Pl an nin g a n d Co n so l i d a t i o n 7 .0 ,

    ve r s ion fo r SAP NetWeaver

    Ap p li cab l e Pr o d u ct Ve r si o ns : 7 .0 SP1 & a b o ve

    Do cu m e n t Ver s io n 1 .1

    La s t Upd a te d : J an 2 0 0 9

    Enterprise PerformanceManagement

    w w w .s d n.s ap .c o m / i r j / s d n/ b p x- e p m

    How To

    http://www.sdn.sap.com/irj/sdn/bpx-epmhttp://www.sdn.sap.com/irj/sdn/bpx-epm
  • 8/6/2019 How to Pass Parameters

    2/33

    Copyright 2009 SAPAG. All rights reserved.

    No part of this publication may be reproduced or transmitt edin any form or for any purpose without the express permissionof SAPAG. The information contained herein may be changedwithout prior notice.

    Some software products marketed by SAPAG and itsdistributors contain proprietary software components of othersoftware vendors.

    Microsoft, Windows, Outlook,and PowerPoint are registeredtrademarks 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, Intell igent Miner, WebSphere,Netfinity, Tivoli, and Informix are trademarks or registeredtrademarks of IBM Corporation in the United States and/orother countries.

    Oracle is a registered trademark of Oracle Corporation.

    UNIX, X/Open, OSF/1, and Motif are registered trademarks ofthe Open Group.

    Cit rix, ICA, Program Neighborhood, MetaFrame, WinFrame,VideoFrame, and MultiWin are trademarks or registeredtrademarks of Citrix Systems, Inc.

    HTML, XML, XHTML and W3C are trademarks or registeredtrademarks 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 implementedby Netscape.

    MaxDB is a trademark of MySQL AB, Sweden.

    SAP, R/3, mySAP, mySAP.com, xApps, xApp, and other SAPproducts and services mentioned herein as well as theirrespective logos are trademarks or registered trademarks ofSAPAG in Germany and in several other countries all over theworld. All other product and service names mentioned are thetrademarks of their respective companies. Data

    contained in this document serves informational purposesonly. National product specifications may vary.

    These materials are subject to change without notice. Thesematerials are provided by SAPAG and its affiliated companies("SAPGroup") for informational purposesonly, without representation or warranty of any kind, and SAP

    Group shall not be liable for errors or omissions with respect tothe materials. The only warranties for SAPGroup productsand services are those that are set forth in the express warrantystatements accompanying such products and services, if any.Nothing herein should be construed as constituting anadditional warranty.

    These materials are provided as is without a warranty of anykind, either express or implied, including but not limited to,the implied warranties of merchantability, fitness for apart icular purpose, or non-infringement.SAPshall not be liable for damages of any kind includingwithout limitation direct, special, indirect, or consequentialdamages that may result from the use of these materials.SAPdoes not warrant the accuracy or completeness of theinformation, text, graphics, l inks or other items containedwithin these materials. SAPhas no control over theinformation that you may access through the use of hot linkscontained in these materials and does not endorse your use ofthird party web pages nor provide any warranty whatsoeverrelating to third party web pages.SAPHow-to Guides are intended to simplify the productimplementation. While specific product features andprocedures typically are explained in a practical businesscontext, it is not implied that those features and procedures arethe only approach in solving a specific business problem usingSAPproducts. Should you wish to receive additional

    information, clarification or support, please refer to SAPConsulting.Any software coding and/or code lines / strings (Code)included in this documentation are only examples and are notintended to be used in a productive system environment. TheCode is only intended better explain and visualize the syntaxand phrasing rules of cert ain coding. SAPdoes not warrant thecorrectness and completeness of the Code given herein, andSAPshall not be liable for errors or damages caused by theusage of the Code, except if such damages were caused by SAPintentionally or grossly negligent.

  • 8/6/2019 How to Pass Parameters

    3/33

    1 Scenario

    In this scenario, we will try to pass runtime parameters (called prompts) from data manager to script logic.

    2 IntroductionThere will be multiple scenarios where we want to get the user input and then, use that value in the scriptlogic calculation. For Example, users may want to pass the percentage value of the budget increase whenthey execute the script logic, not hard-coded inside the script logic. As of Business Planning andConsolidation 7.0 Version for NetWeaver Support Package 1 (scheduled to be released on Dec 12 2008),we are supporting dynamic replacements inside script logic, which means values can be provided fromdata manager and will be replaced dynamically during runtime of your script file.

    This how to guide walks through a step-by-step example in the ApShell Planning cube. Please note youmust have appropriate NetWeaver BI and BPC authorizations to perform the required steps.

  • 8/6/2019 How to Pass Parameters

    4/33

    3 The Step By Step Solution

    We will first create a custom process chain which will be used in the data manager as template. Then, wewill build the script & finally, configure the data package to execute the script using the custom processchain created.

    If you already have a process chain where you want to add this enhancement, just add new parametersfrom 22nd step in sub-section 3.1. Then, follow 3.2, 3.3 and 3.4.

    3.1 Create BPC Process Chain

    1 . Log in to ABAP layer of your BPCthrough SAP Log on pad.

    2 . Go to transaction RSPC.

  • 8/6/2019 How to Pass Parameters

    5/33

    3 . Click New.

    4 . Provide Process Chain tech nameand description. (In typicalNetWeaver BI implementations,custom objects usually begin with Z,but just follow your organization

    naming standards.) Click OK.

    In this example, we are calling theprocess chain ZBPC_PROT_EXPand the description ZBPC: PromptExample .

    5 . System will prompt start variant.Create new start variant by clicking

    on new button.

  • 8/6/2019 How to Pass Parameters

    6/33

    6 . Provide Process Variant Tech nameand description.

    In this example, were calling theprocess variant ZBPC_PROMP_EXP_START andthe long description ZBPC: PromptExample Start .

    7 . In the next screen, click on ChangeSelection to maintain the start time.

    8 . Click on Immediate button andpress save button (in the bottom).

  • 8/6/2019 How to Pass Parameters

    7/33

    9 . Press save and then go back.

    1 0 . Click OK.

    1 1 . Click save. In the whole processchain creation, remember to save

    your work for every step. Then,change the right hand side view toprocess type by clicking on the chainbutton.

  • 8/6/2019 How to Pass Parameters

    8/33

    1 2 . Then, expand BPC ProcessTypes. Drag BPC: ModifyDynamically and drop in the righthand side area.

    1 3 . System will prompt to choose avariant. Create a new variant byclicking on the new button.

    1 4 . Provide Tech name and descriptionand click OK.

  • 8/6/2019 How to Pass Parameters

    9/33

    1 5 . Click save in the next screen and goback.

    1 6 . Click OK

    1 7 . System would have added the newvariant in the right hand side.

  • 8/6/2019 How to Pass Parameters

    10/33

    1 8 . Now, choose the first variant byclicking on it and then, drag & dropto the second variant to link them.

    1 9 . After successful link, system willshow an arrow.

    2 0 . Now, drag and drop the BPC: RunLogic process.

  • 8/6/2019 How to Pass Parameters

    11/33

    2 1 . Create new Run Logic step whenprompted.

    2 2 . Provide Tech name and descriptionfor Run Logic step.

    In this example, specify the processvariant as

    ZBPC_PROMPT_EXP_RUN_LOGIC and the long description as ZBPC:Prompt Example Run Logic

    2 3 . In the next screen, enter belowfields:

    TABSUSER

    SELECTION

    SAPPSET

    SAPP

    REPLACEPARAM

    LOGICFILENAME

    EQU

    (TAB, REPLACEPARAM and EQU arethe new fields to support dynamicreplacements of prompts)

  • 8/6/2019 How to Pass Parameters

    12/33

    2 4 . Click Ok. Then, connect this processvariant with previous step (i.e.Dynamic Modify).

    2 5 . System will ask for action. ChooseSuccessful.

    2 6 . Expand General Services in the right

    hand side and choose OR process.

  • 8/6/2019 How to Pass Parameters

    13/33

    2 7 . Create a new OR process variantand click OK.

    2 8 . Then, connect this OR process withthe Dynamic Modify step.

    2 9 . Choose Errors action this time.

  • 8/6/2019 How to Pass Parameters

    14/33

    3 0 . Connect the same OR step with RunLogic step. When the popup boxcomes up, choose always as theAction.

    3 1 . Choose this process from left handside and drop.

    3 2 . Create new variant.

  • 8/6/2019 How to Pass Parameters

    15/33

    3 3 . Provide tech name and description.

    3 4 . In the next screen, addCLOSE_MODE as a field and give 0as value. Press save and go back.

    3 5 . Then, connect this step withprevious OR steps.

  • 8/6/2019 How to Pass Parameters

    16/33

    3 6 . Save and activate the process chainby clicking on the candle button.

    3 7 . Now, we will be re-assigning thisprocess chain to the rightcomponent so that it will be visible inBPC data manager. Click onDisplay Components

    3 8 . Choose BPC Examples component.

  • 8/6/2019 How to Pass Parameters

    17/33

    3 9 . Save and activate again.

    You dont have to create new process chain for each script file you want to execute. You can pass the script

    file dynamically either in the data manager dynamic script (explained in section 3.3) of the package orprompt the user for the script file (explained in Appendix section).

    Please note that currently you can create only one Data Manager package per process chain.

  • 8/6/2019 How to Pass Parameters

    18/33

    3.2 Develop the required scriptIn this step, we will develop the script with parameters which will replaced by data manager prompts.

    1 . Login to the BPC Administration.

    2 . Navigate to the AppSet/Applicationwhere you want to create the scriptLogic.

    In this case, were working with acopy of ApShell.

    1. In the action pane, click Create NewLogic .

  • 8/6/2019 How to Pass Parameters

    19/33

    2. Name the Logic File IncreasePercentage and click OK.

    3 . Enter the script logic code here.(Sample code is provided in theappendix). $WS_PERCT$ and$EXP_PERCT$ will be replaced atrun time with prompt value. Use $

    character before and after name tobe replaced.

    4 . Save the script logic.

  • 8/6/2019 How to Pass Parameters

    20/33

    3.3 Develop the required scriptIn this step, we will create the data package to execute the script having the process chain created astemplate.

    1 . Login to the BPC Excel client.

    2 . After logging in, click on ManageData in the Action pane.

  • 8/6/2019 How to Pass Parameters

    21/33

    3 . Click on Maintain datamanagement in the next menu.

    4 . Then, click on Manage packages(organize list).

  • 8/6/2019 How to Pass Parameters

    22/33

    5 . Choose the desired team and clickon Create package to add a newpackage.

    6 . Click on open folder button to selecta process chain for this package

    7 . Choose the process chain which youmodified in the earlier step.

  • 8/6/2019 How to Pass Parameters

    23/33

    8 . Enter Package name andDescription (Avoid using specialcharacters for naming the package.and choose a group as well. Makesure to select the desired task typeas well. Then, click Save.

    In this case, were calling the

    package Increase Exp and WS

    9 . Next screen, click save to store thepackage in the system.

    1 0 . You will get a message that packagelist successfully updated.

  • 8/6/2019 How to Pass Parameters

    24/33

    1 1 . Go back to Manage packages(organize list) to modify thepackage

    1 2 . Click view package (button next toopen folder on the same line asprocess chain).

    1 3 . Click on Advanced button.

  • 8/6/2019 How to Pass Parameters

    25/33

    1 4 . Here, maintain the dynamic script(sample code is provided in theappendix). Then, click ok.

    Note: There are two INFO statementshere. The parameter EQU is used asthe splitter between parameter andvalue (e.g.in A=B, EQU is just =). Theparameter TAB is used to separatewhole parameter & value sets (e.g. forA=B;C=D, the TAB is ;). You can seehow these two variables are used in thefinal TASK line of this dynamic scriptfile.

    1 5 . Press Save in the next screen.

    1 6 . Press save again

  • 8/6/2019 How to Pass Parameters

    26/33

    1 7 . Press save again. Now, we createdthe package.

  • 8/6/2019 How to Pass Parameters

    27/33

    3.4 Run the package and verify dataWe will now execute the package and validate the data.

    1 . Log in to the excel client and pull inthe data for CE0001000 accountparent for 2006.SEP. You may alsoneed to adjust other dimension filtersas shown here in the current view.

    2 . In excel client, go back in the action

    pane to choose Run a datamanagement package.

  • 8/6/2019 How to Pass Parameters

    28/33

    3 . Place the cursor on the packagecreated in the earlier step and clickRun.

    4 . Entered desired values

    5 . Fill in the data ranges as necessaryand choose when you want to runthe package. Then, click Next.

  • 8/6/2019 How to Pass Parameters

    29/33

    6 . Confirm the selection and clickFinish.

    7 . Click OK on the message and verifythe logs.

    8 . Now, click on the View Status checkthe log of the script.

  • 8/6/2019 How to Pass Parameters

    30/33

    9 . You can see your job running withgreen arrow.

    1 0 . Once successfully completed,changes to blue color icon withcompleted as Progress. Double clickon this line to see the details of the

    log.

    1 1 . Here you can view the whole log.

  • 8/6/2019 How to Pass Parameters

    31/33

    1 2 . Close the data manager to refreshthe EVDRE query. Now, you cansee the changed data.

    Note that this dynamic replacement can also be used to pass multiple member values to the script(you would pass one long string with all the values as you would type in the script logic).Furthermore, you could even combine these parameters with the use of the START BADI keywordin script logic, and pass parameters all the way from the user input through to your custom written

    BAdI.

  • 8/6/2019 How to Pass Parameters

    32/33

    4 Appendix

    4.1 Sample Source Code for Script Logic file:

    *XDIM_MEMBERSET P_ACCT= CE0004020, CE0004010*XDIM_MEMBERSET CATEGORY = ACTUAL*XDIM_MEMBERSET TIME=2006.SEP*XDIM_MEMBERSET ENTITY= C9000*XDIM_MEMBERSET P_ACTIVITY=NONE*XDIM_MEMBERSET P_DATASRC=UPLOAD*XDIM_MEMBERSET RPTCURRENCY = LC

    //Increase Wage and Salary & Personnel Exp. by entered percentage[P_ACCT].[#CE0004020] = [P_ACCT].[CE0004020] * ( 1 + $WS_PERCT$ / 100)[P_ACCT].[#CE0004010] = [P_ACCT].[CE0004010] * ( 1 + $EXP_PERCT$ / 100)*COMMITNote the $ sign at the beginning and end of the variables.

    4.2 Sample Source Code for dynamic script in the package:

    PROMPT (SELECTINPUT,,,,"%ENTITY_DIM%,%CATEGORY_DIM%,%CURRENCY_DIM%,%TIME_DIM%")PROMPT (TEXT,%WS_PERCT%,"Input W/S Percent in decimals",)PROMPT (TEXT,%EXP_PERCT%,"Input Exp. Percent in decimals",)INFO (%EQU%,=)INFO (%TAB%,;)TASK (ZBPC_PROMPT_EXP_RUN_LOGIC,TAB,%TAB%)TASK (ZBPC_PROMPT_EXP_RUN_LOGIC,EQU,%EQU%)TASK (ZBPC_PROMPT_EXP_RUN_LOGIC,SUSER,%USER%)TASK (ZBPC_PROMPT_EXP_RUN_LOGIC,SAPPSET,%APPSET%)TASK (ZBPC_PROMPT_EXP_RUN_LOGIC,SAPP,%APP%)TASK (ZBPC_PROMPT_EXP_RUN_LOGIC,SELECTION,%SELECTION%)TASK (ZBPC_PROMPT_EXP_RUN_LOGIC,LOGICFILENAME, INCREASEPERCENTAGE.LGF)TASK (ZBPC_PROMPT_EXP_RUN_LOGIC,REPLACEPARAM,WS_PERCT%EQU%%WS_PERCT%%TAB%EXP_PERCT%EQU%%EXP _PERCT%)

    REPLACEPARAM in the last TASK basically builds a look up table with variable name & its valueentered by the users. During execution of the script logic, wherever the variables appear in the script, theywill first replaced by the user entered value, before execution of the script.

    4.3 Data Manager dynamic script to prompt for Script Logic file:

    PROMPT (SELECTINPUT,,,,"%ENTITY_DIM%,%CATEGORY_DIM%,%CURRENCY_DIM%,%TIME_DIM%")PROMPT (TEXT,%SCRIPT_FILE%,"Choose Script Logic File",)PROMPT (TEXT,%WS_PERCT%,"Input W/S Percent in decimals",)PROMPT (TEXT,%EXP_PERCT%,"Input Exp. Percent in decimals",)INFO (%EQU%,=)INFO (%TAB%,;)TASK (ZBPC_PROMPT_EXP_RUN_LOGIC,TAB,%TAB%)TASK (ZBPC_PROMPT_EXP_RUN_LOGIC,EQU,%EQU%)TASK (ZBPC_PROMPT_EXP_RUN_LOGIC,SUSER,%USER%)TASK (ZBPC_PROMPT_EXP_RUN_LOGIC,SAPPSET,%APPSET%)TASK (ZBPC_PROMPT_EXP_RUN_LOGIC,SAPP,%APP%)TASK (ZBPC_PROMPT_EXP_RUN_LOGIC,SELECTION,%SELECTION%)TASK (ZBPC_PROMPT_EXP_RUN_LOGIC,LOGICFILENAME ,%SCRIPT_FILE% )TASK (ZBPC_PROMPT_EXP_RUN_LOGIC,REPLACEPARAM,WS_PERCT%EQU%%WS_PERCT%%TAB%EXP_PERCT%EQU%%EXP _PERCT%)

    Adding Prompt for script logic file (shown in bold) will prompt the users to choose a script logic file whichthey want to execute.

  • 8/6/2019 How to Pass Parameters

    33/33