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](https://image.jimcdn.com/app/cms/image/transf/none/path/s1c89cca4309ebad9/image/i686936c310534d4c/version/1603115235/analysis-for-office-net-framework-error.png)
The data source shows no field and you cannot select anything.
![Analysis for Office empty data source area](https://image.jimcdn.com/app/cms/image/transf/none/path/s1c89cca4309ebad9/image/id5a244d8a3f1e8fd/version/1603115285/analysis-for-office-empty-data-source-area.png)
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 |
These posts might also be interesting:
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.
![](https://image.jimcdn.com/app/cms/image/transf/dimension=250x180:format=jpg/path/s1c89cca4309ebad9/image/ifbcbd6254b84b440/version/1579612443/image.jpg)
![](https://image.jimcdn.com/app/cms/image/transf/dimension=250x180:format=png/path/s1c89cca4309ebad9/image/iceb7c340a3cdfd11/version/1547207729/image.png)
Write a comment