Create a Decision for Invoice Approval Process
Create a decision to determine the approver of the invoices
Overview
You will learn
- How to create a decision
- How to make use of data types and how to create them
- How to maintain a decision table and include it in the process flow
Prerequisites
Prerequisites
- You have created the process, the form to trigger the process and the automation to extract the invoice data
Steps
Intro
With a Decision you can include several policies, guidelines, business rules and so on into your process flow.
You will now add a decision to the flow of your process. With this you are able to include business logic.
Choose + following the automation Extract Invoice Data.

Add decision In the menu select Decision.

Add decision Click on Blank Decision.

Add decision In the Create Decision window:
- Maintain the Name: Determine Approver,
- Description: Decision to determine who could approve the invoice,
- Choose Create.
The Identifier will be created automatically.

Decision Name The Determine Approver Decision is now in the process and should open automatically in the Decision Editor.
Navigate back to the Get Invoice Details process and save your process.
Select the decision in the process, choose the three dots and select Open Editor.

Open Editor You see a Decision Diagram showing the flow of the data within the Decision, and also the Input and Output Parameters.
Add an input parameter with the following information:
- Name: Invoice Parameter,
- Description: Invoice Details,
- Type: Invoice.
“Invoice” is the data type which has been created in the Automation and contains all relevant extracted data.

Change Input The data type for Output needs to be created. Therefore, select the Folder Icon.

Create new Data Type Select + and choose Create > Data Type.

Create new Data Type In the new pop-up window:
- Define the Name: Approver,
- Add a Description: Including the approvers email address,
- Choose Create.
The Identifier will be created automatically.

Name data type Create a New Field:
- Maintain the Name
eMail, - Choose the Type as
String.

eMail - Maintain the Name
The new data type containing the email address of the approver is now created.
Save your work.

Save new data type Go back to your Determine Approver Decision. Add an Output Parameter:
- Name: Approver Output,
- Description: Invoice Approver,
- Select Type: the newly created data type Approver.

Select new data type Save your work.
There are many ways to express a business rule, in this case you will create a decision table to determine the approver of the invoice based on certain criteria.
Open the Rules tab.
Choose Add Rule.

Add Decision Table In the Create Rule window:
- Set the Rule Name to DT Determine Approver,
- Set the Description to Decision Table to determine approver,
- Choose Next Step.

Decision Table Name You will now configure the conditions:
- Under Vocabulary, choose Invoice Parameter,
- Select Sender Name,
- Choose Next Step to configure the results.

Determine Approver Input You will now configure the results:
- Under Result Vocabulary, select Approver Output,
- Select eMail,
- Select Next Step to review.

Determine Approver Output Review and choose Create to create the rule.

Create If you need to edit the rule you just created, you may do so by selecting the pencil icon.

Edit Define the attributes:
- for Sender Name:
EXISTSIN['ABC Communication'] - for eMail:
'your SAP BTP user ID', e.g.'diana.smith@mail.com'.
You can also make use of the value help, by pressing the space bar before maintaining the expression in the first column.
This means, if the company name in the invoice is “ABC Communication”, then the approval request will be sent to you. Otherwise, follow the next step.

If Then - for Sender Name:
Select the first row and Add Row to Insert After. In case the Sender Name is defined as
EXISTSIN['Telecommunications'], the approval request should be sent to any recipient you might want to choose. e.g.'jane.doe@sap.com'.When inserting emails please do not forget the simple quotes otherwise you will end up with an error when you save the decision artifact.

Add Row Save your work. The decision table is ready.

Decision ready
Though the Decision is ready, you need to connect it to the data flow of your process and define which data should be the input and output here. Also, to get rid of this error marker.
Go back to the process and select the Decision.

Error You might not see entries in the Input. This is due to a bug. As a workaround, click on the three-vertical-dot and remove the decision. Add the decision again in the process.
Please refer to the Knowledge Base Article for the complete workaround.
Define the Inputs:
- Under Bind Object, click on
Select itemfield - Select
Invoice detailsto map theInvoice Parameter
The input mapping is done.

Invoice Details 
Invoice Details - Under Bind Object, click on
Check the Output, it is eMail, as you have defined it in the decision itself.

Decision Output Save your work.
You have now defined who should approve the invoice, based on the company name. Next, you will use the outcome of the business rule, the email address, as input for the approval.
Resources
Discussion
Share feedback on this tutorial or join the conversation in SAP Community.