Skip to Content
0
Former Member
Jul 11, 2012 at 06:30 PM

Establish New Connection to Bex Analyzer 7.0

126 Views

Dear Experts,

I'm trying to establish new connection to Bex Analyzer 7.0. I found the code below online. I'm getting the error at

"Set R3 = Run("BExAnalyzer.xla!sapBEXgetConnection", 0)". The error message is BexAnalyzer.xla! cannot be found.

Can someone help debug this? Thank you

-Dan

'----------------------------

' Connecting to the BW server

'----------------------------

Public Function GetSAPConnection() As Object

'Declare Objects

Dim R3, MyFunc, App, funcControl As Object

Dim init As Boolean

Set LogonControl = CreateObject("SAP.LogonControl.1") 'Create the SAP Logon control

Set R3 = Run("BExAnalyzer.xla!sapBEXgetConnection", 0) ' try to use existing BEx connection

If R3.logon(0, True) <> True Then 'Check we are logged on else create own connection

Set R3 = LogonControl.NewConnection 'Create a New SAP Connection

R3.RfcWithDialog = 1 '=====>To attach SAP GUI

With R3 'Get/Set log on parameters - usually pick up from a form or excel sheet

.CLIENT = "xxx" 'What is the client number of the SAP system?

.USER = "<Username>" 'User name (Must have RFC authorization)

.Password = "<password>" 'hummm shouldn't really hard code password…

.Language = "EN" 'Not really required, but still..

.SYSTEM = "<SystemID>" 'SystemID

.UseSAPLOgonIni = False 'important for automatic connections!

.ApplicationServer ="<server_name>" '"<Fully qualified name of message server>"

.SAPRouter = "<Router>" 'if saprouter is used

.SystemNumber = 00 'System Number

.logon 0, True

End With

If R3.logon(0, True) <> True Then

Exit Function

End If

End If

init = Run("BExAnalyzer.xla!sapBEXinitConnection", R3)

End Function