Skip to Content
Technical Articles
Author's profile photo Yohei Fukuhara

Configure Cloud Connector for RFC connection from cloud to on-premise

Hi All,

I am writing this blog to describe steps to build RFC connection from cloud to on-premise using SAP Cloud Connector.

Environment

Local PC

  • OS: Windows10 64-bit
  • CF cli: 6.51.0+2acd15650.2020-04-07

Cloud Foundry

  • CF (Europe – Frankfurt)

Netweaver ABAP

  • NetWeaver ABAP 7.53 SP0

Cloud Connector

  • SAP Cloud Connector 2.11.2

Steps

1. Setup Cloud Connector

Access SAP Cloud Connector and setup connection from SAP Cloud Platform to ABAP Server.

1.1. Add Subaccount

Click on “Add subaccount” button via menu “Connector”.

Enter Subaccount information.

If you use a trial account, do not use “Europe(Rot) – trial”.  It is for Neo Environment.

“Subaccount” is displayed on SAP Cloud Platform Cockpit menu “Overview”.

1.2. Add ABAP Server to Subaccount setting.

Select “Cloud To On-Premise” menu and click on “+” icon.

Select “ABAP System” as Back-end Type.

Select “RFC” as Protocol.

My ABAP server does not have any Load balancers.

Enter “Application Server” and “Instance Number”.

Enter “Virtual Application Server” and “Virtual Instance Number”.  This is dummy name and number, so just name them for easily recognizable.

No description at this point.

“Check Internal Host” is on and click on “Finish” button.

 

Click on check availability icon and check the availability.

1.3. Add Accessible Function modules

Click on “+” icon.

Enter Function information and the result is like this.  I used Prefix Naming Policy, which does not need “*” as wildcard.

“BAPI_” is ncessary, since SAP Cloud SDK automatically call “BAPI_TRANSACTION_COMMIT”.  I have not check the exact condition to call the BAPI.

Now Cloud Connector setting is completed.  As a result, we can see the ABAP system from SAP Cloud Platform Cockpit.

Go to Subaccount and select menu Connectivity -> Cloud Connecotrs.

2. Define ABAP Server Destination

Create Destination service by CF cli command “cf create-service”.  “lite” is service plan name.

cf create-service destination lite <destination name>

In my case, I have already created my destination service.

Now define destination for invocation.  Go to SAP Cloud Cockpit destination instance and define ABAP service destination like this.  Though I defined the destination under destination service,  you can also define the one under subaccount -> Connectivity.

 

You can test the connection!

 

 

Assigned Tags

      19 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Juan Samo
      Juan Samo

      Hi good post!

      I followed the steps, however I don’t see the “Cloud Connectors”  in the section “Connectivity” only “Destinations”. Any idea?

       

      Thanks!

      Author's profile photo Yohei Fukuhara
      Yohei Fukuhara
      Blog Post Author

      Hi

      Are you using Trial account?
      At this point, menu "Cloud Connectors" may not be displayed on Trial Account.

      I'm not sure when it comes again.

      Regards,
      Yohei

      Author's profile photo Juan Samo
      Juan Samo

      Ok, thanks for your quick answer!

      Author's profile photo Michał Gogól
      Michał Gogól

      Hello Yohei,

       

      So this means that, using Trial Account I cannot connect to my system via Cloud Connector?

       

      Best Regards,

      Michal

      Author's profile photo Yohei Fukuhara
      Yohei Fukuhara
      Blog Post Author

      Hi Michat-san,

      I haven't tried to use Cloud Connector with Trial Account recently.

      But my colleague said she could use the one for http connection, though she didin't use RFC connection.

      Regards,

      Yohei

      Author's profile photo Boonsom La-orrattanasak
      Boonsom La-orrattanasak

      cloud%20trial%20accountHi Yohei,

      cloud trial account

      I try to setup http with trial account bout could not found cloud connector under “Connectivity”.

      Could you please suggest?

      ps. my scenario is to connect on-premise to SCP for business application studio to develop UI5 from Odata service.

       

      regards,

      Boonsom

      Author's profile photo Yohei Fukuhara
      Yohei Fukuhara
      Blog Post Author

      Hi Boonsom-san,

      Though the menu is not displayed, you can connect between SAP CP and Cloud Connector.
      Please try to configure destinations and test the one.

       

      Regards,
      Yohei

      Author's profile photo Jose Antonio Moreno
      Jose Antonio Moreno

      Hello, good post!

      With cloud connector is it possible to connect to an on-premise system that uses SAProuter string?

      I need to deploy my application from sap webide but I am not connecting to the client system, maybe because it uses SAProuter

      Any idea?

      Thanks for your return

      Author's profile photo Yohei Fukuhara
      Yohei Fukuhara
      Blog Post Author

      Hi,

      I'm not sure about SAProuter.

      It seems to be used for SAP remote connection.

      I think SAP Cloud platform connects to on-premise systems via cloud connector or reverse proxy.

       

      Regards,

      Yohei

      Author's profile photo Gaurav Shah
      Gaurav Shah

      Hi,

      I have followed the exact steps to configure Cloud connector and Destination. but getting below error on calling destination.ping()

       

      Logs mentioned below:

      2021-04-06T16:21:23.35+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000] SAP_STINIT4: GWHOST=mx-bapi
      2021-04-06T16:21:23.35+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000] SAP_STINIT4: GWSERV=3300
      2021-04-06T16:21:23.35+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000] SAP_STINIT4: PROTOCOL=I
      2021-04-06T16:21:23.35+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000] SAP_STINIT4: TRACE=3 (3)
      2021-04-06T16:21:23.35+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000] SAP_STINIT4: extended init options
      2021-04-06T16:21:23.35+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000] cpic_timeout = -2
      2021-04-06T16:21:23.35+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000] keepalive_timeout = -2
      2021-04-06T16:21:23.35+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000] export_trace = 2
      2021-04-06T16:21:23.35+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000] start_type = 0
      2021-04-06T16:21:23.35+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000] net_protocol = 0 => 0
      2021-04-06T16:21:23.35+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000] streaming = 1
      2021-04-06T16:21:23.35+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000] STIsetLocalAddr: still initial
      2021-04-06T16:21:23.35+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000] GwIConnect: connect to gateway mx-bapi / 3300 (timeout=60000)
      2021-04-06T16:21:23.36+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000] NiHLGetNodeAddr: hostname 'mx-bapi' not found by operating system
      2021-04-06T16:21:23.36+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000] GwIConnect: GwConnect to mx-bapi / 3300 failed (rc=NIEHOST_UNKNOWN)
      2021-04-06T16:21:23.36+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000]
      2021-04-06T16:21:23.36+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000] LOCATION CPIC (TCP/IP) on local host with Unicode
      2021-04-06T16:21:23.36+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000] ERROR hostname 'mx-bapi' unknown
      2021-04-06T16:21:23.36+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000] TIME Tue Apr 6 10:51:23 2021
      2021-04-06T16:21:23.36+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000] RELEASE 753
      2021-04-06T16:21:23.36+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000] COMPONENT NI (network interface)
      2021-04-06T16:21:23.36+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000] VERSION 40
      2021-04-06T16:21:23.36+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000] RC -2
      2021-04-06T16:21:23.36+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000] MODULE /bas/753_REL/src/base/ni/niuxi.c
      2021-04-06T16:21:23.36+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000] LINE 1771
      2021-04-06T16:21:23.36+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000] DETAIL NiPGetHostByName: 'mx-bapi' not found
      2021-04-06T16:21:23.36+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000] SYSTEM CALL getaddrinfo
      2021-04-06T16:21:23.36+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000] COUNTER 2
      2021-04-06T16:21:23.36+0530 [APP/PROC/WEB/0] ERR [Thr 140049849952000]
      2021-04-06T16:21:23.36+0530 [APP/PROC/WEB/0] ERR Log file is written to /dev_jco_rfc.log, because given file access failed
      2021-04-06T16:21:23.36+0530 [APP/PROC/WEB/0] ERR Log file is written to /dev_jco_rfc.log, because given file access failed
      2021-04-06T16:21:23.36+0530 [APP/PROC/WEB/0] ERR Log file is written to /dev_jco_rfc.log, because given file access failed
      2021-04-06T16:21:23.36+0530 [APP/PROC/WEB/0] ERR Log file is written to /dev_jco_rfc.log, because given file access failed
      2021-04-06T16:21:23.36+0530 [APP/PROC/WEB/0] ERR Log file is written to /dev_jco_rfc.log, because given file access failed
      2021-04-06T16:21:23.36+0530 [APP/PROC/WEB/0] ERR Log file is written to /dev_jco_rfc.log, because given file access failed
      2021-04-06T16:21:23.36+0530 [APP/PROC/WEB/0] ERR {"msg":"Error while executing function:: BAPI_BUPA_CENTRAL_GETDETAIL","stacktrace":["com.sap.conn.jco.JCoException: Initialization of destination mx-cal failed: Connect to SAP gateway failed\n\tconnection parameters: TYPE=A DESTINATION=mx-cal ASHOST=mx-bapi SYSNR=00 PCS=1\n\nLOCATION CPIC (TCP/IP) on local host with Unicode\nERROR hostname 'mx-bapi' unknown\nTIME Tue Apr 6 10:51:23 2021\nRELEASE 753\nCOMPONENT NI (network interface)\nVERSION 40\nRC -2\nMODULE /bas/753_REL/src/base/ni/niuxi.c\nLINE 1771\nDETAIL NiPGetHostByName: 'mx-bapi' not found\nSYSTEM CALL getaddrinfo\nCOUNTER 2\n","\tat com.sap.conn.jco.rt.RfcDestination.initialize(RfcDestination.java:1199)","\tat com.sap.conn.jco.rt.RfcDestination.ping(RfcDestination.java:1855)","\tat sapbapiconnector.actions.CallBAPI.executeBAPI(CallBAPI.java:103)"

       

      Any help will be appreciated.

      Author's profile photo Yohei Fukuhara
      Yohei Fukuhara
      Blog Post Author

      Seeing the log, It failed with ping.

      Can you connect to ABAP via destination service?

      I mean the last step of my blog post.

       

      Regards,

      Yohei

       

      Author's profile photo Gaurav Shah
      Gaurav Shah

      I am using destination service only to retrieve RFC destination configured in SAP BTP connectivity. Connection check from destination is successful.

      Is appears to be build pack as there application buildpack is not of sap_java_buildpack. Is there any other way to call BAPI other than RFC from SAP CF.

      Author's profile photo Yohei Fukuhara
      Yohei Fukuhara
      Blog Post Author

      > Is appears to be build pack as there application buildpack is not of sap_java_buildpack.

      What buildpack are you using?

      I use sap_java_buildpack.

       

      Is there any other way to call BAPI other than RFC from SAP CF.

      How about using Enterprise Services, which calls BAPI internally?
      If so, you must create an enterprise service on ABAP.

       

      Regards,

      Yohei

      Author's profile photo Gaurav Shah
      Gaurav Shah

      No build pack is mendix cf buildpack (https://github.com/mendix/cf-mendix-buildpack).

       

      Are the Enterprise services available on SAP BTP. I am looking for a solution for my application which is running on SAP BTP and call BAPI.

      Author's profile photo Yohei Fukuhara
      Yohei Fukuhara
      Blog Post Author

      Enterprise service is name on ABAP side and generally called as SOAP.  You have to setup Enterprise services to call BAPI on ABAP server.

       

      Regards,

      Yohei

      Author's profile photo Marc Zimmek
      Marc Zimmek

      Hello

      i integrated the rfc destination in cloud connector and the check connection returns OK.

      But in the abap enviroment i get the message

      "EXCEPTION COMMUNICATION_FAILURE Error when opening an RFC connection (Timed out waiting for tunnel to open for tunnelId  ..."

       

      What is missing?

      Author's profile photo Yohei Fukuhara
      Yohei Fukuhara
      Blog Post Author

      Hi,

      What does "when opening an RFC connection" mean?

      Is it checking from cloud connector? or connecting from some apps on BTP?

       

      Regards,

      Yohei

      Author's profile photo Tatjana Schumakowa
      Tatjana Schumakowa

      Hello Experts,

      which connection is better? RFC or HTTPS ? do you have to renew certificates regularly with every RFC?

       

      Thank you very much 

      Author's profile photo Yohei Fukuhara
      Yohei Fukuhara
      Blog Post Author

      Hi,

       

      We cannot say one connection method is better than the other generally.

      It's up to your requirement and environment.

      One thing we should care is that SAP Cloud SDK's supportability of RFC.

      https://sap.github.io/cloud-sdk/docs/java/features/bapi-and-rfc/overview

       

      Regards,

      Yohei