reyemsaibot

SAP BI Blog about SAP BW/4HANA, Analysis for Office and SAP HANA - by Tobias Meyer

Connecting error in SAP Analysis for Office via VBA

The following source code allows you to connect your DataSource to a BW system. The workbook must contain a DataSource (DS_1). At this moment
you can’t open a workbook like BEx 3.5 or 7.0. In Analysis for Office
2.3
you have now the option to open a workbook with the function SAPOpenWorkbook.

1
2
3
4
5
6
Sub SAPBWLogon()

Dim lResult As Long
lResult = Application.Run("SAPLogon", "DS_1", "CLIENT", "USER", "PASSWORD", "LANGUAGE")

End Sub

 

If you display the design area of Analysis for Office, you receive the following error:

Analysis for Office .Net Framework error
.Net Framework error

The data source shows no field and you cannot select anything.

Analysis for Office empty data source area
Empty data source area

After you logon to the BW system, you have to refresh the DataSource first. The following source code login and refresh the DataSource:

 

1
2
3
4
5
6
7
8
Sub SAPBWLogon()

Dim lResult As Long

lResult = Application.Run("SAPLogon", "DS_1", "CLIENT", "USER", "PASSWORD", "LANGUAGE")
lResult = Application.Run("SAPExecuteCommand", "Refresh", "DS_1")

End Sub 

author.


I am Tobias, I write this blog since 2014, you can find me on twitter and youtube. If you want you can leave me a paypal coffee donation. You can also contact me directly if you want.

Kommentare

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert