cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Silent prompt data manager package - SAP BPC

0 Likes
842

Hi Expert,

need your help about vba code to pass parameters in a package, below the vba code that works perfectly in SAP BPC 10.1 NW:

Sub Copy_to_Periods()

Dim cPackageId As String

Dim cDimName As String

Dim cTimeId As String

Dim myFolderName, myFileName As String

Dim vFileName As String

'General type declerations

Dim oAutomation As Object

Set oAutomation = CreateObject("FPMXLClient.EPMAddInAutomation")

Dim oAutomationDM As Object

Set oAutomationDM = CreateObject("FPMXLClient.EPMAddInDMAutomation")

Dim oPackage As Object

Set oPackage = CreateObject("FPMXLClient.ADMPackage")

cDimName = "ENGAGEMENT"

cPackageGroupId = "Referentiel"

cPackageId = "IMPORT_MASTER"

'Declare package

With oPackage

.Filename = "/CPMB/IMPORT_MASTER" '<----Enter the process chain ID

.groupId = cPackageGroupId

.packageDesc = ""

.packageId = cPackageId

.packageType = "Process Chain"

.teamId = ""

.UserGroup = "0010"

End With

'Path of Local Response XML File

vFileName = Environ("USERPROFILE") & "\Documents\LocalResponse50.xml"

'Locate and delete old local response file

'Enter file path to delete files from

myFolderName = Environ("USERPROFILE") & "\Documents\"

myFileName = Dir(myFolderName & "*.xml")

'Delete all files without an Excel extension

Do While myFileName <> "LocalResponse50.xlsx"

If myFileName = "" Then Exit Do

Kill myFolderName & myFileName

myFileName = Dir

Loop

'Create Local Response XML File

Call CreateLocalResponseXMLFile(vFileName, cPackageId, cDimName)

'Run Package

Call oAutomationDM.RunPackage(oPackage, vFileName)

End Sub

Now I try to use that code in SAP BPC 11 - Analysis for Office 2.7. I've made some changes, the code below :

Sub Copy_to_Periods()

Dim cofCom As Object

Set cofCom = Application.COMAddIns("SapExcelAddIn").Object

Dim cPackageId As String

Dim cDimName As String

Dim cTimeId As String

Dim myFolderName, myFileName As String

Dim vFileName As String

'General type declerations

Dim oAutomation As Object

Set oAutomation = cofCom.GetPlugin("com.sap.epm.FPMXLClient")

Dim oAutomationDM As Object

Set oAutomationDM = cofCom.GetPlugin("com.sap.epm.FPMXLClient")

Dim oPackage As Object

Set oPackage = cofCom.GetPlugin("com.sap.epm.FPMXLClient")

Dim epm As Object

Set epm = cofCom.GetPlugin("com.sap.epm.FPMXLClient")

cDimName = "SUJET_INVEST"

cPackageGroupId = "Gestion des données"

cPackageId = "Import_Master_Data"

'Declare package

With oPackage

.Filename = "/CPMB/IMPORT_MASTER"

.groupId = cPackageGroupId

.packageDesc = ""

.packageId = cPackageId

.packageType = "Process Chain"

.teamId = ""

.UserGroup = "0010"

End With

'Path of Local Response XML File

vFileName = Environ("USERPROFILE") & "\Documents\LocalResponse50.xml"

'Locate and delete old local response file

'Enter file path to delete files from

myFolderName = Environ("USERPROFILE") & "\Documents\"

myFileName = Dir(myFolderName & "*.xml")

'Delete all files without an Excel extension

Do While myFileName <> "LocalResponse50.xlsx"

If myFileName = "" Then Exit Do

Kill myFolderName & myFileName

myFileName = Dir

Loop

'Create Local Response XML File

Call CreateLocalResponseXMLFile(vFileName, cPackageId, cDimName)

'Run Package

Call oAutomationDM.RunPackage(oPackage, vFileName)

End Sub

I've got an error with the declaration of my package, Excel seems to doesn't recognise the property

any idea on how to write it correctly in SAP BPC 11 - Analysis for Office 2.7 ?

Kind regards

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor
0 Likes

I see something strange in objects references,,,

Please read my blog:

https://blogs.sap.com/2017/06/16/simple-vba-function-to-pass-parameters-to-dm-packages/

Starting from:

New code using “DataManagerAdvancedRunPackage”

...

Answers (0)