Introduction
Hello,
I will be showing you How to handle RFC in SAP Build - Process Automation .
Scenario
We will be using a RFC to get data that we need in our automation.
Prerequisites:
- Basic Knowledge about RFC
- Basic knowledge about SAP Build
- Basic knowledge about SAP Process Automation.
Step-by-Step Procedure:
- Creating the RFC .
- Creating the Process Automation project.
- Consuming RFC in our project
STEP 1 : Creating RFC
Firstly we need to create our RFC according to our needs. Go to
' SE37 ' transaction and create your RFC. Do not forget to select Remote-Enabled Module processing type.
Image 1 - RFC Attributes
In my case, what I needed was the mail addresses of customer numbers I already had. So created my RFC to get mail addresses using company codes and customer numbers. You should set your parameters according to your needs.
You can see my parameters below.
Image 2 - Import Parameters
Image 3 - Tables Parameters
Image 4 - T_CUSTOMER Components
In my coding part I am finding mail addresses using the customer numbers and company code provided in
T_CUSTOMER and filling
' MAIL ' component according to
' IV_ CHECK ' import parameter.
STEP 2 : Creating Process Automation Project
Now we are going to create our project.
Go to SAP Build cockpit and click create.
Image 5 - SAP Build Create Project
After that click ' Build an Automated Process ' and ' Task Automation ' . Give your project a name and configure your agent and we are all set.
STEP 3 : Consuming RFC in Project
Firstly we need to add
BAPI SDK to our project. To do that go to settings and then
Dependencies section. After that click
Add Dependency and search for
BAPI SDK.
Image 6 - Add Dependency
Now we need to create our
Data Types based on our RFC parameters. The important part here is that Data Types must be created as structures, for my case I will be creating two Data Types , one for Import Parameters of my RFC and one for Tables Parameters.
Go to your
Project Content and click
Create then click
Data Type. After that give it a proper name and lets set the Data Type.
Image 7 - Creating Data Types
Create your Data Types based on your RFC parameters. Here are my Data Types
Image 8 - Data Types
Now we can call our RFC from our project. Lets start building our project. You can see the general overview of project, I will be explaining each step.
Image 9 - Overview of Project
Firstly we need to establish our connection to SAP server where RFC exist. For that we are using
Set SAP Connection (Basic) activity and filling it as needed.
Image 10 - Set SAP Connection (Basic)
To be sure whether we were able to connect to SAP system or not we are using
Is SAP Connection Alive activity.
Image 11 - Is SAP Connection Alive
For next step we are creating our variable using the Data Types that we created.
Image 12 - Creating the RFC Import Variable
Image 13 - Creating the RFC Tables Variable
Now that we created our variables , we are going to fill these variables. Firstly we are checking if the SAP Connection is alive or not after that we are filling our variables as we need.
Image 14 - Filling Variables
Now we can execute our RFC and get the desired data. To call our RFC we are using
Execute BAPI activity. And to reach our desired data we are using
output parameter of Execute BAPI in a
Custom Script activity as you can see below.
Image 15 - Execute RFC
Image 16 - Desired Data From RFC
Here is our mail addresses corresponding to customer numbers and company codes.
Conclusion
If you read the blog well congratulations ! You learned How to create a new project in SAP Build, How to create custom Data Types in a SAP Process Automation, How to consume a RFC in SAP Process Automation and much more.
If this blog is a help to you please like and share 🙂
Also Please do not hesitate to ask any further questions and feel free to share your feedback on the content.
Thank you!
- Metehan Dülger