VBA

VBA · 07. October 2015
Before you can use Analysis Office with Visual Basic for Application, you have to load the Analysis Addin. The code for this is in Analysis Office 1.4: 1 2 3 4 5 6 7 8 9 10 Private Sub EnableAnalysisOffice() Dim addin As COMAddIn For Each addin In Application.COMAddIns If addin.progID= "SBOP.AdvancedAnalysis.Addin.1" Then If addin.Connect= False Then addin.Connect= True End If Next End Sub In Analysis Office 2.0, SAP has changed the name of the addin. The command is now: 1 2 3 4 5 6 7 8 9 10...
VBA · 28. April 2015
When you get a date from BEx Analyzer or Analysis Office the Excel internal format is Text and not Date. This means that the sorting doesn't work correctly. Use the following VBA source code to convert easily text to date.
VBA · 09. January 2015
In Excel you can quickly create very complex formulas. If you want to simplify your formula, you can also write your own function in VBA. Here is an example for calculating the percentage variance from the previous year. 1 2 3 4 5 Option Explicit Public Function prozent(source As Double, target As Double) prozent = Application.WorksheetFunction.IfError(IIf(target < 0,(source - target) / -target, (source - target) / target), 0) End Function As you can see, a very simple formula. For this...
VBA · 08. January 2015
There is an easy way to delete the contents of an array. Is possible by the command Erase 1 2 3 4 5 6 7 8 9 10 11 Option Explicit Sub FeldBeispiel() Dim fFeld(5, 5) As Integer fFeld(3, 3) = 3 MsgBox fFeld(3, 3) Erase fFeld MsgBox fFeld(3, 3) End Sub
VBA · 18. November 2014
In 7.0 and 3.5 you can open workbooks via VBA. This is useful if you want to automate reporting. The command for BEx Analyzer is:

VBA · 08. November 2014
If you want to import source code from a text file, you can use the following code.

VBA · 23. October 2014
If you want to start a Process Chain and you maybe haven't got the rights in the BW, you can start a Process Chain by VBA. Use the following source code:

VBA · 22. October 2014
If you have created your own SAP function module, you can use this with the following VBA code. Sub FunctionModule() 'Variables Definition Dim MyFunc As Object Dim E_INSERTED As Object Dim E_MODIFIED As Object Dim DATA As Object Set MyFunc = R3.Add("Z_RSDRI_UPDATE_LCP") 'FunctionModule Name in SAP BW Set E_INSERTED = MyFunc.imports("E_INSERTED") 'InsertFunction in SAP BW Set E_MODIFIED = MyFunc.imports("E_MODIFIED") 'ModifyFunction in SAP BW Set DATA = MyFunc.tables("I_T_DATA") 'Table to store...

VBA · 04. September 2014
You want to use Visual Basic Application (VBA) to connect to your SAP System? With BEx Analyzer you use the SAP.Functions and with Analysis Office you can use the command SAPLogon.