cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with RfcDestinationManager.UnregisterDestinationConfiguration(SaPconfiguration)

Former Member
0 Kudos

I use the following code to make a SAP Connection :

Public

Shared Function CreateSapConnection (ByVal connectionString As String, ByRef exc As Exception) As RfcDestination

       

Try

           

SaPconfiguration =  New ECCDestinationConfig


           

RfcDestinationManager.RegisterDestinationConfiguration(SaPconfiguration)
   

           

Dim sapConn As RfcDestination = RfcDestinationManager.GetDestination(connectionString)

           

           

Return sapConn


       

Catch ex As Exception

           

SendMail.SendMail(Nothing, "Error Sap Connection : " & ex.Message)

           

Dim errNoConnection As New Exceptions.ConnectionError("SAP Error : " & ex.Message)


exc = errNoConnection


Return Nothing

       

End Try

   

End Function

----------------------------------------------------------------------------------------------------------------

Public Shared Sub CloseSapConnection(ByRef exc As Exception, ByVal remark As String)


       

Try


RfcDestinationManager.UnregisterDestinationConfiguration(SaPconfiguration)

       

Catch ex As Exception

' Log error....

       

End Try


   

End Sub

-----------------------------------------------------------------------------------------------------------------

I use 'CreateSapConnection', do my Sap stuff and use 'CloseSapConnection'.

I now get irregularly 'Invalid destination configuration' and after that always 'Destination configuration already initialized'.

Anybody any idea to trace the problem or to solve this.

Thanks in advance,

Hans

Accepted Solutions (0)

Answers (2)

Answers (2)

MarkusTolksdorf
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Hans,

a destination should not be treated as connection, it is only reflecting the configuration and allows to invoke a function module in the configured system. An implementation of IDestinationConfiguration is even more, it's reflecting the whole set of existing configured destinations. Hence, if you implement a destination storage of your own, you should only register it once when starting up your application. Afterwards, simply get the destination via RfcDestinationManager and invoke the function module. Connection management is done internally within NCo. No need to open or close connections, this is done by the NCo runtime.

Best regards,

Markus

LJB
Contributor
0 Kudos

Moved by Moderator, not an EP-KMC related issue