Home
Login
Register
Search
Home
How to Call BPC Data Manager Package From Visual Basic
How to Call BPC Data Manager Package From Visual Basic
March 20, 2018 | Author: andrefumian | Category:
Ibm Db2
,
Microsoft Excel
,
Ibm System I
,
Command Line Interface
,
Software
DOWNLOAD
Share
Report this link
Comments
Description
How to Call BPC Data Manager Package from Visual BasicApplies to: SAP BusinessObjects Planning and Consolidation version 10 for NetWeaver BPC 10 SP7 & Above EPM Add-In 10.0 SP 12 Patch 1 for .NET Summary How to call BPC data manager package from Visual Basic Author: Tristan Colgate, Amaury Gruyelle, Muthu Ranganathan Company: Bluefin Solutions in collaboration with SAP Created on: 31 August 2012 Author Bio Tristan Colgate, EPM Lead at Bluefin Solutions, UK Amaury Gruyelle, BPC Consultant at Bluefin Solutions, UK Muthu Ranganathan, EPM Product Management at SAP. SAP COMMUNITY NETWORK © 2012 SAP AG scn.sap.com 1 How to Call BPC Data Manager Package from Visual Basic Table of Contents Scenario .............................................................................................................................................................. 3 Details and Usage .............................................................................................................................................. 6 Step by Step Instructions .................................................................................................................................... 7 Create the PARAMETERS Excel Name Range ............................................................................................. 7 Create the PACKAGE Excel Name Range ................................................................................................... 12 Add the Visual Basic code ............................................................................................................................ 15 Create the User Interface to perform the Copy ............................................................................................. 18 Appendix ........................................................................................................................................................... 21 How to display the Developer tab in the Excel Ribbon ................................................................................. 21 MS Office Excel 2010 ................................................................................................................................................ 21 VBA Code ..................................................................................................................................................... 24 Example XML Prompt File ............................................................................................................................ 31 Related Content ................................................................................................................................................ 33 Copyright........................................................................................................................................................... 34 SAP COMMUNITY NETWORK © 2012 SAP AG scn.sap.com 2 How to Call BPC Data Manager Package from Visual Basic Scenario The Data Manager packages delivered as standard with BPC are sophisticated, having many different options. Consider the Copy DM Package. Firstly, the user needs to specify how the records are handled during the copy. Then the user specifies whether they want default logic to run after the copy is performed. SAP COMMUNITY NETWORK © 2012 SAP AG scn.sap.com 3 How to Call BPC Data Manager Package from Visual Basic Thirdly the user is asked whether they wish the copy to respect work status. they must specify the source and destination data ranges. Fourthly. SAP COMMUNITY NETWORK © 2012 SAP AG scn.sap.com 4 . These options can be confusing to an occasional user of BPC. A common question from users in such a scenario is whether they can simply have drop-down boxes in two cells in the Excel spreadsheet where they can specify from and to Categories.sap. in contextualised language that the user will understand.How to Call BPC Data Manager Package from Visual Basic Finally. This may. and would actually cause errors in the way their data is processed if set incorrectly. One solution is to copy the standard package and amend the Prompt script to default those options where appropriate and only present options that are pertinent to the user. the user selects whether they want to run the copy immediately. still leave the user navigating through a number of screens when they simply wish to perform a simple function. however. Many of the options are not relevant to what they are trying to achieve. such as copying their data from one version to another. or schedule it to run later. such as a Cost Centre Manager preparing their annual budget. and a button that executes the copy: SAP COMMUNITY NETWORK © 2012 SAP AG scn.com 5 . com 6 . the Copy function) expects. A Name range called PARAMETERS in the Excel Workbook that specifies all of the parameters that the function in question (in our case. An Excel sheet where the user can specify from and to versions and click the button to execute the copy.How to Call BPC Data Manager Package from Visual Basic This paper will describe how to achieve this. along with the values that will be passed to them. Details and Usage The solution involves the following components.sap. SAP COMMUNITY NETWORK © 2012 SAP AG scn. which is accessed as follows: Navigate to the DataManager tab on the Excel ribbon SAP COMMUNITY NETWORK © 2012 SAP AG scn. passing the parameters specified in the PARAMETERS Name range.sap. Visual Basic code that. upon being invoked. Step by Step Instructions Create the PARAMETERS Excel Name Range The standard Copy DM Package delivered in the EnvironmentShell BPC model expects the following parameters (as defined in the prompt script file). calls the Data Manager Package specified in the PACKAGE Name range.How to Call BPC Data Manager Package from Visual Basic A Name range called PACKAGE in the Excel workbook that defines the details of the package we wish to execute. TOSELECTION – Dimension/ Member pairs defining the target data range. We also specify here the name of the Prompt File that is generated during the process. This information can be gleaned by looking at the DM Package prompt script file.com 7 . TARGETMODE – contains a 0 or a 2 RUNLOGIC – contains a 0 or a 1 CHECKLCK – contains a 0 or a 1 SELECTION – Dimension/ Member pairs defining the source data range. How to Call BPC Data Manager Package from Visual Basic Select Organize-->Organize Package List In the Organize Package List pop-up.sap. right-click and choose Modify Package. find the Copy Package.com 8 . Click on Modify Script in the subsequent pop-up: SAP COMMUNITY NETWORK © 2012 SAP AG scn. SAP COMMUNITY NETWORK © 2012 SAP AG scn. shows the script used to pass parameters back to the DM Package Process Chain. Now we will create the PARAMETERS Name range in Excel.sap. Modify Script. Analyse this information to work out which parameters you need to include in the PARAMETERS Excel Name Range.com 9 .How to Call BPC Data Manager Package from Visual Basic Click on Advanced in the subsequent pop-up: The final popup. How to Call BPC Data Manager Package from Visual Basic Create the cells containing the specification of parameters as per the screenshot.com 10 . Prompt Type is either Parameter or StringListPairs Dimension is only relevant for StringListPairs Value is the value you want to set this parameter to – this can be hard coded (as is the case for the three Parameters). SAP COMMUNITY NETWORK © 2012 SAP AG scn. or can use an Excel formula. with % before and after. Note: Prompt names should match those in the DM Prompt definition. as is the case for the source and destination categories which look at the selection the user has made in the from and to version drop-downs.sap. the range A1 to D20) Enter PARAMETERS into the cell reference box to make the Name range.How to Call BPC Data Manager Package from Visual Basic Select the cells (in our case. SAP COMMUNITY NETWORK © 2012 SAP AG scn.sap.com 11 . sap. Enter this table name into the Table Name field and click on: SAP COMMUNITY NETWORK © 2012 SAP AG scn.com 12 . Go to transaction SE16 (Data Browser) Details about Data Packages are stored in table UJD_PACKAGES2.How to Call BPC Data Manager Package from Visual Basic Create the PACKAGE Excel Name Range Log on to the NetWeaver ABAP stack via SAPGUI. com 13 . SAP COMMUNITY NETWORK © 2012 SAP AG scn.sap.How to Call BPC Data Manager Package from Visual Basic Enter the BPC Environment and Model IDs into the APPSET_ID and APP_ID fields respectively. The following table indicates how you should map the values found in the UJD_PACKAGE2 table with the fields you need to populate in the Excel Name Range you will shortly create. Click on: The resulting screen contains all of the details you will need to populate the PACKAGE name range. Click on: In the table returned. identify the row containing the DM Package we are interested in and select it. SAP COMMUNITY NETWORK © 2012 SAP AG scn.txt Now we will create the Excel PACKAGE Name Range: Create the cells containing the specification of parameters as per the screenshot. Note that. field PromptFile will contain the name of a file that will be created as part of the process of launching the DM Package.How to Call BPC Data Manager Package from Visual Basic Field from table UJD_PACKAGES2 CHAIN_ID GROUP_ID PACKAGE_ID PACKAGE_ID PACKAGE_TYPE TEAM_ID USER_GROUP Field in Excel Name Range Filename GroupId PackageDesc PackageId PackageType TeamID UserGroup* Example /CPMB/COPY Data Management Copy Copy Process Chain <blank> 0010 * Note that the number in the table must be entered with leading zeroes. that you’ll need to decide on a file location that can be guaranteed to exist on all end users’ PCs. as a four character field. example we use: C:\CopyDataManagerPromptFile.com 14 . In our.sap. if you are using this in an Enterprise environment. Additionally. Add the Visual Basic code Note that you must have the “Developer” tab enabled in the Excel ribbon: SAP COMMUNITY NETWORK © 2012 SAP AG scn.sap.com 15 .How to Call BPC Data Manager Package from Visual Basic Select the cells in the data range (in our case cells F1:G9) Enter PACKAGE into the cell reference and hit <enter>. Navigate to Tools--> References from the Visual Basic menu bar.com 16 . Follow the instructions in the Appendix to do so before moving on. then you need to enable it. SAP COMMUNITY NETWORK © 2012 SAP AG scn. Click on the button in the Developer ribbon tab to open the Visual Basic editor.sap.How to Call BPC Data Manager Package from Visual Basic If you cannot see this tab in your ribbon in Excel. How to Call BPC Data Manager Package from Visual Basic Check the boxes as per the screenshot to the right.com 17 . right click on the VBAProject node for your Excel Workbook and choose: Insert --> Module SAP COMMUNITY NETWORK © 2012 SAP AG scn. Note – you may need to scroll down quite a long list to find some of these. In the Project Explorer pane.sap. Create the User Interface to perform the Copy Create the following cells.com 18 .sap.x into the newly created Module. SAP COMMUNITY NETWORK © 2012 SAP AG scn.How to Call BPC Data Manager Package from Visual Basic Copy and Paste the code in Appendix 4. choose Insert-->Button Form Control Use the lasso tool to draw out the rectangle for the button. In the Developer ribbon tab.How to Call BPC Data Manager Package from Visual Basic Use Data Validation in order to provide a drop-down on the Category dimension fields.sap.com 19 . SAP COMMUNITY NETWORK © 2012 SAP AG scn. click on the button. The button is now displayed.How to Call BPC Data Manager Package from Visual Basic The Assign Macro popup appears. click on: SAP COMMUNITY NETWORK © 2012 SAP AG scn.sap.com 20 . Click OK. Select existing Macro executeDmPackageWithParameter s. To test the solution. In the Data Manager ribbon tab. Note that the Developer tab is not currently displayed.How to Call BPC Data Manager Package from Visual Basic The Package Status popup should appear and show your job in progress (or perhaps already completed). SAP COMMUNITY NETWORK © 2012 SAP AG scn.com 21 . Appendix How to display the Developer tab in the Excel Ribbon MS Office Excel 2010 Here is the Excel 2010 Ribbon.sap. How to Call BPC Data Manager Package from Visual Basic Select the File tab in the ribbon and click on Options.com 22 .sap. The Options pop-up is displayed: SAP COMMUNITY NETWORK © 2012 SAP AG scn. The Developer tab is now displayed.com 23 . In the right-hand panel. select the checkbox labelled Developer.sap. and then click on OK.How to Call BPC Data Manager Package from Visual Basic Select the Customize Ribbon option in the left pane. SAP COMMUNITY NETWORK © 2012 SAP AG scn. RefersToRange SAP COMMUNITY NETWORK © 2012 SAP AG scn.Value = "PromptFile" Then strFilename = rngPackageRange(i. using the promtp file specified in Name Range "PACKAGE" objDMautomation.Value Exit Function End If Next End Function Private Function strPackageDescription(strRange As String) As String ' Get the range in which the DM package paramteres is set Dim rngPackageRange As Range Set rngPackageRange = Application.RunPackage objPackageFromSheet("PACKAGE").com 24 .RefersToRange ' Loop through the rows For i = 1 To rngPackageRange. 1).sap.Names(strRange). _ strFilename("PACKAGE") End Sub Private Function strFilename(strRange As String) As String ' Get the range in which the DM package paramteres is set Dim rngPackageRange As Range Set rngPackageRange = Application.Count If rngPackageRange(i.Rows.How to Call BPC Data Manager Package from Visual Basic VBA Code Public Sub executeDmPackageWithParameters() ' ' Create the Answer Prompt file in the location specified in the Name Range "PACKAGE" createAnswerPromptFile "PACKAGE".Names(strRange). "PARAMETERS" ' Get the DM Automation class instance Dim objDMautomation As EPMAddInDMAutomation Set objDMautomation = New EPMAddInDMAutomation ' ' Run the package specified in Excel Name Range "PACKAGE". 2). PackageId = rngPackageRange(i.Value = "PackageId" Then strPackageDescription = rngPackageRange(i. 2).UserGroup = rngPackageRange(i.com 25 .PackageDesc = rngPackageRange(i. 2).Value Case "PackageType" objPackageFromSheet.Value Exit Function End If Next End Function Private Function objPackageFromSheet(strRange As String) As ADMPackage ' Get the range in which the DM package paramteres is set Dim rngPackageRange As Range Set rngPackageRange = Application.How to Call BPC Data Manager Package from Visual Basic ' Loop through the rows For i = 1 To rngPackageRange.Value Case "TeamId" objPackageFromSheet.RefersToRange ' Create the ADM Package object Set objPackageFromSheet = New ADMPackage ' Loop through the rows For i = 1 To rngPackageRange.Value Case "GroupId" objPackageFromSheet. 2). 2). 1).Rows. 1). 2).Names(strRange).Filename = rngPackageRange(i.Value End Select SAP COMMUNITY NETWORK © 2012 SAP AG scn.Rows.Value Case "PackageId" objPackageFromSheet.Value Case "Filename" objPackageFromSheet.GroupId = rngPackageRange(i. 2). 2).TeamId = rngPackageRange(i.Count Select Case rngPackageRange(i.PackageType = rngPackageRange(i.Value Case "UserGroup" objPackageFromSheet.sap.Count If rngPackageRange(i.Value Case "PackageDesc" objPackageFromSheet. 2). createProcessingInstruction("xml". _ " version='1.appendChild objProcessingInstruction ' Create root element Dim objRootElem As IXMLDOMElement Set objRootElem = objDOM.How to Call BPC Data Manager Package from Visual Basic Next End Function Private Sub createAnswerPromptFile(strPackageName As String.sap.RefersToRange 'Excel.createElement("ArrayOfAnswerPromptPersistingFormat") objDOM.createAttribute("xmlns:xsd") objMemberRel.setAttributeNode objMemberRel ' XSD Attribute Set objMemberRel = objDOM.Names(strParametersName).NodeValue = "http://www. _ strParametersName As String) ' Create a new XML document Dim objDOM As DOMDocument Set objDOM = New DOMDocument ' Set the processing instruction of the XML document Dim objProcessingInstruction As IXMLDOMProcessingInstruction Set objProcessingInstruction = _ objDOM.w3.createAttribute("xmlns:xsi") objMemberRel.RefersToRange ' Dim objCurrentStringPairParent As IXMLDOMElement SAP COMMUNITY NETWORK © 2012 SAP AG scn.appendChild objRootElem ' XSI Attribute Dim objMemberRel As IXMLDOMAttribute Set objMemberRel = objDOM.com 26 .NodeValue = "http://www.Names(strParametersName).org/2001/XMLSchema-instance" objRootElem.org/2001/XMLSchema" objRootElem.0' encoding='utf-16'") objDOM.w3.setAttributeNode objMemberRel ' Get the range of cells containing the parameters Dim rngParameters As Range Set rngParameters = ThisWorkbook. True) SAP COMMUNITY NETWORK © 2012 SAP AG scn. 4).Value. 1). 1). 4).Value.Value Set objCurrentStringPairParent = _ getStringListPairParent(rngParameters(i. _ rngParameters(i. _ objDOM ' If it is a list of values Case "StringListPairs" ' If it's a new set of String List Pairs.com 27 . 2). _ objRootElem. _ objCurrentStringPairParent. _ objRootElem.Value. _ objDOM) End If ' Add the Dimension Name and Value to the parent addStringListPair rngParameters(i.Rows. 1).sap. _ rngParameters(i. 1).Value <> strCurrentStringPair Then strCurrentStringPair = rngParameters(i.Count ' See which type of parameter is being passed Select Case rngParameters(i. _ objDOM End Select Next ' Create the File object Dim objFile As FileSystemObject Set objFile = New FileSystemObject ' Create a stream to create and write to the file Dim objStream As TextStream Set objStream = objFile.How to Call BPC Data Manager Package from Visual Basic ' Loop through each row For i = 1 To rngParameters. 3). _ ForWriting.Value.Value ' If it is a single Parameter. then create a new parent If rngParameters(i.OpenTextFile(strFilename(strPackageName).Value. then add a parameter node to the root node Case "Parameter" addSingleSelectionParameterToXML rngParameters(i. sap.createElement("lst") objStringListPairElement.createElement("StringListPair") objParent. _ objParent As IXMLDOMElement.appendChild objLstElement ' Create the "string" element containing the variable value Dim objStringElement As IXMLDOMElement Set objStringElement = objDOM. _ strValue As String.Text = strVariableName ' Create the "lst" element Dim objLstElement As IXMLDOMElement Set objLstElement = objDOM. _ objDOM As DOMDocument) As IXMLDOMElement SAP COMMUNITY NETWORK © 2012 SAP AG scn.WriteLine strPackageDescription(strPackageName) & _ "{param_separator}" & _ objDOM.XML ' Close the file objStream. _ objParent As IXMLDOMElement.createElement("string") objLstElement.How to Call BPC Data Manager Package from Visual Basic ' Write the name of the DM package first and then the XML output objStream.Close End Sub Private Function addStringListPair(strVariableName As String.Text = strValue End Function Private Function getStringListPairParent(strVariableName As String.appendChild objStrElement objStrElement.appendChild objStringElement objStringElement.appendChild objStringListPairElement ' Create the "Str" element containing the variable name Dim objStrElement As IXMLDOMElement Set objStrElement = objDOM. _ objDOM As DOMDocument) ' Create the "StringListPair" node Dim objStringListPairElement As IXMLDOMElement Set objStringListPairElement = _ objDOM.com 28 .createElement("str") objStringListPairElement. appendChild objAnswerPromptPersistingFormatElement ' Create the "_ap" node Dim objApElement As IXMLDOMElement Set objApElement = objDOM.sap.com 29 .createElement("Name") objApElement.How to Call BPC Data Manager Package from Visual Basic ' Create the "AnswerPromptPersistingFormat" node Dim objAnswerPromptPersistingFormatElement As IXMLDOMElement Set objAnswerPromptPersistingFormatElement = _ objDOM.createElement("AnswerPromptPersistingFormat") objParent.appendChild objValuesElement ' Create the "_apc" node Set getStringListPairParent = objDOM.appendChild objAnswerPromptPersistingFormatElement ' Create the "_ap" node Dim objApElement As IXMLDOMElement Set objApElement = objDOM. _ objDOM As DOMDocument) ' Create the "AnswerPromptPersistingFormat" node Dim objAnswerPromptPersistingFormatElement As IXMLDOMElement Set objAnswerPromptPersistingFormatElement = _ objDOM.createElement("_apc") objAnswerPromptPersistingFormatElement. _ objParent As IXMLDOMElement.Text = strVariableName ' Create the values element Dim objValuesElement As IXMLDOMElement Set objValuesElement = objDOM.appendChild objParameterElement objParameterElement.appendChild objApElement SAP COMMUNITY NETWORK © 2012 SAP AG scn.createElement("_ap") objAnswerPromptPersistingFormatElement.createElement("AnswerPromptPersistingFormat") objParent.appendChild getStringListPairParent End Function Private Function addSingleSelectionParameterToXML(strVariableName As String.createElement("_ap") objAnswerPromptPersistingFormatElement.appendChild objApElement ' Create the parameter name element Dim objParameterElement As IXMLDOMElement Set objParameterElement = objDOM. _ strValue As String.createElement("Values") objApElement. createElement("Values") objApElement.com 30 .sap.appendChild objValuesElement ' Create the string element with the value passed to the parameter Dim objStringElement As IXMLDOMElement Set objStringElement = objDOM.Text = strVariableName ' Create the values element Dim objValuesElement As IXMLDOMElement Set objValuesElement = objDOM.Text = strValue End Function SAP COMMUNITY NETWORK © 2012 SAP AG scn.createElement("Name") objApElement.createElement("string") objValuesElement.How to Call BPC Data Manager Package from Visual Basic ' Create the parameter name element Dim objParameterElement As IXMLDOMElement Set objParameterElement = objDOM.appendChild objStringElement objStringElement.appendChild objParameterElement objParameterElement. sap.How to Call BPC Data Manager Package from Visual Basic Example XML Prompt File SAP COMMUNITY NETWORK © 2012 SAP AG scn.com 31 . How to Call BPC Data Manager Package from Visual Basic SAP COMMUNITY NETWORK © 2012 SAP AG scn.sap.com 32 . com 33 .sap.How to Call BPC Data Manager Package from Visual Basic Related Content Enterprise Performance Management Community Financial Excellence Community SAP COMMUNITY NETWORK © 2012 SAP AG scn. RACF. Parallel Sysplex. 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 other countries. World Wide Web Consortium. and SAP Group shall not be liable for errors or omissions with respect to the materials. iSeries. SAP NetWeaver. z10. xSeries. System p. used under license for technology invented and implemented by Netscape. GPFS. ByDesign. POWER6. Massachusetts Institute of Technology. in the United States and in other countries. z/OS. System i. POWER5. Crystal Decisions. VideoFrame. System x. UNIX. All other product and service names mentioned are the trademarks of their respective companies. XML. and PowerPoint are registered trademarks of Microsoft Corporation. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. MetaFrame. POWER6+. Web Intelligence. HACMP. BatchPipes. AIX. Outlook. Intelligent Miner. Business Objects is an SAP company.S. POWER5+. RETAIN. and Motif are registered trademarks of the Open Group. SAP Business ByDesign. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only. Power Architecture. OSF/1. X/Open.A. S/390. Crystal Reports. Oracle is a registered trademark of Oracle Corporation. XHTML and W3C are trademarks or registered trademarks of W3C®. 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. BusinessObjects. System Storage. HTML. BladeCenter. eServer. the Adobe logo. SAP COMMUNITY NETWORK © 2012 SAP AG scn. PowerPC. and other countries. Linux is the registered trademark of Linus Torvalds in the U. PowerVM. POWER. and other Business Objects products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Business Objects S. National product specifications may vary.com 34 . DB2. All rights reserved. Redbooks. without representation or warranty of any kind. IBM. Inc. AS/400. System i5. Duet. i5/OS. These materials are subject to change without notice. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.sap. System z10. MVS/ESA. OpenPower. DB2 Connect. if any. Xcelsius. and MultiWin are trademarks or registered trademarks of Citrix Systems. Adobe. Data contained in this document serves informational purposes only. z9. System z9. and Reader are either trademarks or registered trademarks of Adobe Systems Incorporated in the United States and/or other countries. Citrix. JavaScript is a registered trademark of Oracle Corporation.How to Call BPC Data Manager Package from Visual Basic Copyright © Copyright 2012 SAP AG. WebSphere. ICA. System p5. Excel. OS/390. Acrobat. R/3. pSeries. Nothing herein should be construed as constituting an additional warranty. DB2 Universal Database. SAP. PartnerEdge. Program Neighborhood. zSeries. OS/400. Microsoft. Tivoli and Informix are trademarks or registered trademarks of IBM Corporation. Netfinity. Java is a registered trademark of Oracle Corporation. Windows. OS/2. z/VM. Business Objects and the Business Objects logo. S/390 Parallel Enterprise Server. System z. The information contained herein may be changed without prior notice. WinFrame. PostScript.
Report "How to Call BPC Data Manager Package From Visual Basic"
×
Please fill this form, we will try to respond as soon as possible.
Your name
Email
Reason
-Select Reason-
Pornographic
Defamatory
Illegal/Unlawful
Spam
Other Terms Of Service Violation
File a copyright complaint
Description
Copyright © 2024 DOKUMEN.SITE Inc.