Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
peterengel
Advisor
Advisor
In this blog post you will learn how you can use the basic file activities in SAP Intelligent RPA 2.0 (version 2102). The overall Automation will execute the following steps:

  1. Create the folders 'Start', 'End' and 'Copy'.

  2. Create 5 files using the 'Repeat' control and the 'Create File' activity.

  3. With 'Get File Collection' we get a list of files in a folder.

  4. Moving the created files into another folder controlled with the 'For each' control.

  5. Copy a complete folder.

  6. Remove the folder 'Copy'.



 

Activity 'Create Folder'


With the activity 'Create Folder' we can create folder in the file system of our local machine. The input parameter for this activity is the folder path.


For the automation above we use this activity three times to create three new folders:



Activity 'Create Files'


The activity 'Create Files' works similar to the activity 'Create Folder'.

To create five files with the name 'Test1' ... 'Test5' we use the control 'Repeat'.



This control is a loop which will be executed x-times from the 'Starting value' until the 'Ending value' is reached. The actual state is delivered in the 'Loop Parameter'.



We create the five files dynamically using the form builder, adding the value of the 'Loop Parameter' to the name and the file path.




Activity 'Get File Collection'


This activity is important to work with more than one file at the same time. This activity delivers a list of files in a folder in the output parameter 'coll'.


With the parameter 'full' we can decide if the list contains only the file names (full = false) or also the path where the file is stored (full = true).

Activity 'Move Files'


With the activity 'Move Files' we are able to move files between different folders. Input parameters are the source and the destination of the files.


As we select in the previous step to collect only the file names we have to compose the complete path out of the path and the name of the file. The name of the file stored in the variable currentMember of step 7. To achieve this we are using again the formula editor.


In this example we move the files file by file. We can do this using the control 'For each' which is another way to create a loop to work on a list.


In this control we have to set the looping list which is in our case the output parameter 'coll' from step 6 of the automation. The loop parameters are 'currentMember' with the value in this case the file name and the index value.


In this control we have to set the looping list which is in our case the output parameter 'coll' from step 6 of the automation. The loop parameters are 'currentMember' with the value in this case the file name and the index value.

Activity 'Copy Complete Folder'


With this activity we copy all files in a folder to another folder. The input parameter are again source and the destination path. In addition we have an option overwrite files in the destination folder or not.


In case we do not allow overwriting we have to use the control 'Try' to handle potential error messages.

Activity 'Remove Complete Folder'


With this activity we can remove a folder and delete the content. This activity has only the path to the folder which should be removed as an input parameter.



Conclusion


Now you should be able to use the basic file handling activities in the Cloud Studio. Try it out and combine it with other activities to create real world automations.

For more information on SAP Intelligent RPA


13 Comments