Connection to an external RFC program
Sometimes it is useful to write both, RFC client and server program, as external programs and let them to communicate with each other via an SAP gateway. The RFC Library supports this option too. The RFC server program can be started by an SAP gateway or it can use a registering feature
有时编写客户端和服务器程序是很有用处的,外部程序和他们彼此可以通过SAP网关通信。RFC库也支持这种配置。RFC服务程序可以通过SAP网关启动或者使用注册特性。
Connection to an external program started by an SAP gateway
The RFC client has to open the connection of type ‘E’. For successful build up of the connection the following information is needed:
• Gateway data: gateway host name and service names,
• Host name of the rfc server program,
• Name of the rfc server program.
连接到一个通过SAP网关启动的外部系统
RFC客户端必须打开‘E’类型的连接。成功建立这样的连接需要以下信息:
网关数据:网关地址和服务名
RFC服务系统的主机名
RFC服务系统名称
This data could be delivered to RfcOpenEx:
• Either directly via entries in connection string: “… TYPE=E GWHOST=<gateway host> GWSERV=<gateway service name> TPHOST=<host name of rfc server> TPNAME=<name of the rfc server program> …”
• Or via entries in saprfc.ini file for corresponding destination:
DEST= …
TYPE=E
GWHOST=<gateway host>
GWSERV=<gateway service name>
TPHOST=<host name of rfc server>
TPNAME=<name of the rfc server program>
以下数据要传输给RfcOpenEx:
一种,通过通过声明以下连接字符串:“… TYPE=E GWHOST=<gateway host> GWSERV=<gateway service name> TPHOST=<host name of rfc server> TPNAME=<name of the rfc server program> …”
另一种,通过在saprfc.ini文件中声明:
DEST= …
TYPE=E
GWHOST=<gateway host>
GWSERV=<gateway service name>
TPHOST=<host name of rfc server>
TPNAME=<name of the rfc server program>
Connection to a registered RFC server
To establish an RFC connection to an external registered RFC server, the RFC client has to open a connection of type ‘R’. The following data is needed:
• Gateway data: gateway host name and gateway service name
• Program Id of the external RFC server.
连接到外部注册的RFC服务系统,RFC客户端要选择打开一个‘R’类型的连接。这样需要以下数据:
网关数据:网关地址和网关服务名
外部RFC服务的程序标识。
This data could be assigned:
• Either directly via entries in the connection string: “… TYPE=E GWHOST=<gateway host> GWSERV=<gateway service name> TPNAME=<program Id of RFC server program> …”
• Or via entries in the saprfc.ini file for the corresponding destination:
DEST= …
TYPE=R
GWHOST=<gateway host>
GWSERV=<gateway service name>
PROGID=<program Id of RFC server program>
数据赋值方式:
一种:通过声明一个连接字符串:“… TYPE=E GWHOST=<gateway host> GWSERV=<gateway service name> TPNAME=<program Id of RFC server program> …”
另一种:通过在saprfc.ini文件中声明相应的节点:
DEST= …
TYPE=R
GWHOST=<gateway host>
GWSERV=<gateway service name>
PROGID=<program Id of RFC server program>
Please notice: If an external RFC client communicates with an external server, which runs in registered mode, the RFC client has to close the connection and reconnect the RFC server after each RFC function call. If this is not done, the behavior is undefined. This behavior is based on the following background:
• The registering feature of an external RFC server has been designed to allow the multi-client functionality. This means that an external server may be able to serve several requests from different clients simultaneously.
• To enable this, closes external RFC server after each RFC call the connection to the client. The connection will be closed independent of the client’s kind (external or R/3-system). In case of an ABAP-Program the connection at the
client side will be reestablished automatically by the ABAP/RFC-Runtime. In contrast external RFC-Client program has to reestablish the connection explicitly via RfcOpenEx-API.
请注意:如果一个RFC客户端与一个注册模式的外部服务系统,则RFC客户端在调用每一个RFC函数之后必须断开连接然后重启连接。否则,可能发生不可预期的后果。这一行为以如下背景为基础:
外部RFC服务的注册特性已经被设计允许多客户端访问。也就是说一个服务系统可以为多个不同客户端并发服务。