Skip to Content

The Analysis function SAPExecuteCommand Refresh command is documented as having 1 optional parameter to specify a particular DataSource for refreshing, and if the parameter is omitted the command refreshes all DataSources. If all DataSources are already refreshed, and the function specifies for all DataSources to be refreshed, the function returns 0 (failure). If at least 1 of the DataSources is not already refreshed, and the function specifies for all DataSources to be refreshed, the function returns 1 (Success). If a single DataSource is specified, regardless of whether the DataSource is already refreshed, the function returns 1 (Success). If 2 or more DataSources are specified, and at least 1 of the DataSources isn’t already refreshed, the function returns 1 (Success). If 2 or more DataSources are specified, and all of those DataSources are already refreshed, the function returns 0 (Failure).

This would appear to be ambiguous/inconsistent behaviour.

The SAPExecuteCommand function can return 1 of 2 values:

0 = Success

1 = Failure

When calling SAPExecuteCommand  with the “Refresh” command, you can call it for all DataSources in one of 3 ways:

Method 1: Implicitly refresh all DataSources by omitting the DataSource parameter:

Application.Run(“SAPExecuteCommand”, “Refresh”)

Method 2: Explicitly refresh all DataSources by specifying “ALL” as the DataSource parameter (Thoughtfully, Analysis won’t let you assign the alias “ALL” to a DataSource, so there’s no chance of ambiguous aliases):

Application.Run(“SAPExecuteCommand”, “Refresh”, “ALL”)

Method 3: (undocumented, but implied by the RefreshData command): Explicitly refresh all DataSources by specifying a semi-colon delimited string of all DataSource aliases as the DataSource parameter (Again, thoughtfully, Analysis won’t let you use semi-colons in DataSource aliases, so there’s no chance of ambiguous aliases):

Application.Run(“SAPExecuteCommand”, “Refresh”, “DS_1;DS_2;DS_3”)


Or you can refresh specific DataSources, by specifying the DataSource parameter as either:

Method 1: Explicitly refresh a single DataSource

Application.Run(“SAPExecuteCommand”, “Refresh”, “DS_1”)


Method 2: (undocumented, but implied by the RefreshData command): Explicitly refresh a semi-colon delimited string of DataSources:

Application.Run(“SAPExecuteCommand”, “Refresh”, “DS_1;DS_3”)

So, in summary, it seems that:

– Explicitly refreshing a single DataSource will always return 1 (assuming the DataSource can be refreshed)

– Refreshing a semi-colon delimited string of DataSources, will return 1 if at least 1 of the specified DataSources is not already refreshed, and 0 if all of the specified DataSources are already refreshed.

– Refreshing all DataSources, will return 1 if at least 1 DataSource is not already refreshed, and 0 if all DataSources are already refreshed.

I’m not sure that this is the desired/expected behaviour of the function, but it’s something to watch out for in your code…..

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