Knowledge Base

How to Automate SAP Applications -without GUI Scripting

SAP (Systems, Applications and Products in Data Processing) is a well known enterprise software company that makes applications that manage business operations and customer relations.

How does UiPath work with SAP?

There are elements on the SAP GUI, just like Citrix, that are detected by the recorder as a single block, so it's impossible to use a simple recording or automation tool with them. UiPath is well adapted and very capable of creating an automation, even with these types of interfaces. UiPath has a powerful screen scraping engine that helps you in extracting data from the GUI in less than a second! This method is 100% accurate.

Most elements of the SAP GUI can be detected by the Macro Recorder individually, like the Standard Buttons, Menus and Submenus.

The Basic Workflow

Let's say you want to add sales or member data into the application database. Manually, you have to pull up the right form and then start inserting data manually.

In order to achieve this in UiPath, 2 GUI automation techniques will be used:

  • automation through keyboard entries like tab, arrow keys and the return key
  • automation by scraping text on the screen and clicking a text event

1. Automation through Keyboard entries makes it easier and faster to move between different text fields

2. Scraping the text allows us you to build Activities from individual elements in a block element.

The Process

Let's assume that the UiPath is installed on the same machine as the SAP application.

1. With the SAP Business One already pulled up, start building the Workflow by pulling up the Macro recorder. Select Desktop.

2. Select the Automatic Recorder from the Wizard.

3. To pull-up the data form, we can simply use a left mouse click, using the Recorder.

4. Now the form is ready. The individual elements in this form cannot be identified by the Recorder. You will use a different method to fill in the data. Press Escape. The previous activities are temporarily saved in the queue.

5. The next step is to start filling in the data. The cursor is now positioned in the place where you can start putting in the information ("Code").

Click on Element->Keyboard->Type.

6. Just click anywhere in the form and it will initiate the input dialog box in the field where the cursor is in.

7. You can start by typing in initial data. Remember that you can use variables later to manipulate the data, so you can insert your own data sources. 

The text dialog box also allows you to add keyboard commands such as Return and Tab. Let's add a Tab after the "Code" section. This will take you to the next field, which is a dropdown. 

8. You can notice that it creates a code right next to the text you entered. It's the same thing you can apply when adding more keyboard commands. This is how you can manipulate the movement of the cursor: 

Arrow Down: [k(down)]
Enter: [k(enter)]
Tab: [k(tab)]

You can follow the same steps from step 5 to fill in any other input fields.

Automating SAP via Click on Text and Screen Scraping

The keyboard commands are very helpful when moving to and manipulating input fields. If you want to jump to a different field from within the form it could be hard to do so using keyboard activities. That's where the UiPath built-in screen scraping comes in.

You have to run an OCR which reads the text in the form and captures the targeted text. 

1. Click on Text->Mouse->Click.

2. This will pull up the Screen Scraping wizard. The target field is next to "Tel 1". The cursor position should be set next to it. 

Copy "Tel 1" and put copy it in the Text to be found field. 

3. Click on Set mouse position. "Tel1" will be detected. Click on the indicate link, then click on the input field next to it. 

4. Click on the Continue button . This will position the cursor next to "Tel1". You can use the same technique from step 5 (presented in the previous section) to continue filling out other data.

Radio Buttons

For the radio buttons, the same screen scraping technique can be used.

1. Click on Text->Mouse->Click and then copy paste "Inactive" into the Text to be found field. There is no need to set the mouse position for this one. The mouse will click in the middle of the element.

2. Use the same technique to click other GUI elements such as buttons 

You are now ready to build your SAP automation out of these techniques.