RFC SDK 指南 基础知识

时间:2021-11-26 20:11:01

The RFC client is the instance who calls the remote function module, which is provided by an RFC server.

 

RFC客户端远程调用RFCServer提供的函数模块。

 

The RFC calls are accomplished via an RFC connection. Up to 100 (default value) active RFC connections at a time are possible. This value can be changed by using environment variable CPIC_MAX_CONV.

 

RFC调用需要一个RFC连接。同一时间,默认可以有100个活动联系。这个值可以通过修改环境变量CPIC_MAX_CONV控制。


There are two types of RFC connections:
• Client connection.
• Server connection.

Sometimes the server connection is called accepted connection.

 

有两种类型的RFC连接:

    客户端连接

    服务器连接

有时,服务器连接是通过接受连接得到。


An RFC handle represents an RFC connection. Technically a handle is an index of an internal memory structure, which contains necessary information about given RFC connections. An RFC handle is an instance of type RFC_HANDLE.

一个RFC句柄引用一个RFC连接。技术上来讲一个句柄就是一块包括RFC连接信息的内存结构的索引。一个RFC句柄是RFC_HANDLE类型的实例。

There are two kinds of RFC handles:
• Invalid RFC handle. This is either an RFC handle with value RFC_HANDLE_NULL or an already closed or aborted RFC connection. It is impossible to make any API call via this handle.
• Valid RFC handle. API calls have to be done by using a valid RFC handle. A try to call any API-function with an invalid handle causes an error with return code RFC_INVALID_HANDLE.

 

系统中有两种类型的RFC句柄:

    无效RFC句柄。当句柄值为RFC_HANDLE_NULL或已经关闭的和中止的RFC连接的句柄。此时不能通过此句柄调用任何API。

    有效的RFC句柄。API调用必须通过一个有效的RFC句柄。使用一个无效句柄的API调用会返回一个RFC_INVALID_HANDLE的错误。


    RfcGetAttributes API delivers the user relevant data describing a given RFC connection.

 

可以通过调用 RfcGetAttributes API得到一个给定RFC连接的描述信息。


During execution of an RFC function at the server side, it is sometimes useful to call another RFC function in the original (client) system. For example, if one needs data from the caller before continuing with the current RFC function. This behavior is called call back feature in SAP jargon. The RFC server uses the same RFC connection established by the client and calls a remote function at the client side. The call back hit the same context in R/3 system. RFC Library supports a call back mechanism for client and server. It is not necessary to open a new connection, i.e., the same RFC handle will be used.

 

当RFC函数在服务器端执行期间,原系统有时还需要调用其它RFC函数。例如:当前RFC函数需要从调用者得到相关数据以继续执行。这是SAP系统术语中的回调特性。RFC服务器使用相同的由客户端建立的RFC连接并从客户端调用函数。回调拥有相同的R/3系统的上下文。RFC库支持客户端和服务器端的回调机制。这时,不需要打开一个新的连接,也就是说,可以使用同一个RFC句柄。