Create a Decision
Create a decision to determine approvers who will be authorized to approve sales order based on complex rules
Overview
You will learn
- How to create & configure decision in the process
- How to create & configure data types
- How to model decision tables with rules expressions
Prerequisites
Prerequisites
Steps
A decision consists of one or more policies. Each policy consists of a collection of rules. They are used to automate the decision-making parts of a business process. After you create a decision, define your business logic by adding rules to the policy. There are two types of rules:
- Decision Table Rule: A decision table is a collection of input and output rule expressions in a tabular representation.
- Text Rule: A text rule is the collection of rule expressions in a simple if-then format.
To add a decision, you must first identify the set of rules that you need to add to the decision-making process. Once you have identified your rules, then define the data types relevant for designing the rules. This is an important step before you start modelling your decision because these data types will contain all necessary fields that will be needed to model the rule.
In this section, you will create and configure a decision which will be used to determine the relevant approvers based on the sales order fields.
In the process builder, choose + of the default conditional flow.

001 Select Decision.

001b Click on Blank Decision.

001c In the Create Decision window, do the following:
- In the Name field enter Determine Approver,
- In the Description field enter Rule to identify the potential approvers for sales order,
- Choose Create button.

002 Now you have to model the decision. For that, choose the 3 dots next to Determine Approver decision, to open the menu and choose Open Editor.

002 A decision editor opens. You can see the decision diagram on the left panel and configuration option for Input and Output on the right panel. Notice the default policy that is pre-created with the decision.
A Decision Diagram is a flow chart that describes the execution flow of the decision logic from the input to the output. Using a decision diagram, you can view the input, output, policies of a decision and the rules of the policies. You can also access each component of a decision, like a policy or a rule, via the decision diagram itself.
A Policy is a collection of rules to be executed in strict order, meaning that they will run in the order in which they are added to the policy, and only the results of the last rule execution will be given as the final output of the decision.

002
A data type describes the data structure that can be used as an input and/or output parameter in an automation, a decision or processes. Data types enable you to formalize the data used as input/output parameters for steps, activities, skills, processes, scenarios, triggers, or notifiers. Data types facilitate the manipulation and validation of data.
You can create a data type manually, but some data types can also be created automatically when SDK packages or pre-packaged scenarios are imported or after running an automation.
Now, you have to map the Input and Output of the decision to the actual data object available with the process. In this section, you will use Sales Order as the Input data object and Approver as the Output data object. While the Sales Order was already created in the automation step, you will create an Approver data object for decision output.
Click on the Open Project Content icon as below.

002 Select +. Choose Create > Data Type.

002 In the Create Data Type window, do the following:
- In the Name field enter Approver,
- In the Description field enter Approver details who will approve the order from supplier side,
- Choose Create button.

002 In the Approver data type screen, choose New Field to add a new attribute to the data object.

002 In the Field Details section on the right, in the Name field enter
Email. Keep the Type as String.You can choose the Type dropdown list to see the different kind of data types that are supported like Number, Password, Date, Time, Boolean etc.

002 Similarly, add another attribute
UserGroupof Type String to the data type.
002 Save changes.

002
After the data types are created, you will now configure the decision:
With Input and Output data types.
Create decision table rule to the business policy.
First, add this newly created data object as the decision output.
Go back to Determine Approver decision tab.

002 In the Determine Approver section, you will select Add Input Parameter button and Add Output Parameter button to configure input and output parameters.

002 Configure Input Parameter:
- In Name enter: Sales Order Input,
- In Description enter: Business rules input,
- In Type choose: Sales Order.

002 Configure Output Parameter:
- In Name enter: Approver Output,
- In Description enter: Business rules output,
- In Type choose: Approver.

002 Save changes.
Then you will create the actual decision-making parts that make the decision in the process. Under Determine approver, select Rules.

002 Select Add Rule.

002 In the Create Rule window:
- Under Rule Type select Decision Table,
- In the Rule Name enter Determine Approver,
- In the Rule Description enter Rule to identify the potential approvers for sales order,
- Choose Next Step button.

002 A decision table is a tabular representation of the rule with If and Then header and row columns. If-header columns contain the expressions, which are evaluated, and Then-header columns contain the result structure that will be returned after the decision is run.
You will now configure the conditions. Under Vocabulary:
- Select Sales Order Input data type,
- From the dropdown, choose the inputs
shippingCountryandorderAmount, - Choose Next Step button.

002 Configure the output or result of the decision table. Under Result Vocabulary:
- Select Approver Output data type,
- From the dropdown, choose outputs
UserGroupandEmail, - Choose Next Step button.

002 Review and choose Create button to create the rule.

002 You can use the Settings option to easily define these If and Then header expressions with inline suggestions or free-flow typing.
In the newly created Decision Table, add values to condition and result columns.

002 Click in the first field (first column)

002 Type EXISTSIN, and choose exists in from Array Operators.

002 Continue typing, and write this expression: EXISTSIN [‘United Kingdom’ , ‘India’ , ‘Germany’]. After you have finished, press Enter key or click outside the input field to confirm.
You can either type-in the entire expression as free-flow or use the context help to write the expression.

002 Remember that for all String type data object attributes, you must add a single quote (’) before and after the text.
Choose the input field of Order Amount column (second column of the decision table) and enter <= 100000.

002 Similarly, enter the following expressions for the respective result column (or Then section):
- Under
UserGroupenter:'SO_APPROVER' - Under Email enter your email such as
'jane.doe@sap.com'
Do not forget to put single-quote (’) for string type values.

002 User Group is a role collection or group created in the BTP cockpit or in your respective user management system. These groups have users who are responsible for certain jobs. The advantage of using groups is that you can add/remove users from these groups without the need to change the decision.
To ensure that the decision table rule returns definite output for all kinds of sales orders, add one more row to the decision table to return the list of approvers who can approve the sales order for value greater than 100000.
So, for example, for all sales orders coming from India, Germany, or the United Kingdom (the defined shipping countries) which have a value smaller or equal than 100,000 โ the first row will run. For all other sales orders, whose value is greater than 100000, the second row will return; and for any other combination that does not match the rows โ an empty result will be returned.
- Under
To add a new row to the decision table, do the following:
- Choose the check-box of the first row,
- Choose Add Row,
- From the dropdown options, select Insert After.

002 Similarly, enter the following values for the new row:
Condition Column Value Shipping Country Order Amount >100000 Action Column Value UserGroup'SO_MGMNT'Email'john.doe@sap.com'Choose Save button.
Save will both save and activate the decision table. If there are any validation issues in the decision table, then Save will not happen and the errors will be shown in the Design Console.

002
After you have created and configured the decision, next you have to map the input fields of the decision with the actual process content fields from the process builder.
Open the process builder
- Choose Determine Approver decision
- Choose Inputs tab
- Map the Sales Order Input choosing the
SelectedOrderwith Bind Object option
You might not see entries in the Input, please refer to the Knowledge Base Article for the complete workaround.

002 You can choose to map the Single Properties from the selected order following decision table input with the process content:
Decision Input Field Process Content expectedDeliveryDateselectedOrder>expectedDeliveryDateorderAmountselectedOrder>orderAmountorderDateselectedOrder>orderDateorderNumberselectedOrder>orderNumberorderStatusselectedOrder>orderStatusshippingCountryselectedOrder>shippingCountrySave the process.

002 You might see an error symbol on your decision. This is because the outbound connection from the decision is still dangling and not connected to any activity. You may connect it to the end activity.
You will now adapt the business process one last time to fully automate your approver selection by matching the recipients of the approval form to the one returned from the decision table.
Select Approval form:
- Match
orderNumberfrom Get Order Details automation in the Subject, - Under Recipients > Users select
Emailfrom Determine approver decision, - Under Recipients > Groups select
UserGroupfrom Determine approver decision.
You can modify your selection as needed.

002 - Match
Save your work.
Resources
Discussion
Share feedback on this tutorial or join the conversation in SAP Community.