Skip to Content
Technical Articles

Calling a BAPI in the SAP S/4 HANA Cloud from an on-prem SAP ERP System

Introduction

In the first part of this series I explained the background of my little endeavour and which preparations were necessary to implement the test cases. In this blog post you will learn the easiest type of cal (at least from my point of view). In case you haven’t read the first part of the blog, please do so, especially the section “BAPIs in SAP S/4HANA Cloud – When And How To Use Them”.

Calling a BAPI from an SAP ERP System

This is a straightforward scenario and the standard for the direct coupling scenarios as they are available in the Best Practice Explorer. But instead of calling from an application I simply used the Function Module Test Transaction SE37 in the SAP ERP System. But it illustrates the principle just the same.

Preparation

What I used

  • A functional SAP Cloud Connector Instance + user with administrative privileges (or see the Appendix at the end of this blog post)
  • An SAP S/4 HANA Public Cloud Tenant + user with administrative privileges
  • An SAP ERP Backend System + user with RFC privileges

What I did

  • Prepare the SAP S/4 HANA Public Cloud System (as described in my first blog post)
  • Set up an RFC Service Channel in the SAP Cloud Connector
  • Set up a RFC Destination in the ERP Backend
  • Run a test in transaction SE37

Set up the Service Channel in SAP Cloud Connector

This step sets up the RFC connection to the S/4 HANA Public Cloud System

  1. Log on to the SAP Cloud Connector
  2. Go to “Service Channels -> OnPremise to Cloud”
  3. Press the “+” sign to create a new channel
    • Pick type “S/4HANA Cloud”
    • Fill in the API-tenant of your Cloud. Add a “-api” after the my300xxx” part of the URL just like this: my1234567-api.s4hana.ondemand.com
    • The local instance number can be set to “00”.
    • If all is fine the status should be green.

Settings in the SAP ERP Backend

Then I set up the RFC Destination towards the SAP S/4 HANA Cloud System. It is a test system called EAF. The connection goes via the SAP Cloud Connector and that is why I called this RFC Destination SCC_EAF.

  1. Go to transaction SM59
  2. Create a new ABAP connection (Type 3)
  3. Maintain the server details. Target Host is the SAP Cloud Connector Server Address or IP:
  4. Maintain the user name and password (Inbound User in the Communication Arrangement SAP_COM_0319 as described in my first blog post).
  5. Save the configuration and do a connection test:
    If you get a similar output then you configuration was successful!

Test your configuration

  1. Call transaction SE37 (Function Builder). Enter “BAPI_EQUI_GETDETAIL” and press the test button.
  2. The Test Function Module Initial Screen will come up:Enter the RFC-Destination you just maintained and the number of an equipment that exists and press “Execute”:
  3. Enjoy the result!

Conclusion

What I learned from this test case

The most important learning was the preparation of this scenario, mainly the set up of the SAP Cloud Connector (as described in my first blog post). I even installed a local version of the SAP Cloud Connector on my notebook and connected it the Cloud Platform Account. That worked fine. Please see the detailed steps in the section I named “Appendix” a little bit further down if you want to learn about a local installation.

Once all was running and configured, the calling of the BAPI was relatively easy and worked just like doing an RFC from OnPrem to Onprem.

In this scenario I have called the BAPI from the Test Transaction for Function Modules. But an ABAP Program would work as well.

Your Feedback

Please let me know if the description was helpful and you were able to set up the same test case. Any feedback how to improve this blog post is welcomed! Please put it in the comment section.

What’s next

In the next post of this series I will show you how my colleague Hoang set up the same call via SAP Process Orchestration. So you will learn all the steps you need to perform for that!

 

 

 

———————————————————

Appendix

———————————————————

How I set up the SAP Cloud Connector

This part sort of repeats what can be found in the SAP Help Online Documentation and what has been described in Blogs/Blog Posts of other people (e.g. here). The intention is to list all the steps I performed to make the scenario. I do it also a little bit as reference for myself.

So all in all, setting up the SAP Cloud Connector is only complicated the first time you do it!

Get the picture

This picture shows how the SAP Cloud Connector establishes the connection. What makes it so easy and useful is the fact that Cloud Connector initiates the connection. So an outgoing call establishes a tunnel which is later used for incoming calls, too!

 

The first step-stone of the configuration is the association of Cloud Tenant, Cloud Platform Subaccount and Cloud Connector:

  1. Log on to your SAP Cloud Platform Account (https://account.hana.ondemand.com). You may also use a trial account (https://account.hanatrial.ondemand.com)
  2. Navigate to the subaccount you want to use for the association:
  3. Note down the subaccount information. You will need them later:
    • Display Name – in this case v0371
    • Technical Name – in this case af8dcb6d4

Prepare and Configure the Cloud System

  1. This step is executed to connect the Cloud System Tenant to the respective subaccount above. It sets up the secure tunnel connection as depicted in the picture. You do the configuration via the apps for Communication Management. First you create the Communication System (which is actually your Cloud Platform Subaccount above) and after that you maintain the settings for Communication Arrangement SAP_COM_0200.
  2. Maintain the Communication System
    • Start App “Communication Systems”
    • Create a new Communication System
    • Maintain System ID and Name. In the example the ID is the Display Name of the Subaccount (v0371) and the name SCP-v0371.
    • Maintain the user for the Outbound Communication. Make sure to pick an Administrative User of the Subaccount! Use the Subaccount password of this administrative user int Outbound Communication Settings.
  1. Maintain Communication Arrangement SAP_COM_0200
    • Only do this if there is no SAP_COM_0200 configured in the system yet! I haven’t tried what happens if another arrangement of the same type is setup simultaneously so I recommend not doing it.
      If SAP_COM_0200 is already present, you need to connect the SAP Cloud Connector to the Subaccount configured in the CommArrangement (see below).
    • Anyway, here I  assume no SAP_COM_0200 is present.
    • Start App “Communication Arrangements”
    • Create a new arrangement choosing Scenario “SAP_COM_0200”
    • Choose the Communication System you just created, add the Technical Subaccount Name of your Cloud Platform account and make sure the Administrative user from above has been picked.

 

Install the SAP Cloud Connector locally

Example for a local installation on a Windows10 machine.

  1. Check Prerequisites
    1. You need to have a 64bit JRE
    2. The local installation runs w/o administrative priviliges
  2. Download the Cloud Connector Software
    1. Go to https://tools.hana.ondemand.com/#cloud
    2. Download the appropriate version
  3. Install & start the SAP Cloud Connector
    1. Unpack the zip-file to a directory of your own choosing
    2. Open a console window in that directory
    3. Run Go.bat
    4. In case you get an error-message saying “JAVA Home is not set correctly” open the script Go.bat and check from line 39 beginning. In my case the concatenation of the JAVA_EXE environment variable didn’t work because of my JAVA_HOME setting. I had to change the line to make it fit.
    5. You can now log on to the SAP Cloud Connector local instance.

Configure the Cloud Connector

  1. Log on as Administrator with password manager. You are requested to change the password.
  2. Add your Subaccount. For the connection you do not need the administrative Subaccount user. The assignment of the groups below should be sufficient. In this example a Location ID was entered because another SAP Cloud Connector was already connected to the Subaccount. The Location ID makes it possible to connect more than one SAP Cloud Connector to a Subaccount, e.g. from different network segments.

If all went fine, you see the status “Connected” in section “Tunnel Information”.

End of the appendix

This appendix showed the steps I performed to get the connection going. As already mentioned there are already a lot of guides for this available but I wanted to add it for the reason of completeness.

2 Comments
You must be Logged on to comment or reply to a post.
  • Hi! This is a very useful blog for us. Clear and deep at the same time. However we are having some problems to setup the communication over our systems.

    Our scenario is the following: we need to post to bapi BAPI_ALM_NOTIF_CREATE deployed on a S/4 Hana Cloud from a SAP CPI iFlow. This is the landscape and the communication flow:

    iFlow (CPI) => Cloud Connector  => S/4 Hana Cloud

    So, at CPI side we are creating an RFC destination to be called from the CPI iFlow but we aren’t succeeding at all because some jco connector properties are unknown for us.

    And at the same time, concerning the Cloud Connector configuration for the “Cloud To On-Premise” section, the Backend Type “ABAP System” with “Protocol” RFC can’t reach S/4 Hana Cloud.

    Can you guide through this?

    Thanks a lot in advance!

     

     

    • Hi Pedro,

      what you are trying to do seems to be the same scenario as my last test case. I plan to publish the rest of the blog posts this week. Please have a little patience. Here’s a preview: “jco.client.ashost is the Virtual Server you maintained, Client, Lang and Sysnr are those of the Cloudsystem (try 100, EN, 00).
      Also you have to be aware that the scenario is not an official one and should not be used for production because you may not get any official support.

      Best Regards!

      Jens