VBA

VBA · 21. September 2022
Custom Slide Show in Microsoft PowerPoint
It has been a while since I wrote the last blog post. But there happened a lot in the last two months. We had our Deep Dives about Self Service with SAP Data Analytics Cloud Architecture and I had also some weeks of vacation. Now I am back from my vacation, and now I want to share some ideas I had in the last months. This post is about Microsoft PowerPoint and how I use it to create a master PowerPoint file for different purposes. The idea was to have one place for all my SAP Data Warehouse...
VBA · 07. October 2015
Before you can use Analysis for Office with Visual Basic for Application, you have to load the Analysis Addin. The code for this is in Analysis for 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 for Office 2.0, SAP has changed the name of the addin. The command is now: 1 2 3 4 5 6...
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.