cancel
Showing results for 
Search instead for 
Did you mean: 

"client must not be null or empty"

Former Member
0 Kudos

Hi Folks,

I have a Windows Service that connects to a SAP client and calls a function module. I am getting the following error message: "client must not be null or empty".

Error Location:          SAP.Middleware.Connector.RfcConfigParameters

Procedure Name:      NormalizedCopyTo

Has anyone come across this error?

The code is as follows:

        Dim oRFCConfig As cDestinationConfiguration

        Dim oRFCDest As RfcDestination

        Try

            oRFCConfig = New cDestinationConfiguration()

            RfcDestinationManager.RegisterDestinationConfiguration(oRFCConfig)

            oRFCConfig.AddOrEditDestination(msInstanceName, 5, msUser, msPassword, msLanguage, msClient, msApplicationServer, msSystemNumber)

            oRFCDest = RfcDestinationManager.GetDestination(msInstanceName)

            Dim oRFCRepo As RfcRepository = oRFCDest.Repository

            Dim oRFCSend As IRfcFunction = oRFCRepo.CreateFunction("Y_PP_CONFIRMATION_TRANSFER")

            Dim tblConfirmation As IRfcTable = oRFCSend.GetTable("DATA")

            Dim tblReturn As IRfcTable = oRFCSend.GetTable("RETURN")

            'Do stuff

            oRFCSend.SetValue("DATA", tblConfirmation)

            oRFCSend.SetValue("RETURN", tblReturn)

             oRFCSend.Invoke(oRFCDest)

             'Do some more stuff

        Finally

            oRFCConfig.RemoveDestination(msInstanceName)

            RfcDestinationManager.UnregisterDestinationConfiguration(oRFCConfig)

        End Try

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I have found that the error message "system number must not be null or empty" is also being generated.

former_member197445
Contributor
0 Kudos

What is your type cDestinationConfiguration?  Are you trying to do an InMemoryDestinationConfiguration?

Former Member
0 Kudos

That's right.

Here it is:

Imports SAP.Middleware.Connector

Imports System.Collections.Generic

Public Class cDestinationConfiguration

    Implements IDestinationConfiguration

    Private mdicAvailableDestinations As Dictionary(Of String, RfcConfigParameters)

    Private moChangeHandler As RfcDestinationManager.ConfigurationChangeHandler

    Public Sub New()

        Try

            mdicAvailableDestinations = New Dictionary(Of String, RfcConfigParameters)()

        Catch e As CFException

            Throw e

        Catch e As Exception

            Throw New CFException(ConnectionString, MachineName, e)

        End Try

    End Sub

    <CLSCompliant(False)> _

    Public Function GetParameters(ByVal destinationName As String) As RfcConfigParameters Implements IDestinationConfiguration.GetParameters

        Try

            Dim foundDestination As RfcConfigParameters = Nothing

            mdicAvailableDestinations.TryGetValue(destinationName, foundDestination)

            Return foundDestination

        Catch e As CFException

            cSystem.LogEvent(e.Message)

            Throw e

        Catch e As Exception

            cSystem.LogEvent(e.Message)

            Throw New CFException(ConnectionString, MachineName, e)

        End Try

    End Function

    '//Our configuration supports events

    Public Function ChangeEventsSupported() As Boolean Implements IDestinationConfiguration.ChangeEventsSupported

        Return True

    End Function

    <CLSCompliant(False)> _

    Public Custom Event ConfigurationChanged As RfcDestinationManager.ConfigurationChangeHandler Implements IDestinationConfiguration.ConfigurationChanged

        AddHandler(ByVal value As RfcDestinationManager.ConfigurationChangeHandler)

            moChangeHandler = value

        End AddHandler

        RemoveHandler(ByVal value As RfcDestinationManager.ConfigurationChangeHandler)

            '//Do nothing

        End RemoveHandler

        RaiseEvent(ByVal sender As Object, ByVal e As EventArgs)

        End RaiseEvent

    End Event

    '//Removes the destination that is known under the given name

    Public Sub RemoveDestination(ByVal name As String)

        Try

            If name IsNot Nothing AndAlso mdicAvailableDestinations.Remove(name) Then

                moChangeHandler(name, New RfcConfigurationEventArgs(RfcConfigParameters.EventType.DELETED))

            End If

        Catch e As CFException

            Throw e

        Catch e As Exception

            Throw New CFException(ConnectionString, MachineName, e)

        End Try

    End Sub

    '//Allows adding or modifying a destination for a specific application server

    Public Sub AddOrEditDestination(ByVal name As String, ByVal poolSize As Integer, ByVal user As String, ByVal password As String, ByVal language As String, ByVal client As String, ByVal applicationServer As String, ByVal systemNumber As String)

        Try

            Dim parameters As New RfcConfigParameters()

            parameters(RfcConfigParameters.Name) = name

            parameters(RfcConfigParameters.PeakConnectionsLimit) = Convert.ToString(poolSize)

            parameters(RfcConfigParameters.IdleTimeout) = Convert.ToString(1) ' we keep connections for 10 minutes

            parameters(RfcConfigParameters.User) = user

            parameters(RfcConfigParameters.Password) = password

            parameters(RfcConfigParameters.Client) = client

            parameters(RfcConfigParameters.Language) = language

            parameters(RfcConfigParameters.AppServerHost) = applicationServer

            parameters(RfcConfigParameters.SystemNumber) = systemNumber

            Dim existingConfiguration As RfcConfigParameters

            '//If a destination of that name existed before, we need to fire a change event

            If mdicAvailableDestinations.TryGetValue(name, existingConfiguration) Then

                mdicAvailableDestinations(name) = parameters

                Dim eventArgs As New RfcConfigurationEventArgs(RfcConfigParameters.EventType.CHANGED, parameters)

                moChangeHandler(name, eventArgs)

            Else

                mdicAvailableDestinations(name) = parameters

            End If

        Catch e As CFException

            Throw e

        Catch e As Exception

            Throw New CFException(ConnectionString, MachineName, e)

        End Try

    End Sub

    Public Function DestinationInitialised(ByVal name As String) As Boolean

        Try

            Return mdicAvailableDestinations.ContainsKey(name)

        Catch e As CFException

            Throw e

        Catch e As Exception

            Throw New CFException(ConnectionString, MachineName, e)

        End Try

    End Function

End Class

MarkusTolksdorf
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi David,

this message means that the set of parameters is simply incomplete. RfcConfigParameters.CLIENT is either null or the empty String, which is not allowed. Check your implementation of IDestinationConfiguration again to ensure it's only allowing valid configuration sets.

Best regards,

Markus