SAP NetWeaver RFC SDK 7.50
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
API for Automated Servers

Functions for managing "automated" Servers (also called "multi-count" Servers). More...

Classes

struct  _RFC_CERTIFICATE_DATA
 Compact structure containing relevant information about the x509 certificate provided by the RFC client. More...
 
struct  _RFC_AUTHENTICATION_HANDLE
 Handle to an authentication object which gives access to relevant authentication data received from the client. More...
 
struct  _RFC_SERVER_HANDLE
 Handle to an automated ("multi-count") RFC Server, which can manage multiple parallel listening server sessions. More...
 
struct  _RFC_SERVER_ATTRIBUTES
 Information about an RFC Server returned by RfcGetServerAttributes(). More...
 
struct  _RFC_SESSION_CHANGE
 Notifies an RFC Server that a stateful user session has just been created or destroyed. More...
 
struct  _RFC_STATE_CHANGE
 Notifies the application that an RFC Server changed its state (e.g. More...
 
struct  _RFC_SERVER_MONITOR_DATA
 Allows to retrieve monitoring information about all busy or idle connections of an automated RFC Server via RfcGetServerConnectionMonitorData(). More...
 

Enumerations

enum  _RFC_AUTHENTICATION_TYPE { RFC_AUTH_NONE, RFC_AUTH_BASIC, RFC_AUTH_X509, RFC_AUTH_SSO }
 Type of authentication method used by the backend authentication handler (RFC_ON_AUTHENTICATION_CHECK). More...
 
enum  _RFC_SERVER_STATE {
  RFC_SERVER_INITIAL, RFC_SERVER_STARTING, RFC_SERVER_RUNNING, RFC_SERVER_BROKEN,
  RFC_SERVER_STOPPING, RFC_SERVER_STOPPED
}
 Used in state information in order to indicate the current state of an RFC Server. More...
 
enum  _RFC_SESSION_EVENT { RFC_SESSION_CREATED, RFC_SESSION_ACTIVATED, RFC_SESSION_PASSIVATED, RFC_SESSION_DESTROYED }
 Used in a server session change listener to notify the application whenever a new user session on the server gets started or ends. More...
 

Functions

DECL_EXP RFC_SERVER_HANDLE SAP_API RfcCreateServer (RFC_CONNECTION_PARAMETER const *connectionParams, unsigned paramCount, RFC_ERROR_INFO *errorInfo)
 This function can be used to start "automatic" servers. More...
 
DECL_EXP RFC_RC SAP_API RfcDestroyServer (RFC_SERVER_HANDLE serverHandle, RFC_ERROR_INFO *errorInfo)
 Cleans up and destroys an automatic server object, once you are done with it. More...
 
DECL_EXP RFC_RC SAP_API RfcLaunchServer (RFC_SERVER_HANDLE serverHandle, RFC_ERROR_INFO *errorInfo)
 Starts up an automatic server, so that it starts waiting for incoming requests and processes them. More...
 
DECL_EXP RFC_RC SAP_API RfcShutdownServer (RFC_SERVER_HANDLE serverHandle, unsigned timeout, RFC_ERROR_INFO *errorInfo)
 Stops an automatic server, so that it no longer accepts incoming requests. More...
 
DECL_EXP RFC_RC SAP_API RfcGetServerAttributes (RFC_SERVER_HANDLE serverHandle, RFC_SERVER_ATTRIBUTES *serverAttributes, RFC_ERROR_INFO *errorInfo)
 Retrieves detailed information about a multi-count Registered Server or a TCP Socket Server. More...
 
DECL_EXP RFC_RC SAP_API RfcGetServerConnectionMonitorData (RFC_SERVER_HANDLE serverHandle, unsigned *numberOfConnections, RFC_SERVER_MONITOR_DATA **connectionData, RFC_ERROR_INFO *errorInfo)
 Retrieves detailed information about all clients currently connected to a multi-count Registered Server or a TCP Socket Server. More...
 
DECL_EXP RFC_RC SAP_API RfcDestroyServerConnectionMonitorData (unsigned numberOfConnections, RFC_SERVER_MONITOR_DATA *connectionData, RFC_ERROR_INFO *errorInfo)
 Releases all internal memory hold by monitor data object. More...
 
DECL_EXP RFC_RC SAP_API RfcAddServerErrorListener (RFC_SERVER_HANDLE serverHandle, RFC_SERVER_ERROR_LISTENER errorListener, RFC_ERROR_INFO *errorInfo)
 Adds an error listener to this server. More...
 
DECL_EXP RFC_RC SAP_API RfcAddServerStateChangedListener (RFC_SERVER_HANDLE serverHandle, RFC_SERVER_STATE_CHANGE_LISTENER stateChangeListener, RFC_ERROR_INFO *errorInfo)
 Adds a state change listener to this server. More...
 
DECL_EXP RFC_RC SAP_API RfcAddServerSessionChangedListener (RFC_SERVER_HANDLE serverHandle, RFC_SERVER_SESSION_CHANGE_LISTENER sessionChangeListener, RFC_ERROR_INFO *errorInfo)
 Adds a session change listener to this server. More...
 
DECL_EXP RFC_RC SAP_API RfcSetServerStateful (RFC_CONNECTION_HANDLE connectionHandle, unsigned isStateful, RFC_ERROR_INFO *errorInfo)
 Sets this client's operation mode to statefull or stateless. More...
 
DECL_EXP RFC_RC SAP_API RfcGetAuthenticationType (RFC_AUTHENTICATION_HANDLE authenticationHandle, RFC_AUTHENTICATION_TYPE *type, RFC_ERROR_INFO *errorInfo)
 Gets the type of authentication data received from the backend in RFC_ON_AUTHENTICATION_CHECK. More...
 
DECL_EXP RFC_RC SAP_API RfcGetAuthenticationUser (RFC_AUTHENTICATION_HANDLE authenticationHandle, const SAP_UC **user, unsigned *length, RFC_ERROR_INFO *errorInfo)
 Gets the user to authenticate in RFC_ON_AUTHENTICATION_CHECK if any is received. More...
 
DECL_EXP RFC_RC SAP_API RfcGetAuthenticationPassword (RFC_AUTHENTICATION_HANDLE authenticationHandle, const SAP_UC **password, unsigned *length, RFC_ERROR_INFO *errorInfo)
 Gets the password for authentication in RFC_ON_AUTHENTICATION_CHECK if basic authentication method was setup in the backend. More...
 
DECL_EXP RFC_RC SAP_API RfcGetAuthenticationAssertionTicket (RFC_AUTHENTICATION_HANDLE authenticationHandle, const SAP_UC **assertionTicket, unsigned *length, RFC_ERROR_INFO *errorInfo)
 Gets the assertionTicket for authentication in RFC_ON_AUTHENTICATION_CHECK if SSO based authentication method was setup in the backend. More...
 
DECL_EXP RFC_RC SAP_API RfcGetAuthenticationCertificateData (RFC_AUTHENTICATION_HANDLE authenticationHandle, const RFC_CERTIFICATE_DATA **certificateData, RFC_ERROR_INFO *errorInfo)
 Gets the certificate chain for authentication in RFC_ON_AUTHENTICATION_CHECK if x509 authentication method was setup in the backend. More...
 

Detailed Description

Functions for managing "automated" Servers (also called "multi-count" Servers).

Enumeration Type Documentation

Type of authentication method used by the backend authentication handler (RFC_ON_AUTHENTICATION_CHECK).

Enumerator
RFC_AUTH_NONE 

No authentication data was provided.

RFC_AUTH_BASIC 

Authentication with user and password.

RFC_AUTH_X509 

Authentication with x509 certificate.

RFC_AUTH_SSO 

Authentication with assertion ticket.

Definition at line 372 of file sapnwrfc.h.

Used in state information in order to indicate the current state of an RFC Server.

Enumerator
RFC_SERVER_INITIAL 

The server object has been created, but nothing has been done with it yet.

RFC_SERVER_STARTING 

The server has been started, but startup is not yet complete and the server is not yet able to receive/serve requests. Should quickly switch to RUNNING or BROKEN.

RFC_SERVER_RUNNING 

Means at least one registration is still able to accept request from the gateway (in case of Registered Server), or that the server port is open and listening (in case of TCP Socket Server).

RFC_SERVER_BROKEN 

Means that all registrations are dead, e.g. because of gateway being down (in case of Registered Server), or that for some reason server port could not be opened (in case of TCP Socket Server).

RFC_SERVER_STOPPING 

The server has been stopped via RfcShutdownServer() (with a timeout > 0) and is still busy processing ongoing requests. It is however no longer accepting new requests. Should switch to STOPPED, once the ongoing requests are finished.

RFC_SERVER_STOPPED 

The server has been stopped via RfcShutdownServer() and is currently not processing nor accepting any requests. The object, however, is still valid and can be started again anytime with RfcLaunchServer().

Definition at line 510 of file sapnwrfc.h.

Used in a server session change listener to notify the application whenever a new user session on the server gets started or ends.

Enumerator
RFC_SESSION_CREATED 

A new stateful user session has been created on the server. This can be done either by the server itself via RfcSetServerStateful(), or by the backend via function module RFC_SET_REG_SERVER_PROPERTY.

RFC_SESSION_ACTIVATED 

A function call came in from the backend and started processing. This event can probably be ignored by 99% of the applications.

RFC_SESSION_PASSIVATED 

A function call completed processing. This event can probably be ignored by 99% of the applications.

RFC_SESSION_DESTROYED 

A stateful user session has been destroyed, either by the server itself via RfcSetServerStateful(), or by the backend via function module RFC_SET_REG_SERVER_PROPERTY, or because the connection was closed (e.g. the corresponding ABAP user session ended or explicitly closed the connection), or because the connection was broken by network error/system failure etc. The application should now clean up all memory/resources allocated for the given session ID.

Definition at line 539 of file sapnwrfc.h.

Function Documentation

DECL_EXP RFC_RC SAP_API RfcAddServerErrorListener ( RFC_SERVER_HANDLE  serverHandle,
RFC_SERVER_ERROR_LISTENER  errorListener,
RFC_ERROR_INFO errorInfo 
)

Adds an error listener to this server.

An error listener is a callback function of type RFC_SERVER_ERROR_LISTENER. The server will execute this function, whenever a severe technical error happens outside the processing of function modules, e.g. network problems with the gateway or with the connected clients.

Parameters
[in]serverHandleA handle to the server object.
[in]errorListenerFunction pointer to a callback function receiving error notifications.
[out]*errorInfoAdditional error information in case adding the error listener fails, e.g. invalid handle.
Returns
RFC_RC
DECL_EXP RFC_RC SAP_API RfcAddServerSessionChangedListener ( RFC_SERVER_HANDLE  serverHandle,
RFC_SERVER_SESSION_CHANGE_LISTENER  sessionChangeListener,
RFC_ERROR_INFO errorInfo 
)

Adds a session change listener to this server.

A session change listener is a callback function of type RFC_SESSION_STATE_CHANGE_LISTENER. The server will execute this function, whenever a stateful user session starts or ends. A "stateful user session" is basically a one-to-one binding between a SAP user session on ABAP side and some kind of "user session" in your C program. State information can be kept on C side inbetween separate function calls from ABAP.

The server will also execute this function, whenever an ABAP function call begins or ends inside an existing stateful user session. For most applications, this probably does not matter, so this event can be ignored. There may however be cases, where some cleanup or reduction of consumed resources can be done, while a stateful user session is idle.

There are two ways to start a stateful user session:

  • The ABAP side requests to start a stateful sequence by calling RFM RFC_SET_REG_SERVER_PROPERTY with parameter EXCLUSIV = 'Y'
  • The C program, while currently processing a request from ABAP, can set the current connection to stateful via RfcSetServerStateful()

There are four ways a stateful user session can end:

  • The ABAP side ends the stateful sequence by calling RFM RFC_SET_REG_SERVER_PROPERTY with parameter EXCLUSIV = 'N'
  • The C program, while currently processing a request from ABAP, can end the current stateful session via RfcSetServerStateful()
  • The SAP user session on ABAP side ends.
    This can be, because the SAP user logs out, or ends the current internal mode by pressing the "yellow arrow" or "red cross" button or by switching to a new transaction via \n in the OK-code field.
  • Either the ABAP session or the C session runs into a severe problem (SYSTEM_FAILURE), upon which both sides get reset and the connection between the two sides gets closed.
  • The network connection gets destroyed by network problems, system crash etc.

An application that wants to work with stateful sessions, needs to react as follows to the various events:

  • RFC_SESSION_CREATED
    Do the necessary initialization of data or resources (like a database connection, etc.).
  • RFC_SESSION_PASSIVATED
    Most applications won't need this and can therefore ignore this event. One example, where this may be useful, is: if the function calls going on in this session are few and far between, but they occupy a lot of memory, it might be a good idea to flush the session state out to disc here, and load it back into memory, when the session gets activated again.
  • RFC_SESSION_ACTIVATED
    This is the counterpart to RFC_SESSION_PASSIVATED. In most cases it can safely be ignored. For an example where it might be useful to use it, see above.
  • RFC_SESSION_DESTROYED
    Do the necessary cleanup of data and other resources that have been used while processing the function calls of this session.
Parameters
[in]serverHandleA handle to the server object.
[in]sessionChangeListenerFunction pointer to a callback function receiving state change notifications.
[out]*errorInfoAdditional error information in case adding the state change listener fails, e.g. invalid handle.
Returns
RFC_RC
DECL_EXP RFC_RC SAP_API RfcAddServerStateChangedListener ( RFC_SERVER_HANDLE  serverHandle,
RFC_SERVER_STATE_CHANGE_LISTENER  stateChangeListener,
RFC_ERROR_INFO errorInfo 
)

Adds a state change listener to this server.

A state change listener is a callback function of type RFC_SERVER_STATE_CHANGE_LISTENER. The server will execute this function, whenever the server's state changes, e.g. from STARTED to ALIVE, or from ALIVE to STOPPING.

Parameters
[in]serverHandleA handle to the server object.
[in]stateChangeListenerFunction pointer to a callback function receiving state change notifications.
[out]*errorInfoAdditional error information in case adding the state change listener fails, e.g. invalid handle.
Returns
RFC_RC
DECL_EXP RFC_SERVER_HANDLE SAP_API RfcCreateServer ( RFC_CONNECTION_PARAMETER const *  connectionParams,
unsigned  paramCount,
RFC_ERROR_INFO errorInfo 
)

This function can be used to start "automatic" servers.

In contrast to RfcRegisterServer(), which registers one single server connection at a SAP gateway, RfcCreateServer() can be used to create a server object that manages multiple server connections in parallel, that takes care of automatically re-registering a connection in case it gets broken by network problems, etc. and that takes care of the dispatch-loop internally, so that application programmers no longer need to implement that error-prone task themselves. This means, you no longer need to use RfcListenAndDispatch() and no longer need to worry about creating multiple threads with such a listen- and dispatch-loop, if you want to process multiple parallel requests. All you need to do is starting an RFC_SERVER_HANDLE with RfcLaunchServer(), and it will listen for incoming requests on n parallel threads (as given by the parameter REG_COUNT).

In addition, you can start not only a usual registered Server that registers at an RFC gateway, but also a standalone Server that listens for requests on a network port and can be accessed by both, SAP systems and other external C-, Java- or .NET-based RFC client programs. Which kind of server is started, depends on the connection parameters:

Registered Server: Here you need to supply the standard parameters you would also use with RfcRegisterServer(). E.g. GWHOST, GWSERV and PROGRAM_ID, followed potentially by parameters for SNC, Trace, SAPRouter, etc. In addition you can supply the parameters REG_COUNT and MAX_REG_COUNT, if you want to process multiple requests in parallel (multiple gateway registrations). MAX_REG_COUNT is needed only for "stateful" RFC servers (see the sample sapnwrfc.ini for details). Alternatively to registering at only one fixed gateway, you can also provide parameters for "group registration". Then the server will register REG_COUNT connections at every gateway of the given logon group. Again see chapter 3 in the sapnwrfc.ini file.

For all types of servers you need to specify the parameter SERVER_NAME. This is a freely choosable name used for monitoring purposes.

After a server object has been created, it can be started and stopped any number of times via RfcLaunchServer() and RfcShutdownServer(). When the server is no longer needed, it must be cleaned up with RfcDestroyServer().

Parameters
[in]*connectionParamsArray of network parameters needed for starting the server.
[out]paramCountNumber of elements contained in the RFC_CONNECTION_PARAMETER array.
[out]*errorInfoAdditional error information in case the server object could not be created (e.g. invalid parameters or insufficient memory).
Returns
A handle to the created server object.
DECL_EXP RFC_RC SAP_API RfcDestroyServer ( RFC_SERVER_HANDLE  serverHandle,
RFC_ERROR_INFO errorInfo 
)

Cleans up and destroys an automatic server object, once you are done with it.

Any internal resources of this server object are released. Therefore make sure not to use the RFC_SERVER_HANDLE in any further API calls (RfcLaunchServer(), RfcShutdownServer(), etc), after you have destroyed it.

Parameters
[in]serverHandleA handle to the server object.
[out]*errorInfoNot much that can go wrong here.
Returns
RFC_OK
DECL_EXP RFC_RC SAP_API RfcDestroyServerConnectionMonitorData ( unsigned  numberOfConnections,
RFC_SERVER_MONITOR_DATA connectionData,
RFC_ERROR_INFO errorInfo 
)

Releases all internal memory hold by monitor data object.

Use this to free the data obtained from RfcGetServerConnectionMonitorData() once you no longer need it.

Parameters
[in]numberOfConnectionsNumber of elements in the connectionData array.
[in]connectionDataArray of connection data objects to be cleaned up.
[out]*errorInfoCan't go wrong...
Returns
RFC_OK
DECL_EXP RFC_RC SAP_API RfcGetAuthenticationAssertionTicket ( RFC_AUTHENTICATION_HANDLE  authenticationHandle,
const SAP_UC **  assertionTicket,
unsigned *  length,
RFC_ERROR_INFO errorInfo 
)

Gets the assertionTicket for authentication in RFC_ON_AUTHENTICATION_CHECK if SSO based authentication method was setup in the backend.

If a handler of type RFC_ON_AUTHENTICATION_CHECK is installed, this getter returns the assertionTicket for authentication set in the destination in the backend, i.e. SSO authentication was setup. The received authentication data is stored in the authentication handle, which can then by queried by the authentication handler RFC_ON_AUTHENTICATION_CHECK.

Parameters
[in]authenticationHandleA handle representing the authentication data passed into RFC_ON_AUTHENTICATION_CHECK.
[out]**assertionTicketAssertion ticket for SSO authentication. NULL if otherwise.
[out]*lengthString length of assertionTicket.
[out]*errorInfoAdditional error information in case changing the state fails, e.g. invalid handle, null pointer, etc.
Returns
RFC_RC
DECL_EXP RFC_RC SAP_API RfcGetAuthenticationCertificateData ( RFC_AUTHENTICATION_HANDLE  authenticationHandle,
const RFC_CERTIFICATE_DATA **  certificateData,
RFC_ERROR_INFO errorInfo 
)

Gets the certificate chain for authentication in RFC_ON_AUTHENTICATION_CHECK if x509 authentication method was setup in the backend.

If a handler of type RFC_ON_AUTHENTICATION_CHECK is installed, this getter returns the certificate chain for authentication set in the destination in the backend, i.e. x509 authentication was setup. The certificate chain is stored as a singly linked list. The received authentication data is stored in the authentication handle, which can then by queried by the authentication handler RFC_ON_AUTHENTICATION_CHECK.

Parameters
[in]authenticationHandleA handle representing the authentication data passed into RFC_ON_AUTHENTICATION_CHECK.
[out]**certificateDataSingly linked list of certificate attributes for x509 authentication. NULL if otherwise.
[out]*errorInfoAdditional error information in case changing the state fails, e.g. invalid handle, null pointer, etc.
Returns
RFC_RC
DECL_EXP RFC_RC SAP_API RfcGetAuthenticationPassword ( RFC_AUTHENTICATION_HANDLE  authenticationHandle,
const SAP_UC **  password,
unsigned *  length,
RFC_ERROR_INFO errorInfo 
)

Gets the password for authentication in RFC_ON_AUTHENTICATION_CHECK if basic authentication method was setup in the backend.

If a handler of type RFC_ON_AUTHENTICATION_CHECK is installed, this getter returns the password for authentication set in the destination in the backend, i.e. basic authentication was setup. The received authentication data is stored in the authentication handle, which can then by queried by the authentication handler RFC_ON_AUTHENTICATION_CHECK.

Parameters
[in]authenticationHandleA handle representing the authentication data passed into RFC_ON_AUTHENTICATION_CHECK.
[out]**passwordThe user's password for basic authentication. NULL if otherwise.
[out]*lengthString length of password.
[out]*errorInfoAdditional error information in case changing the state fails, e.g. invalid handle, null pointer, etc.
Returns
RFC_RC
DECL_EXP RFC_RC SAP_API RfcGetAuthenticationType ( RFC_AUTHENTICATION_HANDLE  authenticationHandle,
RFC_AUTHENTICATION_TYPE type,
RFC_ERROR_INFO errorInfo 
)

Gets the type of authentication data received from the backend in RFC_ON_AUTHENTICATION_CHECK.

If a handler of type RFC_ON_AUTHENTICATION_CHECK is installed, this getter returns the type of authentication data that was received from the backend. The authentication method can be customized in the SM59 destination in the backend. The received authentication data is stored in the authentication handle, which can then by queried by the authentication handler RFC_ON_AUTHENTICATION_CHECK.

Parameters
[in]authenticationHandleA handle representing the authentication data passed into RFC_ON_AUTHENTICATION_CHECK.
[out]*typeThe type of authentication method used by the backend.
[out]*errorInfoAdditional error information in case changing the state fails, e.g. invalid handle, null pointer, etc.
Returns
RFC_RC
DECL_EXP RFC_RC SAP_API RfcGetAuthenticationUser ( RFC_AUTHENTICATION_HANDLE  authenticationHandle,
const SAP_UC **  user,
unsigned *  length,
RFC_ERROR_INFO errorInfo 
)

Gets the user to authenticate in RFC_ON_AUTHENTICATION_CHECK if any is received.

If a handler of type RFC_ON_AUTHENTICATION_CHECK is installed, this getter returns the user to authenticate set in the destination in the backend. This could also be the alias user. The received authentication data is stored in the authentication handle, which can then by queried by the authentication handler RFC_ON_AUTHENTICATION_CHECK.

Parameters
[in]authenticationHandleA handle representing the authentication data passed into RFC_ON_AUTHENTICATION_CHECK.
[out]**userUser to authenticate.
[out]*lengthString length of user.
[out]*errorInfoAdditional error information in case changing the state fails, e.g. invalid handle, null pointer, etc.
Returns
RFC_RC
DECL_EXP RFC_RC SAP_API RfcGetServerAttributes ( RFC_SERVER_HANDLE  serverHandle,
RFC_SERVER_ATTRIBUTES serverAttributes,
RFC_ERROR_INFO errorInfo 
)

Retrieves detailed information about a multi-count Registered Server or a TCP Socket Server.

See RFC_SERVER_ATTRIBUTES for more details.

Parameters
[in]serverHandleA handle to the server object.
[out]*serverAttributesIs filled with state information, number of busy connections, etc.
[out]*errorInfoNot much can go wrong here, except an invalid handle.
Returns
RFC_RC
DECL_EXP RFC_RC SAP_API RfcGetServerConnectionMonitorData ( RFC_SERVER_HANDLE  serverHandle,
unsigned *  numberOfConnections,
RFC_SERVER_MONITOR_DATA **  connectionData,
RFC_ERROR_INFO errorInfo 
)

Retrieves detailed information about all clients currently connected to a multi-count Registered Server or a TCP Socket Server.

For every connected client you get its connection attributes (hostname, SID, user, client) as well as the current function module name, if the connection is busy, or the last activity time, if it is idle. Make sure to release the memory again with RfcDestroyServerConnectionMonitorData(), after you are done with it.

Parameters
[in]serverHandleA handle to the server object.
[out]*numberOfConnectionsNumber of client connections currently connected to this server.
[out]**connectionDataAn array of monitor data structs, one for each client connection.
[out]*errorInfoNot much can go wrong here, except an invalid handle or out of memory.
Returns
RFC_RC
DECL_EXP RFC_RC SAP_API RfcLaunchServer ( RFC_SERVER_HANDLE  serverHandle,
RFC_ERROR_INFO errorInfo 
)

Starts up an automatic server, so that it starts waiting for incoming requests and processes them.

Parameters
[in]serverHandleA handle to the server object.
[out]*errorInfoAdditional error information in case starting the server fails.
Returns
RFC_RC
DECL_EXP RFC_RC SAP_API RfcSetServerStateful ( RFC_CONNECTION_HANDLE  connectionHandle,
unsigned  isStateful,
RFC_ERROR_INFO errorInfo 
)

Sets this client's operation mode to statefull or stateless.

When a client session operates in stateless mode, which is the default, it does not keep state information inbetween several RFC requests over the same connection. By setting it to stateful, you can change that so that all requests over one connection run inside one single "user session".

Note
This can be used only for connection handles being managed by an automated (multi-count) server. If you try to use it on an ordinary connection created with RfcRegisterServer() or RfcStartServer(), you will get an RFC_ILLEGAL_STATE error.
Parameters
[in]connectionHandleA handle to the current client connection. Use the one that gets passed to you in your RFC_SERVER_FUNCTION implementation.
[in]isStatefulSpecifies whether the server should operate in stateful mode ("1") or in stateless mode ("0").
[out]*errorInfoAdditional error information in case changing the state fails, e.g. invalid handle, server is not a multi-count server, etc.
Returns
RFC_RC
DECL_EXP RFC_RC SAP_API RfcShutdownServer ( RFC_SERVER_HANDLE  serverHandle,
unsigned  timeout,
RFC_ERROR_INFO errorInfo 
)

Stops an automatic server, so that it no longer accepts incoming requests.

If timeout is set to 0, the server stops immediately, aborting any currently ongoing RFC requests. If you want to give any possibly ongoing requests a chance to complete, before stopping the server, provide a timeout > 0. RfcShutdownServer() will then block until all current requests are completed or the timeout period is over, whichever occurs first. In any case, the server will immediately stop accepting new requests as soon as you call this function.

If at a later point you want this server to resume listening for requests, you can start it again by calling RfcLaunchServer(). However, once you have cleaned up the server with RfcDestroyServer(), you must no longer attempt to use it in further RfcLaunchServer() (or other) calls.

Parameters
[in]serverHandleA handle to the server object.
[in]timeoutNumber of seconds to wait in order to give currently ongoing RFC requests time to complete.
[out]*errorInfoNot much that can go wrong here.
Returns
RFC_OK