Calling BAPIs in the SAP S/4HANA Public Cloud
About this series
In this blog series I will describe the use of RFC and BAPI technologies in the context of integration of the SAP S/4 HANA Public Cloud with On-Premise Systems. This kind of landscape is also called a Hybrid Landscape and we may as well talk about Hybrid Integration Scenarios.
You will learn which technical components you need and how to configure them. The blog series is split into multiple parts. The first blog post is about the underlying concepts and the positioning and you are reading it right now. The details of the test case are described in individual blog posts.
The specific case I am covering is the usage of “traditional” SAP integration technologies (RFC and BAPIs) which were partly whitelisted for usage with SAP S/4HANA Public Cloud. These technologies have been around for more than 20 years and were the work-horse concepts in the SAP ERP On-Premise world. But for the SAP Cloud they will only be required during a transition phase and will be replaced by SOAP and ODATA APIs as explained a bit further down.
To give you some insight how to use them during this transition phase, I examined various test cases to illustrate what can be done. Please consider them as starting point for your own examinations. Of course I would be happy to learn about what you have tried and achieved. Just leave a note in the comment section below.
BAPIs and RFC are sort of “ancient” SAP concepts for integration resp. communicating business information between systems. BAPI is an abbreviation for “Business Application Programming Interface”. The offer a stable interface with standard methods to access SAP Business Objects (e.g. Sales Orders) which can be called externally. If you want to learn more I suggest you take a look at this article in the SAP Documentation.
RFC is a technical protocol (Remote Function Call) which can be used to call RFC-enabled ABAP function modules from the outside. It was “the” protocol and came in various flavours, most importantly as so-called tRFC-Call (transactional RFC) which were of paramount importance for data exchange via ALE (Application Link Enabling), usually in the IDoc-Format. BAPIs are technically function modules of this type. We used to develop them ourselves based on the BAPI Programming Guide and they could also be called asynchronously.
Much more important than programming a BAPI yourself were those standard BAPIs which were delivered as part of the SAP standard. If you search for function modules starting with “BAPI_” in an SAP ERP System, you will find several thousands of them. This shows the importance of this concept in former times.
BAPIs in SAP S/4HANA Cloud – When And How To Use Them
The standard way of integrating your SAP S/4HANA Cloud solution is with the help of SAP Best Practices and whitelisted APIs. For more information about these topics take a look at our “Integration with SAP S/4HANA Cloud” openSAP course and at our “SAP S/4HANA Cloud Integration Checklist” blog post.
The limited positioning of BAPIs in the context of SAP S/4HANA Cloud had long been explained in SAP Note 2447593 and remains unchanged.
Here a quick recap:
- SAP only supports BAPIs for the purpose of integrating SAP S/4HANA Cloud with SAP on-premise solutions (see also SAP Note 2447593)
- BAPIs listed in that note shall only be used until a successor API (OData or SOAP) has been made available
- If you need to use a BAPI interface for integrating with a 3rd party solution please follow the exception process as described in SAP Note 2653671
My Test Cases
In the other parts of this Blog I will examine the following test cases:
- Calling a BAPI in the SAP S/4HANA Cloud from an on-prem SAP ERP System
This was my starting point of this learning journey. I found out which components I needed and how to configure them. It was mainly about the SAP Cloud Connector (SCC) and how to set it up. I had never done that before and it was very educational. Once I got it to work the rest was straight forward. I will include a detailed description of the set-up process of the SCC which worked for me.
- Calling a BAPI in the SAP S/4HANA Cloud from SAP Process Orchestration
Building on top of test case 1, my colleague Hoang Vu set up a scenario to call the BAPI from SAP Process Orchestration. This is a scenario that makes a lot of sense in a Hybrid Landscape because PO is a widespread tool in SAP-heavy On-Premise Landcapes.
- Calling a BAPI in the SAP S/4HANA Cloud from a non-SAP system
I simulated this with a JAVA Program I ran in Eclipse. There are various RFC libraries available, the most prominent being the JCO Libraries also called SAP Java Connector.
- Calling a BAPI in an SAP On-premise system from the Cloud
In this case I used SAP Cloud Platform Integration to make the call. It is sort of the reverse of test case 2 and has also some significance in real application scenarios.
- Calling a BAPI in the SAP S/4HANA Cloud from the Cloud
Direct RFC calls between SAP Cloud Components are not supported. What I wanted to find out was if it works if I take a detour via OnPrem.
Please keep in mind what is pointed out in the section “BAPIs in SAP S/4HANA Cloud – When And How To Use Them”! What I describe in this series should be considered as experimental work and not as a recommendation for productive scenarios. If you want to use BAPIs for productive Cloud scenarios you must follow the process described in the notes mentioned above (SAP Note 2653671 and SAP Note 2447593).
What I used
- An SAP Cloud Platform Account. It is needed to connect the SAP S/4 HANA Cloud Tenant and the SAP Cloud Connector.
- An SAP S/4HANA Public Cloud Tenant + user with administrative privileges
- An SAP Cloud Connector + user with administrative privileges
- An SAP ERP Backend System + user with RFC privileges
- SAP Process Orchestration + development user
- SAP Cloud Platform Integration Service + development user
- Eclipse (or comparable) + SAP Java Connector Libraries
- PostMan or SOAPUI
The ERP Backend is especially useful to access the documentation of individual BAPIs. Call transaction BAPI to see the it. Use transaction SE37 to access the ABAP Implementation of the BAPI.
Please be aware: Without access to an ERP backend you will have a hard time to obtain the BAPI documentation. It is not available online anymore or at least I couldn’t find any. You can get a WSDL for a BAPI from an OnPrem ERP Backend or S/4HANA Backend via SAP Process Orchestration, too.
- How to do the Communication Setup in SAP S/4HANA Cloud: Communication Systems, Users and Scenarios
- Finding your way in the ABAP Workbench
- Basic RFC knowledge
- Basic BAPI knowledge
- Some JAVA
- How to develop simple IFlows in SAP Cloud Platform Integration.
Quick Guide to set up the Cloud Connector
In case you don’t have an SAP Cloud Connector already available you need to set it up from scratch. There are a numerous blogs available how to do this. This Blog by Ali Chalhoub explains it very nicely and in much detail. Actually you should be fine to go with the documentation in the SAP Help Library. This part refers to online information resources which describe all the necessary steps in sufficient detail. The description is based on the 1905 documentation material. Steps 1-4 can be skipped if an already operational SCC-Setup can be used. Here is a quick overview if the steps:
- Get the picture
Carefully read the chapter “Integrating OnPrem Systems” (1905 Version) in section “General Functions for the Key User” of the SAP Online Help.
- Prepare and Configure the Cloud System
Configure Communication Scenario SAP_COM_0200 as described in “Integrating OnPrem Systems (Steps 1-7)”.
- Install the Cloud Connector
Download and Install the Cloud Connector “Integrating OnPrem Systems (Step 8)”
(SAP Cloud Platform Connectivity: Installation)
- Configure the Cloud Connector
Do the initial configuration of the Cloud Connector “Integrating OnPrem Systems (Step 9)”
(SAP Cloud Platform Connectivity: Initial Configuration)
- Set up the Service Channel
Configure the Service Channel to your SAP S/4 HANA Cloud Tenant
(Setting Up the Connection from On-Premise Systems to SAP S/4HANA Cloud)
(Configure a Service Channel for RFC)
- Test the Connection
- Use the Setup
Preparing the SAP S/4 HANA Cloud System
Once the SCC Setup is working properly a Communication Scenario with BAPIs can be used:
- Take a look at OSS-Note 2447593 – Available BAPIs in S/4HANA Cloud for integration to SAP on Premise solutions to identify the Communication Scenario you want to use.
- Activate the Communication Scenario in the S/4HANA Cloud System. My example: Read an Equipment.
- For example: BAPI_EQUI_GETDETAIL. The note shows we need to activate SAP_COM_0319.
- Go to Communication Arrangements and create a new arrangement from Scenario SAP_COM_0319.
- Pick the same communication system as for SAP_COM_0200. The inbound user is filled in automatically since it is attached to the communication scenario.
- In the arrangement you can see the available BAPIs. Save the arrangement:
Your components should now be ready for operation!
In the next blog post I will go into detail for test case 1.
Thanks Jens. This is very helpful.
Thank you, Gaurav!
this is a great Blog - and will be very useful in an upcoming project, where i know already now that the whitelisted APIs are not enough.
You are welcome! Please keep in mind that only a limited number of BAPIs can be used in the SAP S/4HANA Cloud.
My company is currently using RFC_READ_TABLE from a .Net NCO library to read various user role/profile/authorization types of tables like AGR_1251. We want to get the same data using a very similar process but for s4/hana public cloud. Is that possible using the method you describe?
in the S/4 HANA Cloud it is only possible for BAPIs which are whitelisted according to SAPNote (SAP Note 2653671 and SAP Note 2447593).
Nice blog, thanks you.
Hi, Jens, thank you very much for all this material. Very helpful. Do you have any recommendations for our project which is going from on-prem to cloud where we have many 3rd party calls to BAPI_USER_CHANGE, BAPI_USER_CHANGE and a few others to do user creation and roles and group management? We can change the calling system to REST or SOAP, but don't know where to get started. We also have several custom BAPIs on prem to deal with more particular user management requirements.
Is there a "quick guide" or easy button for exposing standard or custom BAPIs on SAP Cloud as REST or SOAP, particularly if they aren't white listed?
Very useful info, the only thing that none of the mentioned BAPIs are existent anymore.