[英]Error 61704 during calling RFC_READ_TABLE in VBA
我正在尝试通过 RFC 对象连接到 SAP:
Dim sap As Object
Set sap = CreateObject("SAP.Functions.unicode")
sap.connection.system = "xxxxxxxx"
sap.connection.Client = "700"
sap.connection.User = "USER"
sap.connection.Password = "PASS"
sap.connection.Language = "EN"
If sap.connection.Logon(1, False) <> True Then 'Try Logon
MsgBox "Cannot Log on to SAP"
End If
'*************************************************************
'Define the table specifics
'************************************************************
Dim objRfcFunc As Object
Set objRfcFunc = sap.Add("RFC_READ_TABLE") 'IN THIS LINE MY ERROR OCCURS
内部应用程序错误 - 运行时错误:61704
有什么解决办法吗?
我从这里获取并调整了以下代码对我有用。 当然,您还必须更改连接参数(用户名等)。 我想你的问题是你一开始就没有联系。
Sub Test_RFC()
' Connect to SAP
Dim oSAP As Object
Set oSAP = CreateObject("SAP.Functions.unicode")
' Connection parameters - to be adjusted
oSAP.Connection.ApplicationServer = "1.1.1.1" ' IP des Appl-Servers (SM51->Details)
oSAP.Connection.SystemNumber = "01" ' Systemnummer, meißt im Namen des Appl-Servers enthalten
oSAP.Connection.System = "XD1" ' Entwicklungs-, Test-, Produktivsystem
oSAP.Connection.Client = "100" ' Mandant
oSAP.Connection.Language = "DE" ' Sprache "EN", "DE" ...
' RFC-Login: Show logon popup
If oSAP.Connection.Logon(0, False) = True Then
'You can only add a function module in case you have a connection
Dim oFuBa As Object
Set oFuBa = oSAP.Add("RFC_READ_TABLE")
End If
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.