Technical Articles
Using RFC adapter in the SAP integration suite
Overview:
This blog post intends to show how to use an RFC adapter in an integration flow (iflow as we would be referring to in this blog) for fetching data from the SAP ERP system.
We have various adapters provided by SAP which can be leveraged based on a particular requirement. In this blog, I am focusing on the RFC adapter and will provide you with a brief understanding of how you can use it.
Targeted Audience:
Beginner level in integration suite. Basic ABAP knowledge would be a plus.
Even if you don’t have either, I believe this can give you a fair idea of where to start!!
Objective:
I have used a very simple example to fetch purchase order details created on a particular date from the SAP ERP system using iflow in SAP BTP.
Solution:
The complete development process can be divided into 3 parts for better understanding-
a) Development in SAP ERP
b) Destination configuration
c) Developments in integration suite within SAP BTP environment.
Assumptions:
- An Account in SAP BTP with all the required roles assigned.
- Have a valid Subscription to the SAP integration suite in BTP.
- Have a cloud connector between the integration suite and SAP ERP.
- I am using Postman here to post my request so that we can also see the response. In real-life scenarios, this can be triggered from any third-party system or directly in an iflow using a scheduler.
a) Development in SAP ERP
- Create a function module that is remote enabled.
2. Add import and export parameters as shown below.
Since we are capturing PO details created on a particular date. “Created on” is our importing parameter.
We are fetching purchase order details such as the PO number, and company code created by a supplier. This structure would be our exporting parameter.
3. Now click on the source code tab. Add logic to fetch the required details as shown below.
4. Save and activate it.
5. Next step is to generate a web service and get a WSDL of the same.
Follow the path as shown below.
6. Give an appropriate name for the web service.
We will select the below profile for ease of testing.
7. Once done click on activate.
This will direct you to a screen as below. Click on the WSDL tab and download the generated WSDL to your local system. We will use it in our iflow.
We are done with our ERP changes! Let us move to the second part.
b) Destination configuration
As mentioned in the assumption section, we have a cloud connector in between our SAP ERP and BTP.
So, we will have to create a destination in the SAP BTP cockpit and create a subaccount in the cloud connector for the connection. We will cover the cloud connector setup here and the BTP cockpit changes in the next part.
Cloud connector Changes
- Select the subaccount that will be used for communication. Click on cloud to on premise and follow the instructions as shown below screenshots.
- Provide a virtual host and port.
- Click on next and Finish.
- Next click on add a resource.
- Make sure all our resources are active and available.
Summary:
So far, we have created an RFC in SAP ERP and exposed it as a web service. We also did the initial setup in the cloud connector for the destination and established the connection between the cloud connector and SAP ERP.
Note:
You can refer to the below link on the integration suite for further in-depth knowledge of its various capabilities.
https://help.sap.com/docs/SAP_INTEGRATION_SUITE
We will continue the rest of the development in the next part of the blog (link below).
https://blogs.sap.com/2022/10/19/using-rfc-adapter-in-the-sap-integration-suite-part-ii/
Please feel free to leave your comments/queries below. I believe we all can learn so much from each other that way.
Happy Exploring !!
Looking forwarding to your next part of this blog.
Thank you Frank Li. I would be publishing the next part soon.
The next part is published now.
https://blogs.sap.com/2022/10/19/using-rfc-adapter-in-the-sap-integration-suite-part-ii/
Please feel free to leave comments/queries in case you have any.
Hope this helps!!
Great, thanks a lot for your sharing.
Why generate a web service and get a WSDL based on RFC in this blog and then use WSDL for mapping the parameter creation date in the second blog? If keep the variable name creation date(in the second blog IFlow content modifiter body)the same with RFC parameter name, does the message mapping still needed in second blog? if not needed, WSDL also not need in this blog, is it right? Thanks.
Let me answer this in two parts-
1) Is WSDL needed for message mapping?
Yes the whole intent of generating WSDL was to use it in message mapping.
2) Is message mapping necessary even if the parameter name is same("Creation date in this case ")?
The parameter value can be passed successfully to the importing parameters of an RFC, when the payload is in sync with the structure generated by WSDL.
Before message mapping , the payload in iflow is as below.
After message mapping the payload is transformed.
So message mapping is used here to transform the incoming format into a RFC consumable format.
Hope this answers your query!!
Hi Elisa,
Thanks a lot for your kindly explanation, now it is very clear.
Hi Elisha Das ,
I have additional inquiries concerning the information provided by Frank Li about the Webservice question.
It appears that we can generate the WSDL directly using the link below, thereby bypassing the need to create a webservice:
Link: https://<backend_host>:<backend_https_port>/sap/bc/soap/wsdl11?services=<function_module_name>
Given this approach, does the necessity for a webservice still remain for our custom function modules? I've encountered a real production issue where I am utilizing a standard BAPI. This BAPI is successfully traversing through the cloud connector to connect with the SAP On-prem system. However, I'm facing difficulties in establishing a connection to the SAP system for my Z Remote Enabled Functions. I am getting error as "Error Getting Function".
An additional puzzling aspect is that the same Z Function performs as expected when executed from my Test CPI tenant to the Quality SAP system.
SAP user-id which is setup in BTP Destination has SAP_ALL access and also in cloud connector we allowed BAPI RFC and Z prefix values.
Regards
Sulbh Kalra
Hi Elisha Das
Great blog, Recently we got a chance to work with SAP CPI project but this is our first project we need your help. Below i mentioned my requirement, please do needfully.
Requirement : I need to Integrate third party MDM with S4HANA cloud so here i have some queries.
1)You mentioned RFC Function module at cloud connector but coming to my requirement the target system is S4 HANA cloud ,here where i need to mentioned Function Module at CPI level?
2) How to configure on premise(MDM) to cloud(CPI) at cloud connector ?
Can anyone help me step by step with proper screen shots for this integration.
Thanks.