on 03-08-2016 9:09 AM
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)
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Milan,
the metadata to use for RFC_REMOTE_EXEC is available in the demo programs of NetWeaver RFC SDK. Download the SDK and check the example program rfcexec.cpp for the definition to use for the function module. You should also do checks on the command in your implementation as proposed in the sample to prevent attacks by calls to arbitrary OS commands.
Best regards,
Markus
Hello Milan,
simply have a look at RfcStructureMetaData, RfcFieldMetaData, RfcTableMetaData, RfcParameterMetaData, and RfcFunctionMetaData. The first one is there to create structures, the second one for tables, and the last one for the function modules. With RfcStructureMetaData.AddField(RfcFieldMetaData) you can add fields to structure, with Rfc.FunctionMetaData.AddParameter(RfcParamaterMetaData) parameters to function modules. Read the API documentation for those classes to understand better how this is supposed to be used.
Best regards,
Markus
Thanks Markus for the solution...
I have implemented the RFC Server successfully
But while running RFC server there are more then 6 entries of registered server are getting generated in SAP logged on client for a single instance of RFC .net Server is running.I would be glad to know the reason and impact of this on performance in case more then 200 RFC server get connected to SAP?
Regards,
Milan
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
User | Count |
---|---|
81 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.