Remote Enable your RFC_HOST_TO_IP to return Host IP to JCo
Recently I found a quite of lot information sharing at SDN related to RFC’s. I read the blogs My new best friend, Mr. RFC_VERIFY_DESTINATION by Craig and RFC_READ_TABLE – my old faithful – what has happened to you? by Piers and found them very useful. I was working on a JCo application and wanted to use RFC function module RFC_HOST_TO_IP to display the IP address of an RFC host using the Host name. The real problem was that this function module is not Remote Enabled.
Hence I was not able to access the Repository using JCo because of com.sap.mw.jco.JCO$Exception: (104) RFC_ERROR_SYSTEM_FAILURE: The function module “RFC_HOST_TO_IP” not released for ‘remote’ calls.
Then after a few modifications by copying the standard function module and I was able to get the required result. Here in this blog I am explaining the steps that I followed to get the host IP address.
First I copied the standard code to a new function module ZC1_RFC_HOST_TO_IP.
I set the Processing Type as Remote Enabled Module.
Then in the importing and exporting parameters tab make the Parameter Type as TYPE for RFCHOST and RFCIP.
And in the Include for Sub Programs keep only the following code, which is sufficient for the required purpose.
And now just activate and execute the program the required IP Address will be displayed.
Then coming to the JCo part things are as usual and the following code fetched the IP address for a RFC Host.
And the Java code returned the correct IP Address.
Apart from working similar to the standard function module this also helps me to the IP using the JCo. Thus I thought it was nice to share this every one so that we can customize some good function modules as Remote Enabled for our External Applications.