cancel
Showing results for 
Search instead for 
Did you mean: 

How to use macros in BPC 10

Former Member
0 Kudos

Hi Experts ,

I am trying to use macros to refresh the workbook on  button click, but it is throwing error Run Time Error '1004' "Can not run the macro refresh.The macro may not be available in this workbook or all macros may be disable "

I am using this simple script in VB Module:

Sub Test_Refresh()

Application.Run "Refresh"

End Sub

and assigning this Test_Refresh Macro on button.Even I am not able to use any other macros of BPC 10.I have already enabled macros in Excel option but not able to resolve this issue .

Please suggest me some solution .

Regards,

Sonam Gupta

Accepted Solutions (1)

Accepted Solutions (1)

akos_beres
Contributor
0 Kudos

Sonam,

Did you enable the reference libraries necessary to access the API?

http://scn.sap.com/people/devon.abraham2/blog/2012/02/23/using-the-api-in-epm-100-nw-bpc

Answers (3)

Answers (3)

Former Member
0 Kudos

hi Experts,

Can anyone give me simple code to run a DataManagerPackage through Macros.

As previously I mentioned I am not able to pass the arguments in the DataManagerPackage method.

Please suggest me some solution for it.

Regards,

Sonam Gupta

akos_beres
Contributor
0 Kudos

Sonam,

try this script...

Sub DataMgr ()

Application.Run "EPMExecuteAPI", "DataManagerRunPackage", "", "[Name of Data manager pacakge]", "[The folder or group where the package is saved]", ""

End Sub

Former Member
0 Kudos

Hi Akos ,

This code is not working

Regards,

Sonam Gupta

akos_beres
Contributor
0 Kudos

Sonam,

Can you post screenshots of the following:

  1. Your reference library selections from the VB Editor
  2. Screenshot of the Data Manger folder with the package that you'd like to run
  3. The error that you are getting when you try to run the above script

Akos

Former Member
0 Kudos

Hi Akos,

I have tried to run following scripts :

Script1:

Sub DataMgr()

Application.Run "EPMExecuteAPI", "DataManagerRunPackage", "", "Time Data Allocation based on PY Actual", "Financial Process", "Company", "/CPMB/ALLOCATION"

End Sub

Script is not running,not getting any error message


Script2:

Sub DataMgr()

Application.Run "EPMExecuteAPI", "DataManagerRunPackage", "", "Time Data Allocation based on PY Actual", "Financial Process", ""

End Sub

Script is not running,not getting any error message


Script3:

Sub Macro_Run_Package_PYActual()

Dim client As FPMXLClient.EPMAddInAutomation

Set client = New EPMAddInAutomation

client.DataManagerRunPackage "Time Data Allocation based on PY Actual", "Financial Process", "Company", "/CPMB/ALLOCATION"

Set client = Nothing

End Sub


As mentioned in below thread

http://scn.sap.com/thread/2130613

Error Message:

" RunTime Error '-1073479167(c0040201)':

Internal Server Error "

Screen Shots:

Reference Library Selection:


DataManager Folder:

Regards,

Sonam Gupta

akos_beres
Contributor
0 Kudos

Sonam,

All of your settings seem to be correct. Script 2 should be the same as selecting a package and running it. I assume it runs fine from the 'Data manager' tab. At this point, the only advice that I have left is make sure you have the latest version of EPM. If that's the case, I would open a ticket. Sorry that I couldn't help.

Akos

JohnL
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Sonam,

Did you get this working?

Thanks,

John

Former Member
0 Kudos

Hey use the following code it will work

Option Explicit

Sub Refresh_Click()

Dim send As New FPMXLClient.EPMAddInAutomatio

send.RefreshActiveSheet

End Sub

Enable, FPMXLC client through reference and Macro's From excel..

Regards,Hari

akos_beres
Contributor
0 Kudos

Sonam,

once the reference library is enabled, the following script should be able to refresh the active sheet.

Sub Test_Refresh()

Dim a As New EPMAddInAutomation

a.RefreshActiveSheet

Set a = nothing

End sub

Let us know if this works or not.

Akos

Former Member
0 Kudos

Hi Experts,

Now I am able to use the macros.

but i am not able to pass the arguments in DataManagerRunPackage.

I am using this code:

Sub Macro_Run_Package_PYActual()

Dim client As FPMXLClient.EPMAddInAutomation

Set client = New EPMAddInAutomation

client.DataManagerRunPackage "Data Allocation", "Financial Process", "Company", "/CPMB/ALLOCATION"

Set client = Nothing

End Sub

But this code is throwing error

" RunTime Error '-1073479167(c0040201)':

Internal Server Error "

Can you please suggest me what is the error in my code .

This code is also mentioned in http://scn.sap.com/thread/2130613 thread.

Regards,

Sonam gupta

JohnL
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Sonam,

You may also need to lower your Macro Security to "Enable all macros ..."

Thanks,

John