Use List as an Input/Output for Decision Artifact in SAP Build Process Automation
- 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.
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:
- Step 1
After completing the prerequisites, you will create a new process.
-
Navigate to the Overview tab, from the editable version of your project, click the Create dropdown and choose Process.
-
In the Create Process dialog box, do the following:
- Enter a Process Name such as Order Processing Error Table
- Choose Create
Your new process opens in the process builder. You will now create a trigger form that will start the process.
-
Choose Add a Trigger.
-
Select Submit a Form.
-
Choose Blank Form.
-
In the Create Form dialog box, do the following:
- Enter a Form Name such as Order File Path Form
- Choose Create
-
Choose the three dots and select Open Editor.
-
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 -
For the input label Text select the Required checkbox, and Save.
-
- Step 2
-
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.
-
In the Duplicate Artifact dialog box, enter an Automation Name such as Get Order Details For Error.
Your new automation opens in the automation editor.
-
Now, select all activities from Create Sales Order variable to End as shown in the image below, pressing Ctrl and selecting the requested activities.
-
Right-click and select Delete from the context menu.
-
In the Automation Details section on the right, select Input/Output, and in the inputs section rename
OrderNumber
toFilePath
. In the output parameter section renameSelectedOrder
toSalesOrderDetails
and select List. -
Select Excel Cloud Link, in the details on the right side, choose the Edit Activity button.
-
In the Workbook Path field, select
FilePath
. -
Select End, in the configuration screen on the right, under the Output Parameters, in the
SalesOrderDetails
field enterOrders
. -
Save your automation.
-
Navigate to Order Processing Error Table process.
-
Choose + below the Trigger form.
-
Select Automation.
-
Choose Get Order Details For Error automation from Available Automations.
-
Map the input parameter
FilePath
of the automation with the File Path of Order File Path Trigger Form. -
Save your process.
-
- Step 3
-
Go back to the Overview tab, select Error Output data type.
-
In the Error Output data type screen, choose New Field to add a new attribute to the data object.
-
In the Field Details section on the right, in the Name field enter Order Number. Keep the type as String.
-
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.
-
Navigate back to the Overview tab.
-
Choose Order Validity Check decision.
-
Select Rules and choose Error Check.
-
Select the pencil icon on the top right to re-configure the rule.
-
Choose Next Step until Configure Result section.
-
In the Configure Results section, click on Validity Check Output to update the outputs to add
OrderNumber
. -
Choose Next Step.
-
Choose finish to update the decision table.
-
Choose Save and close the window.
-
- Step 5
-
Navigate to the Order Processing Error Table process. Choose + below the automation.
-
Select Decision.
-
Choose Blank Decision.
-
In the Create Decision window, enter a Decision Name such as Order Error Checking and choose Create button.
The decision editor will open where you can start modeling the decision.
-
- Step 6
You will select Add Input Parameter button and Add Output Parameter button to configure input and output parameters.
-
Configure Input Parameter:
- In Name enter: Order List Input
- In Description enter: Order List Input
- In Type choose: Sales Order, and select List
-
Configure Output Parameter:
- In Name enter: Order Error List
- In Description enter: Order Error List
- In Type choose: Error Output and select List
-
Save your decision.
-
- Step 7
-
Now, you will add intermediate variables that you will use to store the results of the rules. Select Variables and choose Add Variable.
-
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
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.
-
Similarly, for the second variable select Add Variable.
-
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
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.
-
Save your decision.
What is the main purpose of using intermediate variables in this scenario?
-
- Step 8
-
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.
-
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
-
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
-
Review and choose Create button to create the rule.
-
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.
Once you have successfully entered the values, your rule looks as below.
-
Save your work.
-
Go back to Rules, click on Back Button.
-
Click on the three dots next to Date Error Test rule and choose Duplicate.
-
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
-
Click on the Order Amount Error test rule.
-
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’
-
Save your rule.
-
Go back to Rules, click on Back Button.
-
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.
-
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
-
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.
-
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
-
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.
-
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
-
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.
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.
-
Go back to Rules and click on Add Rule.
-
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
-
In the Configure Results step, under Result Vocabulary choose
No Result
and click on Next Step button. -
Review and choose Create button to create the rule.
-
In the newly created Text Rule, in the If statement, assign
true
to represent the absence of any specific condition. -
In the Then statement, press Ctrl+Space on your keyboard and select Loop Functions.
-
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)
- In the Vocabulary select
-
Click on Apply.
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.
-
Click on the Then expression.
-
In the Configure Loop Functions window, select + to add a new expression box and enter : APPEND (Order Error List, Order Amount Error Error test)
-
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.
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.
-
Save your work.
-
Navigate back.
What is the main objective of the Main Rule?
-
- Step 10
-
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 forSalesOrderDetails
list.
-
-
Save the process.
-
- Step 11
-
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.
-
In the Duplicate Artifact dialog box, enter a Form Name such as Order Error Table Form and click on Duplicate.
Your new form opens in the form editor.
-
Click on the three buttons next to Customer Name and next to Order Number, then choose Delete to remove them.
-
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. -
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.
-
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.
-
Finally, change the name of Error Output field to Error Description.
-
Save your form.
-
Navigate to the Order Processing Error Table process.
-
Choose + below the decision.
-
Select Form.
-
Choose Order Error Table from Available Forms.
-
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
-
Now, configure the Inputs information section. In the select list field, choose
List - Order Error List
. -
Save the process.
-
- Step 12
CAUTION: Please complete the following tutorial, mentioned in Pre-requisites before you release and deploy the process.
-
In the Order Processing Error Table process, choose the Release button on the top right corner
-
In the Release Project popup, select Release.
-
In the Overview section that appears, choose Deploy.
-
Select an Environment and choose Deploy.
-
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.Your project successfully deployed.
CAUTION: Before executing the process, make sure your desktop agent is in unattended mode.
-
- Step 13
-
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.
-
In a new tab in your browser, paste the form link and enter your file path and select Submit.
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.
-
Navigate back to SAP Build Lobby and select Monitoring tab. Then choose Process and Workflow Instances under Monitor.
-
Now, select the Order Processing Error Table process. The process indicates that the Order Error task is available in My Inbox.
-
In the SAP Build lobby, choose My Inbox icon.
-
You will receive a notification with the error details in a table.
-
Choose Submit to complete the process.
-
You can navigate back to Monitoring > Process and Workflow Instances.
Your process completed successfully.
Congratulations! You have successfully completed the tutorial. With this process, sales executive is notified of erroneous and error free orders.
-
- Create a new process
- Create a new automation
- Create data types
- Update the Order Validity Check decision
- Create a new decision
- Configure input/output of decision
- Configure variables of decision
- Configure text rules of decision
- Configure main rule of decision
- Configure decision in process builder
- Create order error table form
- Release and deploy
- Test the process