Example: RFC Function with an Export Parameter 

The following example calls the RFC function GET_SYSTEM_NAME, which has no import parameter. It has one export parameter, namely SYSTEM_NAME, providing the name of the system the client is connected to.

This example, too, uses a properties file to set up the necessary connection information.

// Obtain an instance of the SessionManager and start a session
SessionManager sessionMgr = SessionManager.getInstance();
SessionMgr.open();
// Get a module factory object and create the module
IRfcModule rfcModule = sessionMgr.getRfcModuleFactory().autoCreateRfcModule("GET_SYSTEM_NAME");
int retCode = rfcModule.callReceive();
// Get the value of the simple export parameter
String sysName = rfcModule.getSimpleExportParam("SYSTEM_NAME").getString();
System.out.println("System name = " + sysName);
// Close the session
sessionMgr.close();