cancel
Showing results for 
Search instead for 
Did you mean: 

Problem connecting Excel 64 bit VBA code to SAP RFCs

mike_rupp
Participant
0 Kudos

For years, we've been using Excel VBA to perform various SAP RFCs.
We are now being forced to move to Office 64 bit, and eventually to Office 365.
According to SAP note 2724656, 64 bit versions of the NWRFC are supported under SAP GUI 770.
We have installed SAP GUI 770 with the optional 64 bit RFC controls and I have verified that new .OCX and .DLL files have been added to folder C:\Program Files\SAP\FrontEnd\SapGui. I also explicitly added the .OCX files into the VBA references list.


    Sub Non_Unicode_Logon()

'-Variables-------------------------------------------------------
Dim SAPFunc, Connection, SAPConnection
Dim PingFunc, retPing, exceptPing

'-Get SAP.Functions-----------------------------------------------
Set SAPFunc = CreateObject("SAP.Functions")
If Not IsObject(SAPFunc) Then
MsgBox "CreateObject(SAP.Functions) failed", vbOKOnly, "Error"
Exit Sub
End If

'-Get SAP.LogonControl connection---------------------------------
Set Connection = SAPFunc.Connection()
If Not IsObject(Connection) Then
MsgBox "SAPFunc.Connection failed", vbOKOnly, "Error"
Exit Sub
End If

'-Set connection parameters---------------------------------------
Connection.client = "301"
Connection.Language = "EN"
Connection.User = "MRUPP"
'Connection.Password = "********"
'Connection.System = "PRD"
'Connection.HostName = "pxsyprd"
'Connection.SystemNumber = 0

'-Connect SAP system----------------------------------------------
SAPConnection = Connection.Logon(0, vbFalse)
If SAPConnection <> 0 Then

'-Call ABAP function module RFC_PING ---------------------------
Set PingFunc = SAPFunc.Add("RFC_PING")
If IsObject(PingFunc) Then
retPing = PingFunc.Call()
If retPing = False Then
exceptPing = PingFunc.Exception()
MsgBox CStr(exceptPing), vbOKOnly, "Result"
Else
MsgBox CStr(retPing), vbOKOnly, "Result"
End If
End If

'-Logoff--------------------------------------------------------
SAPConnection = Connection.Logoff()

Else
MsgBox "Connection.Logon failed", vbOKOnly, "Error"
End If

End Sub

When the code tries to connect to the SAP system, I get the expected pop-ups.

And then the following error message:
(note that is seems to still be looking at the Program Files (x86) folder.

Error Group
RFC_ERROR_COMMUNICATION
Message

LOCATION CPIC (TCP/IP) on local host with Unicode
ERROR SncPDLInit()==SNCERR_INIT Unable to load GSS-API DLL
named "C:\Program Files (x86)\SAP\FrontEnd\SAPgui\gssntlm.dll"

TIME Thu Dec 14 11:50:23 2023
RELEASE 753
COMPONENT SNC (Secure Network Communication)
VERSION 6
RC -1
MODULE D:/depot/bas/753_REL/src/krn/snc/sncxxdl.c
LINE 462
DETAIL LoadLibrary("C:\Program Files (x86)\SAP\FrontEnd\SAPgui\gssntlm.dll")



Accepted Solutions (1)

Accepted Solutions (1)

mike_rupp
Participant
0 Kudos

I have discovered the root causes of my problem and reached partial success in resolving it.

  1. Excel VBA was trying to load file gssntlm.dll from the 32 bit path "C:\Program Files (x86)\ . . ." instead of following the 64 bit path "C:\Program Files\ . . .". This was because of windows environment variable SNC_LIB. and the lack of environment variable SNC_LIB_64. After adding SNC_LIB_64 I can now specify whatever path I want.
  2. The next issue is that there is no gss*.dll file in the 64 bit SAPgui folder. As a long shot, I tried copying the 32 bit gssntlm.dll to the 64 bit folder but of course it didn't work. I have also searched on-line for a 64 bit equivalent but didn't find anything.
  3. Since gssntlm.dll is associated with SNC (Secure Network Communications) and with SAP logon functions, it follows that it is necessary for SAP_Single_Sign_On.

    In Excel, we were trigger SAP_Single_Sign_On by withholding several key pieces of logon information:

    · User Password

    · SAP SID (system ID)

    · SAP Host Name

    However, when all parameters are provided in the logon call, we bypass the need to load gssntlm.dll
    and a connection was finally achieved. So partial success, but would still like to get Single_Sign_On working again.

Answers (1)

Answers (1)

mike_rupp
Participant
0 Kudos

Found the missing DLL file in SAP note 2115486.
It looks to me like I need GX64NTLM.DLL
However, there are 4 separate 64 bit DLLs depending on your Security & Processor.