Skip to Content

Use List as an Input/Output for Decision Artifact in SAP Build Process Automation

Use a list as an input to your decision artifact, process the data and extract the details to a table in a form
You will learn
  • How to use a list as an input/output to your decision.
  • How to use reusable text rules.
  • How to bind list in decision to table in form.
HaniadjamaiDjamai HaniaApril 3, 2024
Created by
Haniadjamai
July 27, 2023
Contributors
celineaudinsap
Haniadjamai
chaitanya-priya-puvvada

Prerequisites

  • Either complete the tutorial Create Tables in the Form OR
  • Retrieve the sample project Sales Order Management (MI05) from the store
  • Setup the desktop agent to run automation as explained in this tutorial.
  • Download the Orders.xlsx in your local machine.

In this tutorial, you will automate the process where the sales executive is notified about the erroneous or error-free orders through a task in the inbox of SAP Build Process Automation.

The process is designed to have the following artifacts:

  • A form where the sales executive would provide the path of sales order excel maintained in his system.
  • Automation to read the sales order details.
  • Decision artifact to process the details of a list of orders extracted from excel. Based on the rules created in the decision, it would determine whether the order details are error-prone or error-free.
  • Notification form to the sales executive which displays the erroneous or error-free sales orders in a table format.

The process looks as below:

decision

  • Step 1

    After completing the prerequisites, you will create a new process.

    1. Navigate to the Overview tab, from the editable version of your project, click the Create dropdown and choose Process.

      decision
    2. In the Create Process dialog box, do the following:

      • Enter a Process Name such as Order Processing Error Table
      • Choose Create
      decision

      Your new process opens in the process builder. You will now create a trigger form that will start the process.

    3. Choose Add a Trigger.

      decision
    4. Select Submit a Form.

      decision
    5. Choose Blank Form.

      decision
    6. In the Create Form dialog box, do the following:

      • Enter a Form Name such as Order File Path Form
      • Choose Create
      decision
    7. Choose the three dots and select Open Editor.

      decision
    8. Now, you will edit the form by using the available layout and input field options. Start by dragging and dropping the form layout fields, then enter the given names and field settings as shown in the example below:

      Form Fields Field Settings with Label
      Headline 1 Order File Path Form
      Paragraph Please provide the full file path for the Excel file and submit.
      Text File Path
    9. For the input label Text select the Required checkbox, and Save.

      decision
  • Step 2
    1. Navigate to the Overview tab, from the editable version of your project, search for Get Order Details automation. Choose the three dots and select Duplicate.

      decision
    2. In the Duplicate Artifact dialog box, enter an Automation Name such as Get Order Details For Error.

      decision

      Your new automation opens in the automation editor.

    3. Now, select all activities from Create Sales Order variable to End as shown in the image below, pressing Ctrl and selecting the requested activities.

      decision
    4. Right-click and select Delete from the context menu.

      decision
    5. In the Automation Details section on the right, select Input/Output, and in the inputs section rename OrderNumber to FilePath. In the output parameter section rename SelectedOrder to SalesOrderDetails and select List.

      decision
    6. Select Excel Cloud Link, in the details on the right side, choose the Edit Activity button.

      decision
    7. In the Workbook Path field, select FilePath.

      decision
    8. Select End, in the configuration screen on the right, under the Output Parameters, in the SalesOrderDetails field enter Orders.

      decision
    9. Save your automation.

    10. Navigate to Order Processing Error Table process.

    11. Choose + below the Trigger form.

      decision
    12. Select Automation.

      decision
    13. Choose Get Order Details For Error automation from Available Automations.

      decision
    14. Map the input parameter FilePath of the automation with the File Path of Order File Path Trigger Form.

      decision
    15. Save your process.

  • Step 3
    1. Go back to the Overview tab, select Error Output data type.

      decision
    2. In the Error Output data type screen, choose New Field to add a new attribute to the data object.

      decision
    3. In the Field Details section on the right, in the Name field enter Order Number. Keep the type as String.

      decision
    4. Save your work.

  • Step 4

    Since you have updated the Error Output data type with a new field Order Number, you will have to update the decision table to take into account this change.

    1. Navigate back to the Overview tab.

    2. Choose Order Validity Check decision.

      decision
    3. Select Rules and choose Error Check.

      decision
    4. Select the pencil icon on the top right to re-configure the rule.

      decision
    5. Choose Next Step until Configure Result section.

      decision
    6. In the Configure Results section, click on Validity Check Output to update the outputs to add OrderNumber.

    7. Choose Next Step.

      decision
    8. Choose finish to update the decision table.

      decision
    9. Choose Save and close the window.

      decision
  • Step 5
    1. Navigate to the Order Processing Error Table process. Choose + below the automation.

      decision
    2. Select Decision.

      decision
    3. Choose Blank Decision.

      decision
    4. In the Create Decision window, enter a Decision Name such as Order Error Checking and choose Create button.

      decision

      The decision editor will open where you can start modeling the decision.

      decision
  • Step 6

    You will select Add Input Parameter button and Add Output Parameter button to configure input and output parameters.

    decision
    1. Configure Input Parameter:

      • In Name enter: Order List Input
      • In Description enter: Order List Input
      • In Type choose: Sales Order, and select List
      decision
    2. Configure Output Parameter:

      • In Name enter: Order Error List
      • In Description enter: Order Error List
      • In Type choose: Error Output and select List
      decision
    3. Save your decision.

  • Step 7
    1. Now, you will add intermediate variables that you will use to store the results of the rules. Select Variables and choose Add Variable.

      decision
    2. In the Decision Variable window:

      • In the Name enter Order Input
      • In the Description enter Intermediate variable to store Order Details
      • Under Type select Sales Order
      • Choose Save
      decision

      Here, you will use an intermediate variable to store the inputs, which can be utilized later in reusable text rules, thus avoiding overwriting the original inputs.

    3. Similarly, for the second variable select Add Variable.

      decision
    4. In the Decision Variable window:

      • In the Name enter Error Output
      • In the Description enter Intermediate variable to store the error details of the Orders
      • Under Type select Error Output
      • Choose Save
      decision

      This intermediate variable will serve to temporarily store the outputs of the text rules for each error test, without overwriting the results of the initial tests. Additionally, it allows appending the result of each test to the variable, preserving the information from previous tests.

    5. Save your decision.

      decision

    What is the main purpose of using intermediate variables in this scenario?

  • Step 8
    1. Now, you are going to add reusable text rules, which are validation or error detection rules. Therefore, you will create a reusable rule for each error search in the command. Select Rules and choose Add Rule.

      decision
    2. The first text rule you will create is a test for the delivery date of the order. In the Create Rule window:

      • In the Rule Type select Text Rule
      • In the Rule Name enter Date Error test
      • In the Rule Description enter check order delivery date
      • Active Reusable Rule
      • Choose Next Step button
      decision
    3. Configure the output or result of the decision table. Under Result Vocabulary:

      • Select Error Output data type
      • In the Vocabulary section choose Error Output to add the Result Attributes
      • Choose Next Step button
      decision
    4. Review and choose Create button to create the rule.

      decision
    5. In the newly created Text Rule, add values to condition and result columns:

      • in the If condition: Order Input.expectedDeliveryDate < TODAY( )
      • In OrderNumber enter : Order Input.orderNumber
      • In ErrorDescription enter : ‘Delivery date is before current date’
      • In ErrorCode enter : ‘ERR01’

      Do not copy and paste the values, use the suggestions pop up (Ctrl+Space) as shown in the picture below. When entering the error code and its description, please remember to put two singles quotes first and then type the code and description inside them.

      decision

      Once you have successfully entered the values, your rule looks as below.

    6. Save your work.

      decision
    7. Go back to Rules, click on Back Button.

      decision
    8. Click on the three dots next to Date Error Test rule and choose Duplicate.

      decision
    9. The second text rule you will create is a test for the order amount. In the Duplicate Rule window:

      • In the Rule Name enter Order Amount Error test
      • In the Rule Description enter Test the order amount
      • Choose OK button
      decision
    10. Click on the Order Amount Error test rule.

      decision
    11. In the newly created Text Rule, change the values to condition and result columns:

      • in the If condition: Order Input.orderAmount > 100000
      • In OrderNumber enter : Order Input.orderNumber
      • In ErrorDescription enter : ‘Fraudulent Request’
      • In ErrorCode enter : ‘ERR02’
      decision
    12. Save your rule.

    13. Go back to Rules, click on Back Button.

      decision
    14. Now, you will create three more text rules to perform three additional tests. To do this, repeat the same steps: click on the three dots next to text rule and select Duplicate to create the three new text rules.

      decision
    15. The third text rule you will create is a test for shipping country. So similarly Duplicate a new text rule and in the Duplicate Rule window:

      • In the Rule Name enter Shipping Country Error Test
      • In the Rule Description enter check the Shipping Country
      • Choose OK button
      decision
    16. Click on the newly created Text Rule and change values to condition and result columns:

      • in the If condition: Order Input.shippingCountry NOTEXISTSIN [ ‘India’ , ‘United Kingdom’ ]
      • In OrderNumber enter : Order Input.orderNumber
      • In ErrorDescription enter : ‘Delivery not supported in this country’
      • In ErrorCode enter : ‘ERR03’
      • Save your rule and click on Back Button.
      decision
    17. The same goes for the fourth text rule, what you will create is a test for the order status. Duplicate a new text rule and in the Duplicate Rule window:

      • In the Rule Name enter Order Status Error Test
      • In the Rule Description enter test order status
      • Choose OK button
      decision
    18. Click on the newly created Text Rule, change values to condition and result columns:

      • in the If condition: Order Input.orderStatus = ’’
      • In OrderNumber enter : Order Input.orderNumber
      • In ErrorDescription enter : ‘Order status is not set’
      • In ErrorCode enter : ‘ERR04’
      • Save your rule and click on Back Button.
      decision
    19. Similarly for the final text rule, you will verify if the order has no errors. In the Duplicate Rule window:

      • In the Rule Name enter No Error Test
      • In the Rule Description enter test if the order has no errors
      • Choose OK button
      decision
    20. Click on the newly created Text Rule, change values to condition and result columns:

      • in the If condition: Order Input.expectedDeliveryDate >= TODAY( ) AND Order Input.orderAmount < 1000000 AND Order Input.shippingCountry EXISTSIN [ ‘India’ , ‘United Kingdom’ ] AND Order Input.orderStatus != ’’
      • In OrderNumber enter : Order Input.orderNumber
      • In ErrorDescription enter : ‘No Error’
      • Save your rule and click on Back Button.
      decision

    What type of rules are being added in this scenario?

  • Step 9

    Now, you will create a rule that will execute and utilize all the reusable text rules you created before in a loop for each order. The results will be sent to an error table stored in the previously created variable.

    1. Go back to Rules and click on Add Rule.

      decision
    2. In the Create Rule window:

      • In the Rule Type select Text Rule
      • In the Rule Name enter Main Rule
      • In the Rule Description enter A rule that executes all error-testing rules in a loop for each order
      • Choose Next Step button
      decision
    3. In the Configure Results step, under Result Vocabulary choose No Result and click on Next Step button.

      decision
    4. Review and choose Create button to create the rule.

      decision
    5. In the newly created Text Rule, in the If statement, assign true to represent the absence of any specific condition.

      decision
    6. In the Then statement, press Ctrl+Space on your keyboard and select Loop Functions.

      decision
    7. A window for configuring loop functions opens. Configure the function as follows:

      • In the Vocabulary select Order_List_Input.
      • In the Current Item select Order Input.
      • In the Expression statement enter: APPEND (Order Error List, Date Error test)
    8. Click on Apply.

      decision

      With this function, you iterate through each element, which represents each order, and perform the delivery date test. Then, it appends the test output to the Order Error List. So, the objective is to repeat the same process for each reusable text error rule that you have previously created and gradually add the collected errors for each order to the Order Error List.

    9. Click on the Then expression.

      decision
    10. In the Configure Loop Functions window, select + to add a new expression box and enter : APPEND (Order Error List, Order Amount Error Error test)

      decision
    11. Similarly, add three more expression box and enter the following in each box:

      • First box: APPEND (Order Error List, Shipping Country Error Test)
      • Second box: APPEND (Order Error List, Order Status Error Test)
      • Third box: APPEND (Order Error List, No Error Test)
      • Choose Apply button.
      decision

      So, here you will iterate through all the reusable text error rules that you have created earlier, one by one, for each order. The result obtained from each rule, whether there is an error or not, will be added to the Order Error List without overwriting the previous results. That is why you have used an intermediate variable.

    12. Save your work.

    13. Navigate back.

      decision

    What is the main objective of the Main Rule?

  • Step 10
    1. Navigate to the Order Processing Error Table process, select Order Error Checking decision and do the following:

      • Choose Inputs tab, under the select list click on the List - SalesOrderDetails to bind the properties for SalesOrderDetails list.

      decision
    2. Save the process.

  • Step 11
    1. Go back to the Overview tab and under the Artifacts, search for Order Rejection Notification with Errors form. Choose the three dots and select Duplicate.

      decision
    2. In the Duplicate Artifact dialog box, enter a Form Name such as Order Error Table Form and click on Duplicate.

      decision

      Your new form opens in the form editor.

      decision
    3. Click on the three buttons next to Customer Name and next to Order Number, then choose Delete to remove them.

      decision
      decision
    4. Now, change the Headline and the Paragraph following the table below..

      Form Fields Field Settings with Label
      Headline 1 Order Error Summary Table
      Paragraph The table below represents your processed order list with details of the errors found.
      decision
    5. Modify the table to add a cell for the Order Number. Click on the + icon beside Error Output field and select Text and enter Order Number as field name.

      decision
      decision
    6. Click on the three dots next to Order Number and choose Move Left to shift the cell to the left, and repeat the operation to move the cell all the way to the left of the table.

      decision
      decision
    7. Finally, change the name of Error Output field to Error Description.

    8. Save your form.

      decision
    9. Navigate to the Order Processing Error Table process.

    10. Choose + below the decision.

      decision
    11. Select Form.

      decision
    12. Choose Order Error Table from Available Forms.

      decision
    13. Configure the General information section:

      • In the Subject section, enter Order Error
      • In the Recipients section, under Users, select Process Started By from Process Metadata
      decision
    14. Now, configure the Inputs information section. In the select list field, choose List - Order Error List.

      decision
    15. Save the process.

      decision
  • Step 12

    CAUTION: Please complete the following tutorial, mentioned in Pre-requisites before you release and deploy the process.

    1. In the Order Processing Error Table process, choose the Release button on the top right corner

      decision
    2. In the Release Project popup, select Release.

      decision
    3. In the Overview section that appears, choose Deploy.

      decision
    4. Select an Environment and choose Deploy.

      decision
    5. In the Define Variables section, choose Deploy. You will enter the orderFilePath as you would provide the path of excel in the trigger form which is explained in Step 13: Test the process.

      decision

      Your project successfully deployed.

      decision

      CAUTION: Before executing the process, make sure your desktop agent is in unattended mode.

      decision
  • Step 13
    1. Open the Order Processing Error Table process of the deployed version and choose Order File Path Form, select the Copy Link icon next to the Form Link.

      decision
    2. In a new tab in your browser, paste the form link and enter your file path and select Submit.

      decision

      Once the form is submitted successfully, the BOT opens the Sales Order Excel file which is stored in your system, reads the data, and passes the data to the decision. The Business Rules are executed and the list of orders with/without errors are displayed in the tables in the form. You can follow the steps of execution in the Monitoring section.

    3. Navigate back to SAP Build Lobby and select Monitoring tab. Then choose Process and Workflow Instances under Monitor.

      decision
    4. Now, select the Order Processing Error Table process. The process indicates that the Order Error task is available in My Inbox.

      decision
    5. In the SAP Build lobby, choose My Inbox icon.

      decision
    6. You will receive a notification with the error details in a table.

    7. Choose Submit to complete the process.

      decision
    8. You can navigate back to Monitoring > Process and Workflow Instances.

      Your process completed successfully.

      decision

      Congratulations! You have successfully completed the tutorial. With this process, sales executive is notified of erroneous and error free orders.

Back to top