Quantcast
Channel: SCN : Unanswered Discussions - SAP BusinessObjects Analysis, edition for Microsoft Office
Viewing all articles
Browse latest Browse all 1183

Refresh crosstable via VBA

$
0
0

Hello together,

 

I would like to refresh a datasource and set parameters for the SAP Analysis Add-In by VBA. The helpfile gave already some clues about that and it seems not to be a big deal. However several difficulties appeared:

> I am not really sure about whats the difference between commands "Refresh" and "Restart" and when the one or the other should be called.

> I already realized that the restart command does not work if there was no "Refresh" command called in advance. It seems that the only the "Refresh" command result in a login screen.

> The strange thing about the Refresh command is, that it works only one time. After the first call only the "Restart" command will result in a real refresh.

 

This led to the following code, that was the only stable one who safely refreshed the data:

 

    Call Application.Run("SAPExecuteCommand", "Refresh", "DS_2")

    Call Application.Run("SAPSetRefreshBehaviour", "Off")

    Call Application.Run("SAPExecuteCommand", "PauseVariableSubmit", "On")

    Call Application.Run("SAPSetVariable", "ZTKAG_GT_MGID_K_HIMOI01", paramMGID, "INPUT_STRING", "DS_2")

    Call Application.Run("SAPSetVariable", "ZTKAG_0COMPANY_K_CISMI01", paramCompanyID, "INPUT_STRING", "DS_2")

    Call Application.Run("SAPSetVariable", "ZTKAG_0BCS_REFYR_CISNI01", paramJahrID, "INPUT_STRING", "DS_2")

    Call Application.Run("SAPExecuteCommand", "PauseVariableSubmit", "Off")

    Call Application.Run("SAPSetRefreshBehaviour", "On")

    Call Application.Run("SAPExecuteCommand", "Restart", "DS_2")

 

This is a really strange behavior and is not really mentioned in the helpfile. Furtherthemore it takes a long time to refresh, as the "Refresh" command also needs a lot of time, although it doesn't do anything after the first call.

 

I would be happy if an automatic refresh would be executed, after the parameters were set.

 

Is there a better approach?

Why does the refresh command behaves so strangely?

 

I hope someone has some advises.

 

Best Regards

Marcel


Viewing all articles
Browse latest Browse all 1183

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>