Create an Automation to Extract Invoice Details
- How to extract data using Document Extraction Template
- How to bind parameters between process and automation
Prerequisites
- Complete the tutorial on creating an Invoice Approval Process
- Install and Setup the Desktop Agent
- Download the Invoice Document to your local machine
- Step 1
-
In the process Get Invoice Details, choose +.
-
Select Automation.
-
Click on Blank Automation.
-
A pop up will appear to configure the Desktop Agent version. Do the following in the pop up:
- From the dropdown, select the version of the Desktop Agent installed on your machine.
- Under Platforms, choose Windows or Mac depending on the Platforms you are working on.
- Choose Confirm.
The version of the Desktop Agent would be with suffix as Registered.
-
A new pop-up will appear to create the automation. Do the following in the pop-up:
- Enter Name of the automation: Extract Invoice Data,
- Enter Description of your choice,
- Choose Create.
An automation Extract Invoice Data will be created successfully.
-
Choose Save.
-
- Step 2
-
Go to the Overview Tab. Choose the Create button. Create an artifact of the type Data Type.
-
A new pop-up will appear:
- Enter Name of the data type: Invoice,
- Enter Description of your choice,
- Choose Create.
-
In the Data Type Invoice add new fields as following:
Field Name Type DocumentNumber
String GrossAmount
Number SenderName
String -
Choose Save.
-
- Step 3
Input and output parameters allow you to exchange data in the workflow of your automation between activities, screens, and scripts.
-
Go to the Overview tab. Open Extract Invoice Data Automation.
-
In Automation Details, select the Input/Output section.
-
Add Input and Output parameters.
-
Edit Input and Output parameters as follows:
Parameter Name Data type Parameter Type Description FilePath
String Input Please provide the full qualified path to the PDF file containing the invoice InvoiceDetails
Invoice Output Extracted Invoice Details -
Choose Save.
-
- Step 4
-
Go the Overview Tab. Choose Create and Document Template.
-
In the Add a Document Template window, under Start:
- Choose Create a New Template,
- Choose Next.
-
Under Enter Details:
- Enter the Name of the template,
- Upload the invoice document which you have downloaded from prerequisites,
- Choose Next.
-
Select Invoice as the document type of your template and choose Next.
-
Under Choose Schema:
- Choose New.
-
Under Create New Schema:
- Enter Invoice Schema Name such as
ABCSchema
. - Choose Next.
- Enter Invoice Schema Name such as
-
Under Define information:
- Select the Add option to add Header Fields. For this scenario you will be adding
documentNumber
of Type String,grossAmount
of Type Number andsenderName
of Type String.
- Choose Next.
- Select the Add option to add Header Fields. For this scenario you will be adding
-
Under Summary:
- SAP Build provides the summary of all the details related to the schema to be created,
- Choose Add.
-
Document Information Extraction SDK would be added as dependency to your project. The schema and template are created successfully.
-
Once Upload will be completed, choose Open Template Editor.
-
- Step 5
-
Choose Refresh
-
Choose Edit.
-
Select the data in your invoice document which you would like to extract the information. In this scenario, you will read the Document Number, Gross Amount and Sender Name.
-
Select the value 174221 in the document and map to the field
documentNumber
. Choose Apply. -
Select the value ABC Communication in the document and map to the field
senderName
. Choose Apply. -
Select the value 220.00 in the document and map to the field
grossAmount
. Choose Apply.
-
-
Once mapping is done. Choose Save and Close the template.
-
- Step 6
-
Navigate back to Build Process Automation and select Extract Invoice Data automation tab.
-
In Automation Details, under Tools, in search field, search for Extract data (Template) activity.
You can extract data with Document Information Extraction using the chosen document template and given PDF file.
-
Drag and drop the activity Extract Data (Template) into the automation flow.
-
Select the activity. Choose Add Document Template
-
In the Add a Document Template window:
- Select Choose a template from the current project,
- Choose Next.
-
Under Select Template:
- Choose the
ABCSchema
template, you created in the previous steps, - Choose Next.
- Choose the
-
Under Summary, choose Add.
-
Select the activity. Maintain the parameters for the activity as follows:
-
Under
documentPath
: chooseFilePath
-
-
You have already created the data type Invoice in Step 2. Now, you will create a variable of type Invoice.
-
Click on the canvas. Search for the datatype Invoice, located under the Data Types section.
-
Drag and drop the data type Invoice into the automation flow.
-
Select Create Invoice variable. In the Input Parameters, under value, choose Create Custom Data.
-
Choose the Edit button to map the parameters:
DocumentNumber
to the extracted invoice data from the activity Extract Data (template),- Repeat the same for
GrossAmount
andSenderName
and map it to the corresponding fields ofextractedData
.
-
Rename the output parameter to
myInvoiceData
. -
The final input and output parameters of Create Invoice Variable looks as below.
-
Print the invoice data using the activity Log message.
With this activity you generate a log message within the tester and the trace file, which is useful for setting up an automation. By default, a log will be “Information”.
-
Click on the canvas, search for Log Message activity and drag and drop it into the automation flow.
-
Select Log Message activity. In Input Parameters under message add
myInvoiceData
value. -
Select Save.
-
- Step 7
-
Select the End. Pass the variable
myInvoiceData
to the output parameterInvoiceDetails
, which you have created in Step 2. -
Save the automation.
-
- Step 8
-
Navigate to the Get Invoice Details process and select the automation Extract Invoice Data. Map the input parameter of the automation to the form parameter
FilePath
. -
Select Save.
-
- Step 9
-
Navigate to the Extract Invoice Data automation.
-
Select Test button and enter the
Filepath
where the invoice document is stored locally on your machine. -
The automation opens the Invoice Document, extracts data and prints the details i.e Document number, Gross amount and Sender name.
-
Your automation is built successfully.
-
Once this tutorial is completed, the process will look like this:
Which of the following are true concerning input and output parameters?
-