Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Metehan
Explorer

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:



  1. Basic Knowledge about RFC

  2. Basic knowledge about SAP Build

  3. Basic knowledge about SAP Process Automation.


Step-by-Step Procedure:



  1. Creating the RFC .

  2. Creating the Process Automation project.

  3. 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 



12 Comments
Ulrich_Schmidt
Product and Topic Expert
Product and Topic Expert
Hi Metehan,

small comment about nomenclature: there is no such thing as "an RFC".

"RFC" is the name of a network communication protocol, like for example "HTTP". Similarly to as you cannot "create an HTTP" or "consume an HTTP", you can also not "create/consume an RFC". You can only create a "remote-enabled function module" (abbreviated "RFM"), which can then be "executed over the RFC protocol".

If we carry on our analogy to the HTTP protocol, we would say for example, that we "create a WebService or an OData Service or a REST Service, which we then execute over the HTTP protocol." But we would not say, that we "create and execute an HTTP"... 🙂

Best Regards, Ulrich
rjcastillo
Explorer
0 Kudos
Did you try it and did it work for you?

I am getting an array of strings from custom script. I would like to pass it to BAPI as Table Input. I have created BAPI and used Action group to set BAPI variables. The Input variable is also created.

Manually I can add multiple items. But How can I add a list (Array) each items and then call BAPI runtime?
Metehan
Explorer
0 Kudos

Hi,

It is working well for me. You can see in Image 13 and Image 14, I am creating my table variable and filling it, line by line. You should check Add Item(List) activity.

rjcastillo
Explorer
0 Kudos
Im going to show you my project


 

The Step 3 I have my table ZFI_0181 like this, the paranetro that I have to fill is IT_CARGA


 

Here you can see the data type


 

 

In step 5 I have the variable "ArchCartola" which contains the list of data, that I want to add to the bapi 



 

information contained in the variable   "ArchCartola"


 

I put the same condition of you index == 0

 

in the step 7, I assign the value of the currentmenber to my table ZFI_0181 specifically  IT_CARGA


 

and for the step 8 i add to the list IT_CARGA el currentmenber


 

in the step 10 in the Tables of the bapi, i have my variable 3 (tabla ZFI_0181)

 


when I execute the project, is only taking the first line.



but if it is doing the entire run through the for each since I am executing it with a breakpoint, what happens is that it does not save it in the list

Do you have any recommendations?
Metehan
Explorer
0 Kudos

It looks like your step 8 Add Item(List) is not set correctly.

At step 8, List must be set as step 3 myVariable.IT_CARGA, and also itemToAdd must be set as Custom Data( type ZFI_0181 ) and you must set  that Custom Data s IT_CARGA part as currentMember.

Can you try like I explained? I believe this will solve your problem.

rjcastillo
Explorer
0 Kudos
ok I understand what you are trying to tell me but the activity does not give me that option

As you can see, I deleted the data from step 8 to show you in detail

 


 

when I click to add the variable to " list: ",

As you can see in the image, variable 3 corresponding to my table ZFI_0181 is not available for selection, which is why I proceed to assign the Custom Data

 


 

When selecting the custom data it is found this way, so I click on +

 


 

The highlighted line is generated to open the expression editor



 

When I open the expression editor I am going to place the variable "step 3 myVariable.IT_CARGA"

 


 

staying this way


 

 

Now we are going to assign the value to "item to add" which, as you can see, goes to the expression editor and that is where I select the CurrentMenber

 


 

That's why I assigned the variables that way since the tool does not allow me to assign it as you tell me.

Do you have any other recommendations?

 

 
rjcastillo
Explorer
0 Kudos
peter.engel can you please help me with this situation
rjcastillo
Explorer
0 Kudos
ankitsomani

Can you please help me with this situation that I am presenting?

thank you very much
peterengel
Advisor
Advisor
0 Kudos
Hi Ricardo,

 

in step 8 you need to put myVariable into list,


then clicking on myVariable and you will see the following:


Then you can add the right data type like described by Ankit. The rest should work as described in Ankit's blog post.

Br,

Peter
rjcastillo
Explorer
0 Kudos
As you can see in Image "12 – Creating the RFC Import Variable" from the blog described by ankitsomani , it is observed that it is not assigned as a list, since the check is unchecked

I attach an image and highlight it in green



The only difference I can see between the projects is the version of the dependencies

I am using the latest version, do you think this has something to do with it?

 

 

From what I can figure out is that step 8, my "input parameters" specifically "list" is not able to recognize that Step3.myvariable.IT_CARGA is a list

As you can see, it doesn't give me the option in the image, the only thing that appears available for selection is: ArchCartola , UsuarioSAP, Custom Data

 



 



 

Here you can see the declaration of the data type  IT_CARGA is a list

peterengel
Advisor
Advisor
0 Kudos
Hi,

you can see on your photo the myVariable value from step 1, 3 and 4. Select the right one. Then you can see the myVariable value in the field list and then click on this value. This will display the right values you need.

Br,

Peter
rjcastillo
Explorer
0 Kudos

Yes, I understand what you are telling me. but when I open the drop-down list to select the variable the only options that are available for me to click are:




  • ArchCartola ,

  • UsuarioSAP,

  • Custom Data


As you can see in the image, the options you indicate cannot be selected

(they are light gray, I cannot click on them)

Labels in this area