In this tutorial, which is part of the SAP Intelligent RPA Tutorial Challenge 2021, we will explore how we can use modular design to split automations into small self-contained parts. As an example we use invoice processing.
In the first part we will search in Outlook for unread emails with attached invoices and save them in a folder for further processing.
In the next step we take all the invoices and extract their information using the SAP Document Extraction Service.
In the last step we move the process files into an output folder and store the results.
The email processing
The email processing automation looks as follows:
For the automation we need two input parameters outputFolder and emailTitle and one output variable fileName:
The general idea is to search for unread emails that contain the expression defined by emailTitle in the subject. The detailed settings are shown below.
For the aim of this tutorial the steps 2 and 8 are of particular importance. In step 2 we define a variable to store a list of file names. In step 8 this list will be filled with the file names of the found attachments. In the end this list is returned as the output of the automation.
Designing the automation in such a way makes it easily reusable for other use cases.
Processing the invoices
The next part is the processing of the invoices. We split this in two parts. The first part handles the communication with the SAP Document Extraction Service. For this step we adopted the automation described in the this tutorial: SAP Intelligent RPA 2.0 : Integrate Document Information Extraction service to automatically extract data from documents
The main changes we did was to use the file and the Service Key as inputs and return the extracted information as an output of the automation.
In the second part we call the automation for the Document extraction and save the result. The processed PDF file gets then moved into the output folder:
This automation has a number of inputs: the file that should be processed, the input and output folder and the Service Key for the document extraction.
Putting everything together
New we put the different pieces together as shown below:
First we process the emails. Then we iterate over all saved invoices process them. Here we can see one advantage of a modular design. For the processInvoice step we can mark the checkbox Trigger as a new job. In this way each invoice is handled by a separate job. Making the automation capable of handling a large influx of invoices.
In this tutorial we saw how to combine email processing and document extraction for invoices.
I hope this tutorial gave you an idea how you can split you automations in self-contained parts and why this can be usefull.
It would be great if you could like this post and leave a commend below.