Go back to all articles

SAP Load and Performance Testing Using Loadrunner

Mar 15, 2022
5 min read

SAP ERP (Enterprise Resource Planning) is an enterprise resource management software that covers the work of an entire company. SAP is the market leader in enterprise application software, helping companies of all sizes and in all industries run at their best: SAP customers generate 87% of total global commerce. If this is the case in your company, you might have started asking yourself how to test your SAP’s performance and which tools to choose. In this article, we will share the basics of how we test SAP ERP with Loadrunner.

Looking for Performance and Load Testing Provider?
Drop us a line. Most likely, we have already dealt with problems like yours in the previous 300 projects.

Why Do You Need to Test Your SAP Performance?

Like any ERP system, SAP has to provide its users with up-to-date reliable data about the current state of affairs for decision-making. Besides, this kind of information must be reliably protected. With the development of your company, the ERP system must be updated and rebuilt according to new business goals, which leads to the need for testing. But which tools to use to test performance of your SAP?

Is Loadrunner a Good Tool for SAP Performance Testing?

Loadrunner is the perfect tool to execute a performance test against a SAP system. It understands the protocol used by SAP GUI interface and can record or reproduce it, so it can build a robot, generating thousands of copies of it almost instantly in order to execute the performance test.

There are two main types of SAP scripts: SAP-GUI and SAP-WEB. Before you start recording the script, check if you have two basic prerequisites:

  • get access to all the necessary roles, including the scripting role;
  • study the business process, and go through it manually, without recording, to identify any possible issues and to check the availability of all roles.

Recording Scripts with SAP GUI

To test SAP application, choose SAP GUI:

Recording scripts with SAP GUI 1

Choose SAP Logon in the Application menu, then choose the location of your application (although it is usually chosen automatically). Click Start Recording to start recording the script.

Recording scripts with SAP GUI 2

The application starts running. At this stage, select a system to be tested by double-clicking it.

Recording scripts with SAP GUI 3

In the User/Password fields, the password field will not show characters, so be careful when entering the password. For instance, in our project, it was possible to make a mistake only twice. After the third attempt, the account was blocked 🙁

Recording scripts with SAP GUI 4

After entering your login and password, you will be transferred to the main page of the system you chose to test. There, act according to the script.

Recording scripts with SAP GUI 5

If you need to, switch to another tab using the command which is  mentioned in the testing script.

Recording scripts with SAP GUI 6

Don’t Want to Run Tests by Yourself?
We have been working on performance testing projects since 2008.
Get a quote Drop us a line to find out what our team can do for you.

Debugging SAP-GUI Scripts

After recording the script, next steps are parameterization and correlation.

Debugging SAP GUI Scripts 1

Snapshots displayed graphically will help you to do so: click a cell, a button, or any other element, and add the function you need. For example, add a row that will fill the cell with other data or, on the contrary, pull out the data for further work.

Debugging SAP GUI Scripts 2

Sometimes in order to view certain arguments, paths, or an ID of a particular object (i.e. button), you will have to use spy applications, such as, for example, Object Spy, since Snapshot is not always enough.

Debugging SAP GUI Scripts 3

After having recorded the scripts, you will see that some parameters in the table were parameterized automatically. You’d better edit them, since problems may arise later. However, don’t forget that there are different types of parameters, and some cells accept only the tabular ones.

For example, we filled in two ExpTy fields with the value “AIR”, and two Amount fields with the value 1000.

Debugging SAP GUI Scripts 4

As you can see, two values were written into one variable “{data}”.

Debugging SAP GUI Scripts 5

And the value of the first row of the column was recorded in the variable, too. So it’s better to edit the code and separate the variables.

Debugging SAP GUI Scripts 6

After you change sapgui_table_fill_data into sapgui_set_text, the link will also specify the session number and the window number, which will need to be removed (ses[0]/wnd[0]/). Otherwise, they will cause an error in case of multiple test runs.

Debugging SAP GUI Scripts 7

If errors occur when running the script, you can run the script with display. To do so, go to Runtime Settings→General→Performance, and check all fields. You will need to arrange lr_think_time(); in order to see the location of the error, or run the script in step-by-step mode.

Debugging SAP GUI Scripts 8

Problems and Solutions in Performance Testing of SAP GUI with LoadRunner

Check for a pop-up window

Sometimes the same action can bring different results. For example, an additional window may be displayed, and ignoring it is impossible. For this case, we have a ready-made solution.

if (sapgui_is_object_available("wnd[1]")){             

Check for an empty string

If, after saving or executing the script, you need the resulting number to use it in the future, run a check. It is necessary so that if for some reason the number does not appear, the script does not continue its work.

Checking for an empty string should be run before Action.

void failIfEmpty(char * parname) {
//the function is called internally after correlation
//failIfEmpty(parameter); example :
sapgui_status_bar_get_param("1","ram_contract", LAST);
 // correlation, you’re pulling  out the created contract
// check what you pulled out. If it is empty, the script will be completed with an error.

A detailed description of LoadRunner functions is available on the website https://admhelp.microfocus.com.

Recording Performance Testing Scripts for SAP WEB with LoadRunner

It turns out that recording SAP WEB scripts and debugging them is not much different from recording and debugging Web-HTTP/HTML scripts. When you create a new script, select SAP – Web protocol.

Recording performance testing scripts for SAP WEB with LoadRunner 1

The snapshot shows RequestBody and ResponseBody, whilst web_url, web_submit_data, and web_add_header are written in the code.

Recording performance testing scripts for SAP WEB with LoadRunner 2

Have a Project in Mind?​
We have been working on performance testing projects since 2008.
Drop us a line to find out what our team can do for you.
Get a quote You’ll hear back from our tech account manager in one day if not sooner


You can use LoadRunner performance testing tool to do the performance testing for SAP GUI or SAP WEB Applications. You will need to understand concepts like SAP GUI protocol,

Control ID’s, Grids, Object IDs, Verification Points, etc., but trust us, it is absolutely doable. If, however, your plate is full right now, never do tomorrow what you can let us do today: in PFLB, 400+ engineers on staff have completed 300+ major projects, rest assured they can help with yours, too. Request a demo!

Table of contents
Let us know about your needs
We can provide multiple performance testing services and a lot more than that if the situation needs a far more complex approach.
Get a quote You’ll hear back from our tech account manager in one day if not sooner

Related insights in blog articles

Explore what we’ve learned from these experiences
8 min read

Why Load Testing Is Essential for Ecommerce Businesses

why load testing is essential for ecommerce businesses preview
May 17, 2024

The success of 26 million online retailers depends on the page load time. It significantly impacts the profitability of online services and sales, as customers don’t want to wait over three seconds to make a purchase. To ensure the desired speed, load testing is widely applied. Common Ecommerce Problems That Can Be Solved with Load […]

8 min read

Everything You Should Know about Performance Testing of Microservices

everything you should know about testing microservices preview
May 2, 2024

About 85% of enterprise businesses use microservices. In this article, we will cover the primary specifics of microservices, explain why they need performance testing, and highlight how to make this process efficient. Microservices in a Few Words Microservices (or microservices architecture) refers to a methodology for developing and deploying applications. This approach separates an extensive […]

4 min read

PFLB is Now SOC2 Compliant

pflb is now soc2 compliant preview
Apr 24, 2024

The PFLB team is happy to share the good news. We have passed the SOC 2 compliance accreditation. It means we can assure our clients that our cooperation will be entirely secure. What Is SOC? Introduced by the American Institute of CPAs (AICPA), SOC, or Service Organization Control, is a cybersecurity series of reports made […]

11 min read

How Do Businesses Benefit from Frontend Performance Testing?

how do businesses benefit from frontend performance testing preview
Apr 15, 2024

Crucial bottlenecks are usually backend-related. That’s  why backend performance testing is generally regarded as a must. However, only 1% of companies perform frontend performance testing. They don’t consider that to achieve the best business results, one should combine the two types.  Let’s prove it. We will define their differences, emphasize the importance of conducting backend […]

  • Be the first one to know

    We’ll send you a monthly e-mail with all the useful insights that we will have found and analyzed