Skip to Content
avatar image
Former Member

How to use RFC_REMOTE_EXEC in NCo RFC Server?

We are using the RFC SDK for RFC Server and in that we are calling the SDK function RFC_REMOTE_EXEC to pass a table parameter to the RFC server...

Now I want to move on to NCo 3.0 platform and I want to use the same server function RFC_REMOTE_EXEC as I dont want to discriminate the Servers running NCO and SAP SDK . Can anyone help me out in implementing this....

I am using the Below ABAP code at SAP:

CALL FUNCTION 'RFC_REMOTE_EXEC' DESTINATION DEST

           EXPORTING

                     COMMAND = 'LISTN'

          TABLES

                     PIPEDATA = TABLE                //Passing The Table

          EXCEPTIONS

            SYSTEM_FAILURE        = 2.

       ENDIF.

NCo Server Code:

[RfcServerFunction(Name = "RFC_REMOTE_EXEC")]

    public static void RfcServerFunction(RfcServerContext ctx, IRfcFunction function)

    {

        string reqtext = null;

        RfcDestination rfcDestination = RfcDestinationManager.GetDestination("Qua");

        RfcRepository rfcRepository = rfcDestination.Repository;

        IRfcStructure rfcStructure = rfcRepository.GetStructureMetadata("S_TABLE").CreateStructure();

          

        Console.WriteLine("Received function call {0} from system {1}.",

        function.Metadata.Name,

        ctx.SystemAttributes.SystemID);

        IRfcTable rfcServer = function.GetTable("TABLE");

        if (rfcServer.Count == 1)

        {

            reqtext = rfcServer.GetValue("SHNUMBER").ToString();

            Console.WriteLine("REQUTEXT = {0}\n", reqtext.ToString());

        }

   }

When I am calling this function at DEST SAP is giving SYSTEM_FAILURE excepection.

Error log generated at .Net Server is as below.

>> Error entry 2016-03-13 18:00:45.766 [Thread 8]

[NAME=QUA ASHOST=QUA500 CLIENT=500 USER=MILAN PASSWD=******** SYSNR=02 SYSID=qua LANG=EN POOL_SIZE=5 MAX_POOL_SIZE=10]

SAP.Middleware.Connector.RfcInvalidStateException: metadata for function RFC_REMOTE_EXEC not available: FU_NOT_FOUND: Function module RFC_REMOTE_EXEC does not exist

   at SAP.Middleware.Connector.RfcRepository.LookupFunctionMetadataNew(String name)

   at SAP.Middleware.Connector.RfcRepository.LookupFunctionMetadata(String name)

   at SAP.Middleware.Connector.RfcRepository.GetFunctionMetadata(String name)

>> Error entry 2016-03-13 18:00:45.772 [Thread 8]

SAP.Middleware.Connector.RfcInvalidStateException: metadata for function RFC_REMOTE_EXEC not available: FU_NOT_FOUND: Function module RFC_REMOTE_EXEC does not exist

   at SAP.Middleware.Connector.RfcRepository.LookupFunctionMetadataNew(String name)

   at SAP.Middleware.Connector.RfcRepository.LookupFunctionMetadata(String name)

   at SAP.Middleware.Connector.RfcRepository.GetFunctionMetadata(String name)

   at SAP.Middleware.Connector.ServerFunctionInfo.get_FunctionMetadata()

   at SAP.Middleware.Connector.RfcServer.InvokeServerFunction(RfcConnection conn, ServerFunctionInfo serverFuncInfo, RfcServerFunction functionImp)

   at SAP.Middleware.Connector.RfcServer.Dispatch(RfcConnection conn)

>> Error entry 2016-03-13 18:00:45.797 [Thread 8]

SAP.Middleware.Connector.RfcInvalidStateException: metadata for function RFC_REMOTE_EXEC not available: FU_NOT_FOUND: Function module RFC_REMOTE_EXEC does not exist

   at SAP.Middleware.Connector.RfcRepository.LookupFunctionMetadataNew(String name)

   at SAP.Middleware.Connector.RfcRepository.LookupFunctionMetadata(String name)

   at SAP.Middleware.Connector.RfcRepository.GetFunctionMetadata(String name)

   at SAP.Middleware.Connector.ServerFunctionInfo.get_FunctionMetadata()

   at SAP.Middleware.Connector.RfcServer.InvokeServerFunction(RfcConnection conn, ServerFunctionInfo serverFuncInfo, RfcServerFunction functionImp)

   at SAP.Middleware.Connector.RfcServer.Dispatch(RfcConnection conn)

   at SAP.Middleware.Connector.RfcConnection.Dispatch()

   at SAP.Middleware.Connector.RfcConnection.RfcServerWorkerThreadProc(Object rfcConnObj)

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Mar 14, 2016 at 10:09 AM

    Hi,

    please check the tutorial included in the download of the NCo 3.0. In addition you might want to have a look at NCo 3.0 blog .

    Best regards,

    Markus

    Add comment
    10|10000 characters needed characters exceeded

    • Hello Milan,


      How many stateless server connections are created depends on the configuration of your server. So, only if you start the instance multiple times on different machines, you will get more connections. Please note that when using the same programID, you will not be able to determine, which of the server instances will retrieve the function request.

      Best regards,

      Markus