I have implemented below code for below.
- - Open Workbook in Display Mode .
- - Workbook_SAP_Iniitalize registers Call back for After Display
- - Callback_Afterdisplay Subroutine to display Plan Data. The reason for this is to make sure that the data is displayed in Display mode after the prompt screen is executed.
The workbook opens up in display mode, which works well. However this doesn’t work the way I expected.
Please see the steps followed below.
- - Open the workbook (it open in display mode),
- - Go into change mode (open in change mode as expected)
- - Change the Prompt
After entering the prompt, I expected this to open in display mode (because of the code) but it doesn’t . Please can someone point out what’s wrong here.
Public Sub Workbook_SAP_Initialize()
Dim lResult As Long
' Register Callbacks
Call Application.Run("SAPExecuteCommand", "RegisterCallback", "AfterRedisplay", "Callback_AfterRedisplay")
Call Application.Run("SAPExecuteCommand", "RegisterCallback", "BeforePlanDataSave", "Callback_BeforePlanDataSave")
' Call Application.Run("SAPExecuteCommand", "RegisterCallback", "BeforePlanDataReset", "Callback_BeforePlanDataReset")
' Set Queries to Display Mode
Application.ScreenUpdating = False
lResult = Application.Run("SAPExecuteCommand", "Refresh")
lResult = Application.Run("SAPExecuteCommand", "PlanDataToDisplayMode")
' lResult = Application.Run("SAPExecutePlanningSequence", "PS_XX")
Application.ScreenUpdating = True
End Sub
Public Sub Callback_AfterRedisplay()
lResult2 = Application.Run("SAPGetProperty", "IsDataSourceEditable", "DS_1")
If lResult2 = True Then
lResult = Application.Run("SAPExecuteCommand", "PlanDataToDisplayMode")
End If
End Sub