Public Sub Workbook_SAP_Initialize()
' 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")
'Call Application.Run("SAPExecuteCommand", "RegisterCallback", "BeforeMessageDisplay", "Callback_BeforeMessageDisplay")
'Call Application.Run("SAPExecuteCommand", "RegisterCallback", "BeforeFirstPromptsDisplay", "Callback_BeforeFirstPromptsDisplay")
End Sub
Sub Callback_AfterRedisplay()
'just do it sometning :)
End Sub
Bex 7
Sub CallBack(ParamArray varname())
Application.Interactive = False
Application.EnableEvents = False
Application.DisplayAlerts = False
Application.ScreenUpdating = False
On Error Resume Next: Err
Dim lData_Provider As String
lData_Provider = Right(varname(2), 11)
Set lRange = varname(1)
....
Err:
Application.Interactive = True
Application.EnableEvents = True
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Bex 7
Sub CallBack(ParamArray varname())
Application.Interactive = False
Application.EnableEvents = False
Application.DisplayAlerts = False
Application.ScreenUpdating = False
On Error Resume Next: Err
Dim lData_Provider As String
lData_Provider = Right(varname(2), 11)
Set lRange = varname(1)
....
Err:
Application.Interactive = True
Application.EnableEvents = True
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
User function (should be defined in module)
'Join dimension
Function JoinDim(DimName As String, Optional delimiter As String = ";")
JoinDim = ""
'SAPListOfMembers returns unique list values of dimension
'But result depends of characteristic setting
'so you can receive one-dimensional or multi-dimensional array as result
Dim Dimension As Variant
Dimension = Application.Run("SAPListOfMembers", "DS_1", "FILTER", DimName)
Dim l As Integer
m = UBound(Dimension)
For Each a In Dimension
i = i + 1
If i = m + 1 Then 'take only 2nd values
'Exit For 'if you would like to take 1ts values
JoinDim = ""
ElseIf i = m + m + 1 Then
Exit For
End If
If a <> "#" And a <> "#/#" Then
If InStr(1, JoinDim, a, vbTextCompare) = 0 Then
If Len(JoinDim) > 0 Then
JoinDim = JoinDim & delimiter
End If
JoinDim = JoinDim & a
End If
End If
Next a
End Function
'ZL_PORT
https://www.reyemsaibot.com/2016/07/25/analysis-office-infofields-formulas-dashboard-functions/
RIBBON
https://www.reyemsaibot.com/2016/12/01/analysis-office-2-4-customize-user-interface/
https://answers.sap.com/questions/223594/sap-analysis-25-custom-ribbon-macro.html
https://help.sap.com/viewer/5dd171bef6df457d9172164f7fd7dd7c/2.5.2.0/en-US/a4dcdbabddad45c085c8179f3fe28f0b.html
https://www.youtube.com/watch?v=X1jXGF8NiFs
Sub Button1_Click()
Dim lResult As Long
lResult = Application.Run("SAPExecuteCommand", "PlanDataSave")
End Sub