The connectionHandle which gets passed to RfcServerFunction can be used to call back into SAP to get metadata and call functions.
I also tried to add Ping but it always returned RFC_INVALID_HANDLE.
SapServer.InstallGenericServerFunctionHandler(clientParameters, (connection, function) =>
{
// call back into SAP to get metadata and call functions
var functionMetadata = connection.GetFunctionMetadata("BAPI_SOME_FUNCTION_NAME");
var typeMetadata = connection.GetTypeMetadata("MY_STRUCT");
using (var fn = connection.CreateFunction("BAPI_SOME_FUNCTION_NAME"))
{
fn.Invoke();
}
// handle the actual server function call
switch (function.GetName())
{
case "BAPI_SOME_FUNCTION_NAME":
function.SetResult(new { RESULT = "X" });
break;
}
});
The
connectionHandle
which gets passed toRfcServerFunction
can be used to call back into SAP to get metadata and call functions. I also tried to addPing
but it always returnedRFC_INVALID_HANDLE
.