Skip to Content
Technical Articles
Author's profile photo Werner Jacobs

SAP Intelligent RPA 2.0 – Insert SAP GUI Screenshots in Word

Hello Everyone

I am a SAP Solution Manager consultant who has been reading, testing and learning about SAP Intelligent RPA 2.0 since November 2020. As you can see I am still new to the product and RPA in general. I have followed the SAP Intelligent RPA 2.0 blog posts in the community and tried to copy the examples shared by other bloggers. This has been probably the most important step in learning about SAP Intelligent RPA 2.0.

The idea behind my blog post is to share some of my knowledge gained. I will present a bot created in SAP Intelligent RPA 2.0 that can take screenshots of SAP GUI transaction screens and insert these screenshots into a Word document. I must be honest, as a beginner it took me some serious hours to get this working and required testing the bot over and over.

As I have seen in the the different community blog posts and through my experience so far with SAP Intelligent RPA 2.0 there are multiple ways of getting to the same result. For this one there is definitely room for improvement, but more importantly, as it is now, it is a working bot. As long as the bot is producing the required result, improvements and enhancements can follow there after.

 


 

The screenshots are all my own. I am using a SAP Cloud trial account with a SAP Intelligent RPA 2.0 trial subscription. The testing of the bot was done on a SAP Solution Manager 7.2 SPS10 system. Unfortunately my trial account job quota has been depleted so I got this working just in time.

I created 2 Applications(SAP GUI and Word) and 1 Automation.

Part 1: SAP GUI

Declare your application and the required screens:

I only added 3 transactions, SM51, SM50 and ST22.

 

Create your automation:

1.1 Login to SAP GUI

For help with the SAP GUI Logon check out the below blog post by Peter Engel. Link to blog post

SAP%20GUI%20Login

For my password I created an Input Parameter type Password.

When testing the automation it will ask for the password to be entered.

NB: Even though you cannot see the password when entering it, it is possible to see it in the Tester Data. If I understand it correctly passwords should be saved as Environment Variables in the Cloud Factory. This is my understanding and you are welcome to correct me.

Input%20Parameter

Enter%20Password

1.2 This part of the automation will enter the transaction code and take a screenshot of each screen.

Transaction%20codes%20and%20Screenshots

 

I used the Screenshot activity and set the screen as the Target.

Enter the path and name for the screenshot to be saved.

Screenshot%20Activity

Saved%20Screenshots

Saved Screenshots

 

Part 2: MS Word

Declare your application and the required screens:

For Word I added a screen for the Home Tab, Insert Tab and the Popup window.

NB. Even though the screen changes when you click in the different tabs in Word the automation still see it as 1 screen that is why I used Multiple Captures, this was the only way that I could get the automation to recognize the different screen captures and buttons. No advanced recognition capability like Must Exist is required.

 

 

Create your automation:

2.1 Open a New Word Document

Open%20New%20Word%20Document

 

2.2 Insert Screenshots in Word using the For each Control

 

Added the path of where the screenshots are saved in the Get File Collection activity.

Get%20File%20Collection

 

The Output Parameter “coll” is then used in the For each control as the Looping list.

 

The currentMember Loop Parameter is then used in the Insert Text Filename step.

 

Here I use the  Set Element activity to enter the path and filename of the screenshots that must be added to the Word document.

 

2.3 The next few screenshots are for the results of the steps that the For Each control must complete

  • Insert Text Filename – Insert the filename in the Word document

 

  • Click Insert – Click the Insert Tab

 

  • Wait Pictures – Wait for the Pictures Button
  • Click Pictures – Click the Pictures Button

 

  • Wait Cancel – Wait for Cancel Button in the Insert Picture popup
  • Add Path and Filename – Adds the path and filename in the edit field in the popup
  • Keystroke Screen Enter – Press Enter, I did not use the Click activity on the Insert button.

 

  • Keystroke Screen PageDown – Press PageDown in the Word document
  • Keystroke Screen Enter – 2 – Press Enter in the Word document

The above 2 Keystrokes are used to move to the next line, otherwise you end up with only the last screenshot in your Word document.

 

2.4 Close Word and Save Document

After all the screenshots are added Word will close, but because it is not saved yet you will be prompted for the save details.

Close%20and%20Save

Close and Save

That is the End…

 


 

How can the bot be improved or enhanced?

  • Saving the Word document could be done automatically with the Save As activity.
  • Instead of creating a new document open a previously created template with a nice cover page using the Open Document activity.
  • Send the Word document to someone via email with the Send Email activity in the irpa_outlook SDK package
  • Add the transaction codes to an Excel file and read from the file with the Excel Cloud Link activity.

Maybe with some fine tuning you can automate system checks for your Basis team. They can run the bot and scan through the Word document. They will only login to the system if they see something that requires attention – System checks, that is a whole different discussion.

I hope the explanations and screenshots are clear enough and you can find some use out of the blog post or at least learned something related to the SAP Intelligent RPA 2.0 capabilities.

Thanks for reading my blog post and remember any comments are welcome.

 

 

 

 

Assigned tags

      5 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Juan Rodriguez
      Juan Rodriguez

      Hi!

      I wanted to ask you about the pop up images inside word. How have you declared the field where you insert the path? it only lets me declare it as Edit or ComboBox type and does not let me write on it with the Set Element Activity.

      Thanks

      Author's profile photo Werner Jacobs
      Werner Jacobs
      Blog Post Author

      Hi Juan

      It is declared as a Element Class: Edit.

      To fill the field I used the "Set Element" and the path I entered with the Input Parameter(value) of the "Set Element".

      I hope this helps.

      I am trying to upload screenshots for you but it is not allowing it.

       

       

      Author's profile photo Juan Rodriguez
      Juan Rodriguez

      Hi Werner

       

      I did that, but when the bot try to write the path on the field, he can´t and automatically appear a mistake.

      But i have my declarations like you say, Edit class and using the Set Element Activity for write on field

       

      Do you know what can be the mistake?

       

      Regards

      Author's profile photo Werner Jacobs
      Werner Jacobs
      Blog Post Author

      Hi Juan

      This is what my expression looks like. Not sure if this will help.

      Author's profile photo Pratiksha Agarwal
      Pratiksha Agarwal

      Hi, I am trying to take screenshot of a web page which my bot was able to navigate.

      The issue I am facing is that the screenshot is not being saved to the path provided. So I am not sure if I am making a mistake. Please let me know if you would be able to help