(Step by step guide to learn SAP automation with UiPath and SAP GUI)

Introduction

SAP enterprise software is widely used across various verticals of business operations. Many tasks of business operation such as input data, attach documents, updating status is repetitive in nature and time-consuming too hence they can be considered for automation.

SAP enterprise software contains GUI elements that are considered one block, which means that they cannot be used with simple recording.

Additionally, SAP operation often involves populating a high no of fields on-screen by copying data from another source such as excel or Copy paste from other applications.

In this article, I have covered various steps required for automating SAP Application Steps, Including the required configuration, Installation step, and best practices.

Some common SAP uses-cases across the industry

Based on Master Data Management 

  • Business Partner Creation/Change
  • Create/Change Material 
  • Create /Change cost center
  • Customers change/create
  • Managing basic administration tasks…
  • Many more…

Based on Financial Transaction 

  • Vendor Invoice by company code
  • Create Assest/Change Assest
  • Enter G/L Accounts
  • Upload Business Objects
  • Supplier Invoice processing
  • Many more…

Based on Project management 

  • Mass Upload of Timesheet Entries 
  • Re-assignment of profit and cost centers
  • Changing Project roles 
  • Creating of Automation reports for Contractors
  • Creating a contract
  • And many more…

Based on Procurement Management

  • Process Order Confirmation
  • Manage Purchase Info
  • Create /Change Product Master Data
  • Purchase Info Record Management
  • Master Data Reports & reconcile
  • And many more…

How to Install Free Trial Version SAP Version?

First thing first, many RPA developers complain that they don’t have an SAP system so they never tried Automating steps of SAP application. However, I would suggest you practice building few workflows to perform automation on the SAP application by leveraging Free Trial Version provided by SAP.

Covering step-by-step installation for free trial SAP is beyond the context of this article, however below are two options available for you to try your hands. (You can search google you will get many step-by-step guides.) For this article, I have used the ABAP Developer edition.

Docker Edition (SAP ABAP Platform 1909, Developer Edition)
  • Require Docker Hub Account
  • Docker Desktop
  • Your System should have 16GB+ Ram and 100GB + Hard disk
  • Read step by step installation guide (Steps here)
ABAP AS 751 SP02 on Linux (AS ABAP 752 SP04)
  • You should have Linux Distribution or Virtual Box
  • install openSUSE
  • Admin privileges to setup configuration
  • Read step by step installation guide (Steps here)

Configuring SAP GUI for Windows [SAP Client Connection]

SAP GUI is the graphical user interface client in SAP ERP’s 3-tier architecture of database, application server, and client.

Before you can configure and use the SAP GUI, you need to download the software from the SAP Marketplace. Once you have downloaded and installed the software now, you need to configure it, in most of the cases below details will be provided to you by SAP admin or your IT support to create a connection.

Some organizations follow standard methods where config files are copied to your machine which will auto-populate all the required Connections. [Example Shown Below]

SAP Connection Parameters New
SAP Connection Parameters

In case you need to create a new connection, you can follow below steps –

  1. Click on Create icon and select Connection as shown in the figure below:
  2. Fill in Application Server details and click on the OK button
      • Connection Type: Custom application server
      • Description: Name of the application server instance
      • System ID: SAP application server ID provided at the time of installation
      • Instance number: The instance number of the application server can be found at “/usr/sap/sid/DVEBGMS00” where the last two digits are the instance number
      • Application Server: – IP address of application server
  1. The created system will be listed on SAP GUI Logon PAD

Enabling SAP GUI Scripting

Why it’s required?

The SAP GUI Scripting API is an automation interface that enhances the capabilities of SAP GUI for Windows. Using this interface, end-users may automate repetitive tasks by recording and running macro-like scripts.

From the SAP server’s point of view, there is no difference between SAP GUI communication generated by a script and SAP GUI communication generated by a user. For this reason, a script has the same rights to run SAP transactions and enter data as the user starts it. In addition, the same data verification rules are applied to data entered by a user and data entered by a script

SAP GUI panels are seen as Block if SAP GUI scripting is not enabled, which means you won’t be able to recognize the SAP elements easily. Without this, selectors won’t work on the SAP UI elements. Image and OCR automation can be used instead, but selectors would provide increased accuracy to the workflow.

For UiPath to work you need to enabling SAP scripting for both client and server-side –

The following procedure shows an example with a client running SAP Signature Theme on Windows 10, the colors and appearance of screen might differ but functionality should be same in higher version with other themes.

SAP GUI Scripting on the Server-Side

Enabling SAP GUI Scripting on the server-side requires admin privileges and as an RPA developer, you need to contact the SAP system administrator to perform the required changes.

Here are steps Needs to performed –

  • Login to SAP, Start Transaction RZ11
  • On the Maintain Profile Parameters screen, enter “sapgui/user_scripting” and Click Display
  • In the Display Profile Parameter Attributes screen, choose Change Value.
  • Enter “TRUE” in the new value field, click the Save Button.
  • Check that the Current Value is set to TRUE.
SAP Automation Using UiPath | Step-by-Step 3
SAP Automation Using UiPath | Step-by-Step 4

Note: You need to restart SAP GUI after having changed the value from FALSE to TRUE on server side (RZ11).

SAP GUI Scripting on the Client Side [SAP GUI]

As stated above, to use SAP GUI for Windows for automation purposes, both client and server scripting must be enabled, server-side changes are done with (RZ11). Now time to change client settings – 

  1. If you are already Inside SAP Easy Access – Click Customize Local Layout and then click Options. Or You can Navigate to the SAP GUI Option screen (On Logon Page – > Click Menu Option and selection Options). A new window will appear –
  2. Under Accessibility & Scripting click Accessibility and then tick Use accessibility mode, click Ok to save.
  3. Under Accessibility & Scripting, click Scripting and then tick Enable Scripting and remember to untick all checkboxes below, click Ok to save.
SAP Automation Using UiPath | Step-by-Step 5
SAP Automation Using UiPath | Step-by-Step 6

Official UiPath SAP Activities

UiPath teams have recently introduced many UiPath Accelerators which helps you to start your automation as quickly as possible. These packages were formerly known as SRC Components for SAP ECC, which was built and delivered by UiPath Japan.

Key points – 

  1. Uipath Accelerators for SAP packages include workflows, which can be also used as a test case for the most common SAP WinGUI transactions for SAP ECC and SAP S/4 HANA systems.
  2. The packages contain the most required business application/transaction, which is fully automated and serves as automation master templates for SAP Robotic Process Automation and SAP Test Automation.
  3. All you need to do is download these templates from UiPath Marketplace and change the required configuration as per your need.  Using your own business data these automation templates can be used to automate any task without any significant changes or adoptions.
  4. Each prebuilt automation asset (xaml-file) contains a set of activities, which allow customers to perform corresponding actions in the system e.g., Create Sales Order, Create Invoices, Create SAP User, etc…
How to use Accelerators 
  1. UiPath Studio 20.10 and UIAutomation Package 20.10 are recommended versions
  2. The Foundation Pack is a prerequisite for all other UiPath Accelerators for SAP ECC
  3. They are built for both SAP WinGUI automation and native integration via SAP BAPI to ensure that automation is robust, stable, and performant.

Example of SAP Automation Project

Use case – 

Mass creation of users and role mapping.

Problem Statement –

During migration/upgrade or testing many users needs to be created,  It also requires to map them to different User-Role Assignments. This requires manual effort.

In this case, a lot of time and manpower is wasted on a repetitive task. There is also a risk of inaccuracy due to human error. Automation of this task can save a lot of time and effort, and can also substantially improve precision.

The Solution: Using UiPath RPA –

  • UiPath can help automate the task of creating users on an SAP system.
  • UiPath Studio has inbuilt activities, and can easily interface with the SAP Logon GUI application.
  • The UiPath solution deploys a robot that reads the requested changes from an Excel file and then performs all corresponding actions in SAP
  •  The developed RPA Bot can be scheduled to run as required using unattended robot. Or this can be work along with Human sitting on his desktop as attended.
  • The Input data (system name, template user name and new user name) is fetched automatically from email to read data and perform the automation task.
  • This can be further enhanced using Action Center incase you need to add approval workflow.

Automation Steps Using UiPath

Read Email
Searching for email with attachment in specific email folder
Direction Arrows
Step 01
Save Attachment
Saving Input Data attachment to Filesystem
Direction Arrows
Step 02
SAP Login
Starting the SAP GUI and logging on to SAP Instance
Direction Arrows
Step 03
Create User
Loop-over email for creating individual account using Transaction SU01
Direction Arrows
Step 04
Role Mapping
Map User to existing SAP Role
and Profile
Direction Arrows
Step 05
Send Credentials
Send Email to user with
Account Details
Direction Arrows
Step 06
Update Status
Record Transaction Status for Each Created User in Input Sheet.
Direction Arrows
Step 07
Send Report
Send Report to Configured
Email as Status.
Step 08

Working Demo

Key Points for UiPath Workflows

  • SAP Automation Using UiPath Project has been created using Re-Framework, modified to work with Excel as Input Data instead of Queue
  • SAP Activities are already included in UI Automation- > SAP, So no need to install any packages.
  • In this example, we have used SAP Logon & SAP Login Activity given by UiPath
  • User Creation has been done using some SAP Activity such as Click Toolbar Button, Read Status Bar, Select Menu Items.
  • Rest other workflows are designed as using standard activities.
  • You can download working code from my GitHub repo. (Link below)
  • You can use the below default activities as per your need.
SAP Automation Using UiPath | Step-by-Step 7
SAP Automation Using UiPath | Step-by-Step 8

Best Practices

  • Running both the SAP GUI for Windows and SAP Business Client simultaneously can generate unpredictable selectors matching results. This is because it is impossible to reliably distinguish between the SAP Scripting instances of the two clients.
  • Make sure to validate windows and pop-up before performing any opeartion.

References