SAP is one of the most popular business applications in the world, with millions of users worldwide relying on the software to do their jobs each and every day. As we have noted in previous blogs here, load testing SAP is an essential priority to any business that relies on SAP to process their transactions.
With this in mind, we decided to showcase how SAP load testing can be done easily using Flood Element for simple scripting of these complex business scenarios. In this post, you will see how you can easily test the first step of Order To Cash, Order Creation, in just a matter of minutes.
What is SAP Order to Cash?
Order to Cash is one of the most important processes that is common to most SAP customers, because it is essential in collecting payment for goods that are being sold. Order to Cash consists of a number of processes that are interconnected to create the end-to-end process of creating an order through to getting paid:

As this process is typically customized highly to meet the needs of each individual customer, we will take a look at the most simple and common piece of the process, which is creating the Sales Order in SAP.
What is SAP Fiori?
For this particular tutorial, we have focused on the latest and greatest technology that SAP has to offer, which is the web based SAP Fiori UI on top of the S/4 HANA database. While many customers are still in the early phases of migrating to SAP Fiori, there is a mandate that all customers must migrate completely to S4 HANA and Fiori by 2025.
With the shift to Fiori, the technical landscape changes dramatically from a thick client application to a dynamic web front end. This will require customers to change out their typical SAP Load Testing scripts written in tools, such as LoadRunner, for newer solutions that handle dynamic web apps with ease, such as Flood Element.
Load Testing SAP Order to Cash
Before jumping in to the tutorial, we recommend installing Flood Element and a compatible IDE, such as Microsoft VSCode. You can familiarize yourself with Flood Element in our documentation or blog posts.
Diving in to our test scenario, we will walk through step by step creation of a sales order including the following steps:
- Logging in
- Selecting the Tile for Sales Order creation
- Entering Sell To Party
- Adding Item and Quantity
- Retrieve Sales Order Number
Step 1: Logging In
Logging in to SAP is a fairly easy process, and provides a good place to start learning the basics of Flood Element.
First, we make sure we are on the login page by asserting the expected text "Log On" appears on the page:
js
//Validate text
let loginValidation = By.visibleText('Log On')
await browser.wait(Until.elementIsVisible(loginValidation))
Then, we simply find the username and password fields using the css selectors for username and password, and enter our username and password using the type command.
js
//enter username
await browser.type(By.css('#j_username'), "username")
//enter password
await browser.type(By.css('#j_password'), "password")
Once complete, we click the "sign in" button.
js
//click sign in
let signin = await browser.findElement(By.css('#logOnFormSubmit'))
await signin.click()
Finally, we validate we are returned to the trial center homepage and take a screenshot (if desired) to keep for future troubleshooting.
js
//Validate text
let dashValidation = By.visibleText('Trial Center')
await browser.wait(Until.elementIsVisible(dashValidation))
await browser.takeScreenshot()
Step 2: Selecting the Tile for Sales Order creation
Next, to create the Sales Order we must navigate to the page for Sales Order creation by selecting the tile for creating the Sales Order. In this case, we are doing a bit of extra work to create the xpath for the element that contains the text "Sales Order".
js
//click Create Sales Orders
let btnCreateSalesOrders = await
browser.findElement(By.xpath("//div[contains(@aria-label, 'Create Sales
Orders')]"))
await btnCreateSalesOrders.click()
Similar to in the first step, we validate that we have reached the proper page for entering a new sales order by confirming we see the text "New Sales Order".
js
//Validate text
let salesordersValidation = By.visibleText('New Sales Order')
await browser.wait(Until.elementIsVisible(salesordersValidation))
Step 3: Entering Sell To Party
Once the new Sales Order has been created, the first step in entering it is to select a sell to party. As is common with many SAP applications, these entities have unique ID's that can be entered to save the trouble of typing out all of the same information over and over again.
In this case, we can simply input the ID "17100001" and press the TAB key to have all of the rest of the information populated automatically.
js
//Sold-To Party (will pre-fill other fields after TAB press)
await browser.type(By.xpath("//input[contains(@id,
'Identification::SoldToParty')]"), "17100001")
await browser.press(Key.TAB)
We continue on with the other fields in the process in the same way to complete the general information for our sales order.
js
//Sales Organization
await browser.type(By.xpath("//input[contains(@id,
'Identification::SalesOrganization')]"), "1710")
//Distribution Channel
await browser.type(By.xpath("//input[contains(@id,
'Identification::DistributionChannel')]"), "10")
//Division
await browser.type(By.xpath("//input[contains(@id,
'Identification::OrganizationDivision')]"), "00")
Step 4: Adding Item and Quantity
Now that the order has the correct information related to its billing and distribution, we must select what items and what number of those items will be included in this sales order. To do this, we autofill the information using a unique item ID, similar to how we entered our sell to party.
js
//Material
await browser.type(By.xpath("//input[contains(@id, 'Default::Material')]"),
"TG11")
await browser.press(Key.TAB)
//Requested Quantity
await browser.type(By.xpath("//input[contains(@id,
'Default::RequestedQuantity')]"), "1")
await browser.press(Key.TAB)
//Requested Delivery Date
await browser.type(By.xpath("//input[contains(@id,
'Default::RequestedDeliveryDate')]"), "01/16/2019")
await browser.press(Key.TAB)
Once the item is entered, it should be able to be added by clicking the "Add Item" button.
js
//click Add Item
let btnAddItem = await browser.findElement(By.xpath("//span[contains(@id,
'BtnAddToItems')]"))
await btnAddItem.click()
Step 5: Saving Sales Order
Once the information required to complete the order is entered, we should be able to save the order for processing by clicking the "Save" button.
js
//click Save
let btnSave = await browser.findElement(By.xpath("//button[contains(@id,
'Details::C_SalesOrderTP--activate')]"))
await btnSave.click()
We may receive any number of warning messages after saving the order, which we need to close before we can move on to the next step.
js
//Item is not relevant for output.
let warningValidation = By.visibleText('Item is not relevant for output.')
await browser.wait(Until.elementIsVisible(warningValidation))
//Close warning dialog
let btnClose = await browser.findElement(By.xpath("//button[contains(@id,
'manageSalesOrder-component-appContent--Close')]"))
await btnClose.click()
Step 6: Retrieving the Order Number
To test the next phase of the Order to Cash process, we need to retrieve the Order Number that is generated by SAP. We do this by finding the order number in the expected area of the UI.
js
//retrieve Sales Order number
let salesOrderNumber = await browser.findElements(By.xpath('//[@id="cus.sd.salesorder20.manage::sap.suite.ui.generic.template.ObjectPage.view.Details::C_SalesOrderTP--objectPageHeader-innerTitle"]'))
let salesOrderNumberValue = await Promise.all(salesOrderNumber.map(span =>
span.text()))
console.log('salesOrderNumberValue = ' + salesOrderNumberValue[0])
Step 7: Navigate Back to Main Dashboard
We send the browser back to the main dashboard to allow us to test further aspects of the order to cash process using this newly generated sales order.
js
//click home #homeBtn
let btnHome = await browser.findElement(By.css('#homeBtn'))
await btnHome.click()
Putting It All Together
We have collected all of these steps together into a complete script located in our example repository for Element. Please feel free to download this script and use it for your own starting point to load test Order to Cash.
When you have a script created, you can run it locally or upload it into Flood to execute it with 100's or 1,000's of concurrent users. The free trial will provide you with enough node hours to execute this Flood Element test outlined here for 15 minutes with roughly 1,000 concurrent users.
If you are load testing SAP Fiori, we'd love to hear from you. Drop us a note and share any ideas that are working for you and feel free to ask our team any of your tough questions!