Show TOC

SAPExecuteCommandLocate this document in the navigation structure

You can use this API method as a generic command to execute the commands described below.

The system returns one of the following output parameters for each command execution:
  • 0 = execution failed.
  • 1 = execution successful.
PlanDataTransfer

Use this command to recalculate entered planning data.

PlanDataSave

Use this command to save entered planning data.

Example

Dim lResult As Long

lResult= Application.Run("SAPExecuteCommand", "PlanDataSave")

If you execute this command, the entered planning data is saved.

PlanDataReset

Use this command to reset planning data entered since the last save of data.

PlanDataClientReset

Use this command to reset planning data entered since the last successful recalculation of data.

PlanDataToDisplayMode

Use this command to quit input-ready mode and switch to display mode while planning data.

PlanDataToChangeMode

Use this command to switch to input-ready mode while planning data.

PauseVariableSubmit

Use this command to pause the execution of variables using the parameter "On". To end the pausing, use the command with parameter "Off".

When PauseVariableSubmit is in mode "On", all Analysis formulas and most of the Analysis macros will not be executed. The following macros will be executed: SAPAddMessage, SAPSetVariable, PauseVariableSubmit "Off".

Hide/Show

Use this command to hide and show Analysis UI components for a workbook. You can use the command for the types "Ribbon", "ContextMenu" and "TaskPane".

You can hide the complete ribbon ("All") and show it again ("Default"). For the context menu, you can hide the single refresh or the complete menu and show the complete menu again. For the design panel, you can hide the Analysis and the Components tab and show the complete design panel again.

The following commands are supported:
  • Application.Run("SAPExecuteCommand", "Hide", "Ribbon", "All")
  • Application.Run("SAPExecuteCommand", "Show", "Ribbon", "Default")
  • Application.Run("SAPExecuteCommand", "Hide", "ContextMenu", "Refresh_Single")
  • Application.Run("SAPExecuteCommand", "Hide", "ContextMenu", "All")
  • Application.Run("SAPExecuteCommand", "Show", "ContextMenu", "Default")
  • Application.Run("SAPExecuteCommand", "Hide", "TaskPane", "Analysis")
  • Application.Run("SAPExecuteCommand", "Hide", "TaskPane", "Components")
  • Application.Run("SAPExecuteCommand", "Show", "TaskPane", "Default")
ShowPrompts

Use this command to display the prompts dialog. You can call the workbook or data source prompts dialaog. To call the dialog, the data source(s) need to be refeshed.

Example Show prompts dialog for one data source

lResult= Application.Run("SAPExecuteCommand", "ShowPrompts", "DS_1")

If you execute this command, the prompts dialog for DS_1 is displayed. This is only possible if the variables are not merged in the workbook.

Example Show prompts dialog for all data sources

lResult= Application.Run("SAPExecuteCommand", "ShowPrompts", "ALL")

If you execute this command, the prompts dialog for all data sources in the workbook is displayed.

Refresh

Use this command to initially refresh the data in the workbook. You can specify one data source or one planning object as a parameter that should be refreshed. If you do not enter a parameter or you enter the string 'ALL' as parameter, all data sources and planning objects will be refreshed. If you execute this command for a data source which is already refreshed, all corresponding crosstabs are redrawn.

Additionally, you can refresh a list of data sources.
Note If a planning function 'PF_X' has a filter assigned, you can include this filter with theh alias 'PF_X' into the list. However, the planning function itself wil not be refreshed and has to be refreshed with an own command.
Example Refresh one data source

Dim lResult As Long

lResult= Application.Run("SAPExecuteCommand", "Refresh", "DS_1")

If you execute this command, the data for data source DS_1 is refreshed.

Example Refresh all data sources

Dim lResult As Long

lResult= Application.Run("SAPExecuteCommand", "Refresh")

If you execute this command, the data of all data sources is refreshed.

Example Refresh a list of data sources

Dim lResult As Long

lResult= Application.Run("SAPExecuteCommand", "Refresh"; "DS_1;DS_2")

If you execute this command, the data of data source DS_1 and DS_2 is refreshed.

RefreshData

Use this command to refresh all or defined data sources in the workbook. You can specify the data sources that should be refreshed. If you do not enter a parameter or you enter the string 'ALL' as parameter, all data sources will be refreshed. If you execute this command for a data source, the corresponding data is updated from the server and the crosstabs are redrawn.

Example Refresh two defined data sources

Dim lResult As Long

lResult= Application.Run("SAPExecuteCommand", "RefreshData", "DS_1;DS_3")

If you execute this command, the data for data source DS_1 and DS_3 is refreshed from the server.

Restart

Use this command to technically restart all or defined data sources in the workbook. Technically restarting a data source has the same effect than deleting and reinserting it with keeping the current navigation state and the selected prompt values. The complete process of adding or initially refreshing a data source is executed. After the restart, new data from the database will be included in the corresponding crosstabs. Before you can restart a data source, the data source has to be initially refreshed, for example with the command Refresh. If you do not enter a parameter or you enter the string 'ALL' as parameter, all data sources will be restarted. If you want to define a set of data sources that should be restarted, you can enter them as parameter with a semicolon separated list.

Example

Dim lResult As Long

lResult= Application.Run("SAPExecuteCommand", "Restart", "DS_1;DS_2")

If you execute this command, the data of data sources DS_1 and DS_2 is restarted.

AutoRefresh

Use this command to stop one or several data sources from redisplaying with parameter 'Off'. To reactivate the redisplaying, use the command with parameter 'On'. A data source can be set to off at any time. It can also be done in the callback Workbook_SAP_Initialize, for example. All parameters are mandatory and may not be blank.

If the command is used with parameter On, any crosstabs of the requested data sources that have pending updates, will be redisplayed automatically.

The configuration AutoRefresh of a data source is always independent of the 'Pause Refresh' of the workbook. A crosstab based on a data source is redisplayed if the workbook is not paused and the data source is not paused. The AutoRefresh value of a data source can be received with macro SAPGetProperty (SAPGetPropert y("IsAutoRefresh","DS_1").

Example

Dim lResult As Long

lResult= Application.Run("SAPExecuteCommand", "AutoRefresh", "Off", "DS_1;DS_2")

If you execute this command, any crosstabs on top of data sources DS_1 and DS_2 are not redisplayed automatically anymore.

RegisterCallback

Use this command to register a callback. The following callbacks can be registered with SAPExecuteCommand: AfterRedisplay, BeforePlanDataSave, BeforePlanDataReset, BeforeMessageDisplay.

UnregisterCallback

Use this command to unregister the callbacks listed above.

Example

Dim lResult As Long

lResult= Application.Run("SAPExecuteCommand", "UnregisterCallback", "AfterRedisplay")

If you execute this command, the AfterRedisplay callback is unregistered.