Because a SAP gateway cannot start an RFC server program with remote shell on another machine via SAProuter, it is necessary to install a SAP gateway on a machine in the network where the RFC server program will be run. It should be the same machine for a better performance.
One or more SAProuters can be used. The following example shows

Route Permission Tables
Entry in the route permission table of SAProuter on host_r2 in Network_2:
P |
host_21 |
host_r1 |
3299 |
Entry in the route permission table of SAProuter on host_r1 in Network_1:
P |
host_r2 |
host_11 |
sapgw<GW service number> |
A destination in transaction sm59 can be defined as follows:
Connection type: |
T |
Activate type: |
Start |
Program location: |
explicit host |
Program: |
/rfctest/srfcserv |
Target host: |
host_11 |
Gateway host: |
/H/host_r2/H/host_r1/H/host_11 |
Gateway service: |
sapgw<GW service number> |

The maximum length of the gateway host (transaction sm59) is: