Quantcast
Channel: SCN : All Content - Scripting Languages
Viewing all articles
Browse latest Browse all 522

Problem with the RFC Connection Object

$
0
0

Good day together,

 

i work since two days on a problem - without any solution. Iam sure the solution is kind of easy, maybe one codeline.

 

I build up my RFC Connection with my Access-AddIn. In this Addin i have a simple module:

 

Public rfcLogon As Object

Public rfcConnection As Object

Public rfcFunctions As Object

Public rfcDataTable As Object

 

 

 

 

Function setRfcConnection() As Boolean

    On Error Resume Next

   

    Set rfcLogon = CreateObject("SAP.Logoncontrol.1")

    Set rfcConnection = rfcLogon.NewConnection

   

    rfcConnection.ApplicationServer = "XXXX"

    rfcConnection.System = "XXXXX"

    rfcConnection.SystemNumber = 46

    rfcConnection.User = "XXXXX"

    rfcConnection.Password = "XXXXXX"

    rfcConnection.Client = "470"

    rfcConnection.Language = "DE"

   

    setRfcConnection = rfcConnection.Logon(0, True)

    If Not setRfcConnection Then qp.RFC.rfcConnection.LastError

End Function

 

 

Sub closeRfcConnection()

    If rfcConnection Is Nothing Then Exit Sub

    rfcConnection.Logoff

    Set rfcLogon = Nothing

    Set rfcConnection = Nothing

End Sub

 

 

 

When i start a procedure like this:

 

Sub Test()

    qp.RFC.setRfcConnection

    qp.RFC.closeRfcConnection

 

 

    qp.RFC.setRfcConnection

End Sub

 

 

 

 

... i get an error at the second call of setRfcConnection from the RFC:

 

 

Error Group

 

 

RFC_ERROR_SYSTEM_FAILURE

 

 

Message

 

 

>>> RfcOpenEx ...

Got following connect_param string:

   USER=ME_CPIC CLIENT=470 LANG=DE PASSWD=******* <<< RfcOpenEx failed

 

 

 

I cant start a new Connection until i close Access and start it again. My first thoughts were this is because I did not reset the Object, but I did. Although I tried the .Logoff-Method. No solution :-/

 

Thanks a lot for any ideas and help.


Viewing all articles
Browse latest Browse all 522

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>