Skip to Content

The Analysis’ SAPExecuteCommand function can be used to execute a variety of commands.  The function can take up to 3 parameters, depending upon the particular SAP command that you’re calling. For example, Refreshing all data sources requires the function be called with 1 parameter, and hiding the Ribbon requires calling the function with 3 parameters.

 

However, the function doesn’t always check your parameters for validity, and it can sometimes return 1 (Success) if you don’t provide the right parameters, so a simple typo can lead to a false positive. Just one more argument for a centralised wrapper for Analysis function calls (article coming soon)

For example, the following function call will hide the Ribbon, as expected, and return 1 (Success)…..

Application.Run(“SAPExecuteCommand”, “Hide”, “TaskPane”, “Analysis”)

But the following function call with a small typo in the first parameter, will also return 1 (Success), even though “Hidd” is not a valid parameter or command… The subsequent parameters thereby have no contextual meaning, and the TaskPane will not be hidden….

Application.Run(“SAPExecuteCommand”, “Hidd“, “TaskPane”, “Analysis”)

Conversely, typos made in subsequent parameters (at least for the Hide command) do return 0 (Failure), as one might expect….

Application.Run(“SAPExecuteCommand”, “Hide”, “TaskPann“, “Analysis”)

Application.Run(“SAPExecuteCommand”, “Hide”, “TaskPane”, “Analyss“)


I doubt the false positives are desired/expected behaviour, and that the function should return 0 (Failure), or possibly an error, when an invalid parameter is provided.

I’ve experienced this under SBO 1.4 and Excel 2007 – Please add details in the comments if you’ve seen different behaviour in other versions, or ambiguous behaviour with specific function parameters….

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply