Skip to Content

Capture an Application using SAP Build Process Automation

Learn how to capture a web application and then build an automation to automate the process of retrieving order details.
You will learn
  • How to capture an application with different screens
  • How to declare elements of a captured application
  • How to build an automation using a captured application

shielddzIlyes YamounDecember 8, 2022
Created by
celineaudinsap
November 20, 2022
Contributors
celineaudinsap

Prerequisites

In this tutorial, a Sales Orders web application is captured and details will be retrieved for a specific sales order through an automation.

  • Step 1
    1. Open the following link in a new browser window: Sales Order Application.

    2. In Artifacts create a new Application.

      Create Application
    3. Select Browse Order application that was is opened in step 1.1.

      Select Application
    4. On the Screen Details panel on the right:

      • Select Capture Application.
      • Select Create a new application.
      • Set the Application Name to Order Management.
      • Set the Screen Name to Orders List (or Main List).
      • Click Capture.
      Screen Details
    5. Go back to the application browser window and click on first order to get the second screen.

      Get Second Screen
    6. In the Order Management Application, create a new Screen.

      Create new Screen
    7. On the Screen Details panel on the right of the window that popped-up:

      • Select Browse Orders screen.
      • Set Screen name to Order Details.
      • Click Capture.
      Capture Second Screen

      On the right side, there is a warning message “Another screen matches the criteria beforehand”, putting the right criteria will fix it.

    8. Click on Order Details then click on the Title Criteria.

      Second Screen Criteria
    9. In Modify Criterion small window:

      • Set Property to URL.
      • Set Operator to contains.
      • Set Value to ?tab=.
      • Click Apply.
      Modify Criterion menu
    10. Repeat the steps 1.8 and 1.9 for Orders List Screen while setting Operator to doesn’t contain.

      First Screen Criteria

      The application is now created with its two screens.

    Log in to complete tutorial
  • Step 2
    1. In Order Management Application, click on Orders List Screen.

    2. Select Both option situated in the top to show the DOM Tree, then click on first order on the screen.

      Select First Order
    3. In Element Details on the right:

      • Set Name to Orders.
      • Remove Text recognition criteria.
      • Click Declare Element.
      Order Element details
    4. In Declared Elements on the left, select Orders element and set it as Is a collection using the button

      Is a collection icon
      .

      Set Order as a collection
    5. Find the element Order Date using the DOM Tree.

      DOM Tree Order Date
    6. Order Date element:

      • Set Name to Order Date.
      • Remove Text criterion.
      • Select Class criterion on Captured Data panel.
      • Click Declare Element to declare this element.
      Order Date Element Details
    7. Set Order Date as Is a collection as shown in step 2.4.

    8. Repeat same steps ( 2.5 ~ 2.7 ) for Order Status.

      Order Status DOM Tree
    9. Repeat same steps ( 2.5 ~ 2.7 ) for Order Number.

    10. Select Save. Orders List screen’s three elements are now declared.

      First Screen Elements
    Log in to complete tutorial
  • Step 3
    1. In Order Management Application, click on Order Details Screen.

      Select Order Details Screen
    2. To declare Order Price.

      • Click on 410,418.22.
      • Set Name to Order Price.
      • Remove Text criterion.
      • Select id criterion on Captured Data panel.
      • Click Declare Element to declare this element.
      Declare Order Price Element
    3. Repeat step 3.2 for Order Number element.

    4. Repeat step 3.2 for Shipping Address’s 5 elements:

      Shipping Address Elements
      Element Name id (Criterion)
      Name Address Name __text37
      Street Address Street __text38
      ZIP Code/City Address zip city __text39
      Region Address Region __text40
      Country Address Country __text41
    5. Repeat step 3.2 for Customer element.

    6. Select Save to save your changes. Order Details screen’s seven elements are now declared.

      Second Screen Elements

    What is the criterion for Customer and Order Number elements?

    Log in to complete tutorial
  • Step 4
    1. Create a new Data Type.

      Data Types are used to describe an entity’s schema. An example of that would be describing a person using his: First name, Second name, Age, etc…

      Data Type Artifact
    2. Set Name to Sales Order.

      DT Details
    3. Now, declare its fields. Click New Field to create a new field in Data Type.

      New field Button
    4. Add the following fields:

      Field Name Type
      orderNumber String
      orderDate Date
      orderAmount Number
      shippingCountry String
      orderStatus String

      You will notice that not all declared elements were used.

    5. Select Save to save your changes. Sales Order datatype is now ready to be used.

    Log in to complete tutorial
  • Step 5
    1. Create a new Automation artifact and name it Get Order Details From Application.

      add automation input parameter

    2. Order Number has to be passed as an input to our automation and return a Sales Order as an output. Click on the canvas of the automation then click Input/Output.

    3. Click Add new input parameter.

      add automation input parameter
    4. Set Name to orderNumber (Case sensitive) and Type to String.

      change name input parameter
    5. Click Add new output parameter.

    6. Set Name to order and Type to Sales Order.

      change name output parameter
    Log in to complete tutorial
  • Step 6
    1. Add Order List Screen to the automation.

      Add First Screen to automation
    2. Select on the screen in the automation then click Define Screen Activities.

      Define Screen Activities
    3. Search Start Web Page activity and drag-and-drop it inside the Orders List screen.

      Add Start Web Page
    4. Click on Start Web Page activity to modify its attributes:

      • Make sure the target is set to Orders Management > Orders List.
      • Select your browser.

      Note: SAP Build Process Automation browser extension must be installed on the used navigator.

      Start Web Page activity
      To find the desired order’s details, iterating through the orders is mandatory.
    5. Search For Each activity, and add it inside the screen activity in the automation.

      Add For Each Activity
    6. Choose For Each activity, then:

      • Click Target Editor.
      • Select Order Management > Orders List > Order Number.
      • Click Confirm.
      Configure For Each Activity
    7. Select on the screen to open Define Screen Activities, then:

      • Search for Get Element screen activity.
      • Drag-and-Drop it inside of the For Each activity in the automation.
      • Open Target Editor.
      • Select Order Management > Orders List > Order Number.
      • Set Index of the element to (2) index.
      • Set Output Parameters to currentOrderNumber.
      Get Element Activity
    8. To check whether the order in the current iteration of the for loop matches the one we have in the input, checking equality must be done. Search for Condition activity:

      • Drag-and-Drop it inside the For Each Activity,
      • Click on it to edit its attributes,
      • Open Edit Formula,
      • Set expression to Step0.orderNumber === Step3.currentOrderNumber,
      • Click Save Expression.
      Condition Activity configuration
      When the order is found, its details are retrieved.
    9. Add four Get Element screen activities inside of the condition activity.

    10. For all Get Element screen activities:

      Get Element n° Name Target Output Parameters
      First Get Order Status Order Management > Orders List > Order Status (with Index of the element set to (2) index) orderStatus
      Second Get Order Date Order Management > Orders List > Order Date** (with Index of the element set to (2) index) orderDate
      Third Get Order Price** Order Management > Orders Details > Order Price orderPrice
      Fourth Get Order Country Order Management > Orders Details > Order Country** orderCountry
      Get Elements activities

      You can notice that Order Details screen was added when its elements were used by Get Element screen activity. That is because in order to use an element it has to be wrapped by its screen.

    11. To access the second screen, we must click on the adequate order:

      • Add a Click screen activity before Order Details screen activities.
      • Set its target to Order Management > Orders List > Orders with Index of the element set to (2) index.
      • Add a Wait activity right after Click screen activity.
      Activities to open details
    12. To store the gathered data, create a Sales Order variable. Search for Sales Order on the right panel.

    13. Drag-and-Drop it at the top of the automation, right after Start.

      Sales Order Variable
    14. Click on the activity and set Output Parameters to order.

    15. At the end of the automation, click End and set order to order.

      Set Output Variable
    16. Add Set Variable Value activity after Order Details screen:

      • Set variable attribute to (1) order.
      • For value field select Create Custom Data.
      • For the 5 fields that appeared:
      Field Name Value
      orderNumber (4) currentOrderNumber
      orderDate (7) orderDate
      orderAmount Open expression Editor and set value Number.parseFloat(Step10.orderPrice)
      shippingCountry (11) orderCountry
      orderStatus (12)
      Set order Variable Values
    17. Add Loop End control after Set Variable Value activity to stop the looping process once the order is found and its data is retrieved.

      End Loop
    18. To show the resultant order after the execution finishes, add Log Message activity and set Value to (1) order.

    19. Choose Save to save your changes.

    20. The automation is now finished and ready to be used as a standalone automation or with a process. The final automation looks as below:

      Final automation
    Log in to complete tutorial
  • Step 7
    1. Choose Test.

    2. Set orderNumber to an existing order in the website (ex. 7991) to test the automation with it.

      Test

    3. Test Results:

      • Automation opens Chrome Browse Orders Application.
      • Loops through all orders and verifies whether the order with the order number given in the input exists. If it finds the order it clicks on it and sets the values present in the screen.
      • Ends the looping.
      • The Order is retrieved and shown with all its details in Test Console.
      Test Results

    Log in to complete tutorial
Back to top