10 February 2022

How RPA Developers Can Kick Start SAP Automation

10 February 2022

How RPA Developers Can Kick Start SAP Automation

⬅  SEE ALL THE ARTICLES

 

Introduction

 

This tutorial is dedicated to RPA developers with little or no SAP background but need to work on SAP automation, and need basic understanding around its navigation. I will share my experience working with SAP and UiPath to set up a development machine and SAP tool tips that are handy for any RPA developer to sail successfully through SAP connectivity and screens.   

 

Requirements 

 

This blog is written with SAP-ECC 6.0 screen prints, but most of these steps should remain the same for S/4 HANA GUI as well.

  

Pre-Step 1

 

Access to SAP environment (I highly recommend QA environment with recently copied production data) with latest GUI installed on it. SAP roles and privileges can be the same as end user access for you to navigate the transactions. We will cover advanced SAP Development in future blogs and related access upgrades to development systems. If you are an SAP ABAP developer (and jumping into RPA development), your existing access to SAP Development instance (with some production data) is sufficient at this point.

 

Pre-Step 2

 

Once you have SAP-GUI installed and login created, the first thing to do is add an SAP connection for the environment you are given access to. Generally, this step is done by the SAP BASIS team when they install the GUI for you. This is what an SAP logon pad looks like:

 

SAP Logon Pad Options

 

Please note down the "Name" of the connection as it is important for UiPath activity to login to SAP system. 

 

Steps

 

Section 1 GUI Setup

 

Let's talk about setting up SAP GUI for UiPath to successfully connect to SAP and how to further optimize it. 

 

  • Enable Scripting
  •  
  • Now that we have understood prerequisites, let's talk about setting up GUI for UiPath to connect successfully with SAP and execute transactions. Two important steps here:  
  • GUI settings: Using SAP Logon Pad, go to Options, Accessibility & Scripting, Scripting and check "Enable scripting" under User Settings. Under same setup, please uncheck the 3 check boxes underneath it related to "Notify" and "Show" and click Apply.
  •  
  • SAP Logon Pad Options-1

  • Maintain Profile Parameter: The second step to enable scripting is to set the profile parameter at the SAP Application server level. There are two ways to do it:   
  •  
  • Local Setting
  •  
  • You may need SAP Basis help to execute this transaction. Transaction code: RZ1. In the parameter name, type sapgui/user_scripting and click Display.
  •  

RZ11 Initial Screen

 

When you get to the next screen, click on Change Value and enter "True" as New Value and click Save. Current Value on the screen should change to True.

 

RZ11 Detail Screen

 

 

RZ11 Change Screen

 

 

Note: Your base team may have already set this setting to True at server level. In that case no action is required at your end. Also, since this is a local setting, this will be reset back to default setting as False whenever the server is restarted. You may notice a warning message as "Change not permanent: will be lost at server restart". 

  • Server Setting
  •  
  • To avoid losing this setting at server restart, I highly recommend setting it up at server level using transaction code RZ10. This is an administration task and will need coordination with the SAP Basis administrator. In my experience, I have been able to manage using RZ11 as local setting and adjust it whenever it gets reset working in SAP Development or QA environments. In production instances, it is most likely already set at server level, but please check with basis administrator. 
  •  
  • Enabling High Speed Connections
  •  
  • It is recommended to enable 'High Speed Connection (LAN) option in SAP, which is generally set as default. You can check the current setup following these steps: Right click on the SAP Connection you want to log into and select Properties. On the System Entry Properties, switch to 'Network' tab. Under Network settings, confirm that High Speed Connection (LAN) is selected.
  •  
  • Depending on the SAP server version and its setup, there are other parameters that may be relevant and better to confirm before starting the automation. For more details, please refer the UiPath documentation available here
  •  
  • Enable key And Description
  •  
  • Show keys within dropdown lists. Another useful setting I found handy is enabling "Keys" in the dropdown list. What does this mean? SAP screen fields with drop down pick list values generally show description only, which is sometimes difficult for automation to read and might need to use wild characters to search from the text list. By enabling "Show Keys within dropdown lists" it shows both key value and description in the drop-down list, which is easy to index for selection and search. To do that, go back to GUI options from SAP Logon Pad, Interactive Design, Visualization 1. Check "Show keys within dropdown lists' under Controls section. Also check the "Sort by keys within dropdown lists for most efficient keyboard input" to make it even more optimal. Click Apply. 
  •  
  • SAP Logon Pad Options-1
  • SAP Logon Pad Visualization
  •  
  •  
  •  
  • SAP Connection Name (Logon Pad)
  •  
  • In a practical scenario, you may have access to multiple SAP environments connected through a single instance of SAP Logon Pad. For that situation, it is important to have a consistent name for SAP Connections (across all users deployed with attended or unattended bots) so that an automation finds a particular system to login to. My general preference is to use ERP (for SAP production), EQQ (for SAP-QA), EDD (for SAP Development) and EXX (for SAP Sandbox) or something similar. We will talk about using these names to login to SAP in Section 4.   
  •   
  • SAP Login (SSO and without SSO)
  •  
  • Logging into SAP with credentials has 2 options and it depends on how SAP landscape/servers are configured. First, the old school way of entering a username and password for authentication and logging in to your account. The second is single sign on (SSO) enabled login (using AD credentials) requiring no further requirement to enter username and password. Please contact your SAP Basis administrator for getting guidance for login profile to use before setting up UiPath activity. The good news is, UiPath has standard activities to support both of the options. We will cover it in detail in Section 4. 
  •  
  • Section 2 SAP Hotkeys
  •  
  • SAP support function keys which are quite handy to execute a particular task or transaction, as compared to clicking a specific icon to initiate the same task. These function keys are fully supported by UiPath Studio using activity "Send hotkey". Some of the most common function keys are as follows:  

F3 – Back (to go back to previous screen) This is useful when you automate a transaction with multiple screens and need to step back and forth within an automation task in SAP)  

F4 – To get list of picklist values for a field (for example: list of company codes). We may not be using it directly in automation but quite handy in day-to-day navigation  

F8 – Execute a program or job. Quite useful in automation to execute a program or a query 

Ctrl + S – Save; If your automation is posting a transaction in SAP like create sales order, you will need to save it to generate record  

Shift + F5 – Get Variant; If you are working on an automation to execute a program (or query) with a preexisting variant, you can use Shift+F5 to get a variant pop-up and enter the variant name to use for the execution   

Ctrl + N – Create a new session. Some automations may require executing multiple transaction codes in parallel, which would require the initiation of parallel SAP sessions. Use Ctrl + N to create new session and then initiate calling transaction (or execute program name) in the new session. Here is a tip, as a default setting, SAP allows a maximum of 6 parallel sessions under the same login. 

Alternatively, I highly suggest using UiPath standard activity "Select Menu Item" to capture SAP menu bar tasks and pick the right one from the drop-down list (for example, refer to this screen print for standard toolbar on SAP homepage captured using Select Menu Item activity). 

 

Activity Click Toolbar button

 

Tips On When To Use Activity "Click Toolbar Button" Versus "Select Menu Item"

 

Every SAP screen provides two types of menu/submenu options.

 

1. General menu tasks that are common and apply to every transaction. We use Select Menu Item highlighting the entire screen that will provide all menu/submenu options in the drop down to select as action.

 

2. We have menu/sub menu tasks specific to a transaction for which we use Click Toolbar Button to get actions relevant to that transaction.   

 

 

Section 3 Execute SAP Transactions and Programs

 

Now that we have understood SAP setup and prerequisites, let's talk about calling SAP Transaction codes and how to look up program names behind these transactions. Pro-Tip - I highly recommend using programs directly wherever feasible with pre-defined variants for better performance and to avoid dependency on local GUI settings.   

  • Transaction Codes
  •  
  • It is a 4-digit shortcut key to access the requested transaction. Transaction codes provide direct access to the desired transaction from anywhere within the SAP system (for example, transaction code VA01, to create a new sales order). As part of requirements gathering, we ask the user to walk us through the SAP process and transaction codes they execute for end-to-end process.   
  •   
  • I am a big fan of documenting as-is process flows, and that's where UiPath Task Capture tool is useful in capturing the steps and helping identify the future state workflow. In SAP, transaction codes are saved in table TSTC. Happy searching!!  

  

The majority of SAP automations would include calling transaction codes, which could be a direct user screen or executing a program or data extract. Stay tuned for future blogs on the UiPath community blog on how to automate table extracts and direct function calls from SAP.   

  

UiPath provides standard activity "Call Transaction" to directly call SAP Transaction code. Please refer to Section 4 for more details.   

  

  • Executing SAP Program (and how to look up)
  •  
  • I know it sounds a bit techie, but it's a very powerful way to take your automation to the next level. It can be a standard SAP program (for example, Customer line items report, Tcode FBL5N and program name RFITEMAR) or a custom report/program created for a specific business need. Now, the question is, how to find a program name? It is very simple to navigate from transaction screen to a program name. Go to transaction code (for example, FBL5N, Customer Line Items Report), from the screen navigate to System, Status, on the System:
  •  
  • SAP Tcode System Status1

 

SAP Tcode System Status-1

  •  
  • Status popup, program name is under SAP Data as Program. You can copy the program name and execute it directly using transaction SA38.
  •  
  • Section 4 Installing SAP package to Studio
  •  
  • UiPath provides standard package UiPath.UIAutomation. Activities with activities to help automate SAP processes. I highly recommend installing the latest version of this package in Studio and exploring the available SAP activities. In order to install a package, click on Manage Packages, All Packages and type this package name in the search field. Select the package and click Install from the side panel.    

If you search "SAP" in the Search Activities, it will show all the available activities relevant to SAP automation. The activities are grouped as App Integration and UI Automation. We will cover App Integration in future blog related to SAP Automation using BAPIs and Remote Function Calls.

 

Studio SAP Activities

 

 

Some of the key activities are: 

  • Call Transaction
  •  
  • As the name indicates, it triggers SAP transaction directly in the current SAP GUI window. If you need to execute multiple transactions in parallel, remember to use the function key Ctrl + N to create a new GUI window session and then initiate a call transaction for that session. I highly recommend using this activity instead of "Type Into" activity.   
  •   
  • Click Toolbar Button
  •  
  • Another very useful activity to minimize the number of clicks to navigate a particular action task on a screen. Use this activity to capture available toolbar menus for a particular transaction and automate using the drop-down list displayed in this activity when you highlight the screen. (for example: save a transaction or download a report to Excel). 
  •   
  • Select Menu Item
  •  
  • Like "Click Toolbar Button", this activity is handy to capture general screen menu options which stays common for every transaction. (For example, System, Status, we talked about above to find out program name for a transaction) or other menu options at the main GUI level.    
  •   
  • Read Status Bar
  •  
  • Reads the message displayed in the status bar at the bottom of the GUI window. When you execute a transaction in SAP (for example: Customer line-item report), it shows a message at the bottom of the screen (like these many records generated or output successful) which is quite useful information to decide the next course of action in the workflow. Keep in mind that you may want to consider Try/Catch to read it as an exception if a failed message is displayed and accordingly decide final state.   
  •   
  • SAP Login
  •  
  • Use this activity for SAP login with username and password. This activity also supports multiple logon options, which is very useful when we automate an end use scenario when a boy needs to login to SAP as a first step. In that situation, if a user is already logged into SAP, you can select an option from the multiple logon choice to either terminate the already logged in session and login again or continue with another login without interrupting user activities. Note: This activity is also useful when you set up unattended bots on virtual machines and login to SAP using system accounts. 
  •  

Multiple logon options

  •  
  • UiPath Multiple Logon Option
  •  
  •  

  • SAP Logon
  •  
  • This is another option to login to SAP when your landscape supports single sign on (SSO) without entering username and password for SAP login. Very useful activity! For this activity, you need to know the connection name from the SAP logon pad and that's why it is important to have a standard naming convention across all users in the organization.    
  •   
  • Select Dates in Calendar
  •  
  • You will use this activity quite often whenever you need to select a date (or range of dates) to enter on a screen. It is quite useful to pick a date from the calendar and not mess up with the expected date format if you enter it manually.   
  •   
  • Expand Tree
  •  
  • As the name suggests, this is a useful activity to expand the GUI menu tree from the parent node to the current node or transaction. It will add the available transactions in that section as a drop-down list in the activity for you to further use in the automation (for example, double click to execute a transaction). I use it quite often when my automation is based on a deep-nested node or transaction and may not be a direct call.   
  •   
  • Table Cell Scope
  •  
  • Use this activity when iterating table records inside a loop with row/column combination. We will talk more about this activity and how to extract SAP tables for business reconciliation in future blogs. Stay tuned for updates on the UiPath community blog
  •   

Conclusion

 

If you want to learn more about SAP automation with UiPath dive into this video and the UiPath Documentation Portal

 

 

Rahul Goyal is a Senior Director of ERP Systems at Ellucian

 

Review UiPath and earn gift cards. Join us and help other professionals learn from your experience with UiPath. Your review can be anonymous.


by Rahul Goyal

TOPICS: SAP Automation, UiPath Studio, UiPath Task Capture

Show sidebar