How to start a RFC Registered Server Program as a Windows service
Today I was asked how it is possible to start the program ldap_rfc.exe as a service. This was because I have mentioned this in a
that I have published a while ago in 2005 whithout describing in detail how to do it.
I remembered that there were some obstacles if one tries to find the solution so I decided to try it myself once again. Since this integration is also of interest for other integration scenarios where RFC Registered Server Programs are used I decided to document my findings in this blog.
Registered RFC Server Programs
I would like to start to explain what a registered RFC server program is.
An RFC server program can be registered with the SAP gateway and wait for incoming RFC call requests. The server program is able to register itself under a program-ID at an SAP gateway. From the SAP System it can thus be accessed through a TCP IP RFC destintation with activation type ‘T’ Registered Server Program.
The basic “problem” is that a registered RFC server program needs some command line parameters if being started as a windows service or from a command line. When the program is called from the ABAP kernel this is done using the program ID.
The syntax for starting a Registered RFC Server Program is basically the following:
<rfc_server_program>.exe -a <program-ID> -x sapgw<system_number> -g <hostname of gatewayserver>
On a windows server there are two ways to start a Registered RFC Server Program (either or – not both…):
Automatically as a Windows service.
You should start with option 1 when setting up the configuration because any error messages are available in clear text in the command prompt.
Since option1 is not ideal for productive usage you should start a productive Registered RFC Server Program as a Windows server once the setup has been tested.
Please note that you cannot start a registered RFC server program at the same time manually and as a Windows service. The second attempt to register the program would fail it is only possible to register once using the same program-ID at the SAP Gateway.
In the following I would like to describe the example how to start the registered RFC server program ldap_rfc.exe as a Windows Service.
Step 1: Find out necessary files and command line options to be used on the Windows server
The program ldap_rfc.exe needs some DLL’s so that it can be started on a server where no SAP system is installed.The best way to find out the missing files is to start ldap_rfc.exe including valid command line parameters in a command prompt.The command line syntax is basically (as described in the SAP Online Help (http://help.sap.com/saphelp_nwes72/helpdata/en/48/75bec8bc27055ee10000000a42189b/content.htm)):
ldap_rfc.exe -a ldap_rfc -x sapgw<system_number> -g <hostname of gatewayserver>
The number for sapgw<system_number> can be retrieved from the services file on the SAP ABAP Application Server In our default installation (Instance Number 00) the following parameters were used:
ldap_rfc.exe -a ldap_rfc -x 3300 -g iwdfvm3136
We start a command prompt , change to the directory where ldap_rfc.exe is located and start the command mentioned above.
ldap_rfc.exe -a ldap_rfc -x 3300 -g iwdfvm3136 <br />Could not open the ICU common library. The following files must be in the path described by the environment variable “PATH”: icuuc34.dll, icudt34.dll, icuin34.dll (nlsui0.c 1386) pid = 4296
Step 2: Start ldap_rfc.exe as a Windows Service
After copying the files icuuc34.dll, icudt34.dll, icuin34.dll to that directory ldap_rfc.exe can be started.To start the program as a windows service we use srvany.exe and proceed as described in the following article:
In the parameters section you have to specify the command line parameters of ldap_rfc.exe (see above)
–a ldap_rfc -x 3300 -g iwdfvm3136
as shown in the following screen shot
In contrast to the article mentioned above I chose the following value for the parameter ImagePath C:Program FilesWindows Resource KitsToolssrvany.exe instead of C:WindowsSystem32srvany.exe since I encountered an error when I tried to start the service even when the file srvany.exe was copied to C:WindowsSystem32. When choosing the file location where the file has been installed everything worked.
If you activate trace options in SM59 you will find a trace file rfc*.trc in the directory C:WindowsSystem32 as shown in the follwoing screen shot.