Skip to Content

Create a Decision for Invoice Approval Process

Create a decision to determine the approver of the invoices
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

  • Step 1

    You will now add a decision to the flow of your process. With this you are able to include business logic.

    1. Choose + following the automation Extract Invoice Data, in the menu select Decision > New Decision to add a new one.

      add decision
    2. Maintain the Name Determine Approver and also a Description, the Identifier will be created automatically. Choose Create.

      Decision Name
    3. The Decision Determine Approver is now in the process, choose the three dots and select Open Editor.

      Open Editor
    4. You see a Decision Diagram showing the flow of the data within the Decision and also the Inputs. Change there the Type to Invoice.

      “Invoice” is the data type which has been created in the Automation and contains all relevant extracted data.

      Change Input
    5. The data type for Output needs to be created. Therefore, select + on the left-hand side to create one.

      Create Data Type
    6. Select Create > Data Type.

      Create new Data Type
    7. Define the Name Approver and also add a Description, again, the Identifier will be created automatically. Choose Create.

      Name data type
    8. Create a New Field.

      New Field
    9. Maintain the Name eMail, leave the Type as String.

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

      Save new data type
    11. Go back to your Decision Determine Approver and select as Output the newly created data type Approver.

      Select new data type
    12. Open the Default Policy and select >.

      Open default policy

    You have used the data type "Invoice" in the decision, where was this data type coming from?

  • Step 2

    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.

    1. Choose Add Rule.

      Add Decision Table
    2. Set the Rule Name to DT Determine Approver and the Description to Decision Table to determine approver. Choose Next Step.

      Decision Table Name
    3. You will now configure the conditions. Under Data Types, choose Determine Approver Input and select Sender Name.

      Determine Approver Input
    4. Choose Next Step to configure the results.

      Next Step
    5. Under Data Types, select Determine Approver Output.

      Determine Approver Output
    6. Select eMail.

      Select Email
    7. Select Next Step to review.

      Next Step
    8. Choose Create to create the rule.

      Create
    9. You may edit the rule you just created by selecting the pencil icon.

      Edit
    10. Define the attributes for Determine Approver1 Input.SenderName EXISTSIN['ABC Communication'] and 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
    11. In case the Determine Approver1 Input.SenderName is defined as EXISTSIN['Telecommunications'], the approval request should be sent to 'jane.doe@sap.com' or whatever recipient you might want to choose. Select the first row and Add Row to Insert After. Then maintain the row accordingly.

      Add Row
    12. Save your work, your decision table is ready.

      Decision ready

    What can you define with a decision table?

  • Step 3

    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.

    1. 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 delete the decision. Add the decision again in the process.

      Please refer to the Knowledge Base Article for the complete workaround.

    2. Define the input, select the text field of Document Number.

      Input Decision
    3. Assign the related data from the Process Content, here select Document Number.

      Document Number
    4. Repeat this also for Gross Amount and Sender Name, both are part of Invoice Details. The input mapping is done.

      Invoice Details
    5. Just check the Output, it is eMail, as you have defined it in the decision itself. Save your work.

      Decision Output

    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.

Back to top