Skip to Content
Technical Articles

SAP Intelligent RPA – How to Capture SAP Logon and SAP GUI

For general information regarding SAP Intelligent RPA please read the blog “SAP Intelligent RPA – enablement and getting started” by Lena Grothaus.One of the first steps in SAP software automation is the logon to a SAP system. In this blog post I describe how to build a logon scenario using SAP GUI in SAP Intelligent RPA.

Step-by step instruction:

Create a new project in Desktop Studio

To create a new project goto File -> New Project or use Ctrl+N. A pop-up appears where you can maintain the new project. Fill the fields Project Name, Title and Client Name and klick on “Save” to save the project:

Activate SAP GUI connector

After the project is save goto File -> Edit Project. Klick in the pop-up on the index tab “Libraries” and scroll down. Enable SAP GUI Scripting and save the project.

Please check also if SAP GUI scripting is activated on client and server side. For the activation of SAP GUI Scripting please check out this Link.

Screen Capture

Now you can start with the capturing of the screens. Therefor you open the SAP Logon application and launch the system where you want to login. The assumption is, that you have to use user and password to access the system.

 

Capturing and Declaration of the SAP Logon

To capture the “SAP Logon” you have to add an application. Therefor click on “+ Add Application”, select UIAutomation as technology, click on “SAP Logon 7xx” and “Save And Capture Page”. If no pages are visible please click on the refresh icon right to Applications.

On the next pop-up you can now capture the screen of the SAP Logon application.

The technology should be UIAutomation again. If no pages are visible please click on the refresh icon and choose “Window – SAP Logon” and klick “Save and Capture”.

After capturing an application, you need to set the criteria required for the software to recognise it.

The “Captured Data” tool window of the Explorer perspective panel shows the properties of the application that can be used as criteria.

These properties are collected when the application is first captured. What properties are captured depends on the application technology and corresponding connector: only properties used by the connector are captured correctly.

The Criteria tool window lets you edit the criteria of the application that will be used by the connector to recognise an application at runtime

In the next step you declare the SAP Logon page. As you can see in the upper left corner “pWindowsSAPLogon76” is marked in red. This shows that you have not assigned criteria which can used by the bot to recognise the page.

To declare the page you can us the captured data. In this case you make a double-klick on “Value = SAP Logon 760” and you can see the value in the criteria area. The status of the page changes to green.

Now you have to declare which system you want to use. To do this you have to click on the system name and a frame appears around the field with the system name. Again you have to select the recognition criteria in this case for the field. Please use “ControlType = Text” and “Value = SID”. with this criteria the bot can recognise the correct system even if more systems will added to the Logon Pad.

With this step you have finished the capturing and the declaration of the SAP Logon.

Capturing and Declaration of the SAP GUI

Now we you repeat the capturing and and declaration procedure for the SAP GUI page where you can enter user and password. The major change here is that you have to select “SAPGUI” in the Technology drop down list.

Click on “Save and Capture” and you can start with the declaration of the fields. In this example you will declare Client, User and Password.

First you have to declare the page “pSAP” as shown in the picture below.

Second you declare the fields on the page. Please use the criteria as as shown in the following pictures.

Client:

User:

 

Password:

Now you have finished capturing and declaration.

Building the Workflow

A workflow refers to an automation sequence. It can describe the control of a single application or the coordination of several apps.

When you design a workflow, you describe the implementation of the automation sequence in functional terms:

  • The sequence of the screens and the actions to perform on each screen

  • The data to collect and return

  • The other actions to implement (manage files, data…)

For this purpose, the Desktop Workflow Designer provides:

  • The applications, pages and items declared in the Explorer perspective

  • A context structure for storing data

  • A set of functional activities (Get, Set, Click, and so on)

  • A generic comment activity for describing functional requirements

Now you can start to build the workflow. To do this click on the workflow icon to switch to the Desktop Workflow Designer and right mouse click on GLOBAL to create a new workflow.

The workflow you created is empty except the Start activity which is mandatory for all workflows. On the right side you see two important areas of the workflow perspective, the Properties and the Activities. To launch the SAP Logon application you search in the activities list for the application start activity.

You can use drag and drop to move the activity into the workflow. Then you draw a connection from the “Start” icon to the application “Start”. In the Properties” area you can choose the application and you can edit the display name and the description.

Next step in the workflow is to use the captured pages. Therefor you click in the “Activities” area on the right side on “Pages”. You can see now the two pages you have captured at the beginning. You can move the pages to the workflow with drag and drop and connect the pages as described above.

Now you have to define what you want to do on the different pages. Therefor double click on the SAP Logon page. On this page you want to mark the system in a first step and in a second step you have to click on the “Log on” button. With a right mouse click on the system you will open a context menu, please select “Click on the item” and select the right item in Properties area under Activity. Do it again with the “Log on” button.

Now the bot is enabled to open the Log in page of the system SX3.

To finalise the workflow double click on the Login page and maintain the sequences of the necessary steps which the bot should execute. You need five activities on this page:

  1. Wait until…
  2. Set value in the Client field
  3. Set value in the User filed
  4. Set value in the Password field
  5. Keystroke to execute “Enter”

For the first four steps you can click on the related field and use the context menu. In the Properties area maintain “Item” and “Source Data” with the values for the fields. The picture below shows the “Client” field as an example. With the first step “Wait until…” you ensure that the field is available when the bot starts to set the value to the fields on the page.

For the last step search in the activities for “Keystroke” and use the activity under “Page”. You can drag and drop the activity to the steps in the Activities pane left to the captured page.

Last step here is to maintain the properties. For the Keystroke you have to select the page and enter a Key Sequence “e.SAPScripting.key._Enter_”.

The bot is now ready to test.

Test the Scenario

After saving your project click on the “Build” icon to finally generate the code and build the executable scenario. After the build process is finished you can start the Debugger (F5).

The debugger will execute some steps and stops with the last message below. Now you have to use the Desktop Agent to start the scenario.

To open the Desktop Agent click on the Desktop Agent icon in the system tray and select “Test SAP_Logon”. The scenario will be executed and the bot log in to the system.

Conclusion

Now you are able to use SAP Intelligent RPA to start your automation journey. You learned to capture pages with different techniques (UIAutomation and SAPGUI connector), declare fields on the pages, use the Workflow perspective to design the process, use keystrokes, to start the debugger and execute the process with the Desktop Agent.

Blog Post overview

1.

SAP Intelligent RPA – How to Capture SAP Logon and SAP GUI

2.

SAP Intelligent RPA – Advanced Recognition Capability “MustExist Method”

103 Comments
You must be Logged on to comment or reply to a post.
  • Hello Peter, Thanks for the blog.

    I have one doubt for passing data to SAP GUI. I captured the data in context variable and I want to pass it to the multiple selection screen fields under SE16 transaction. Please refer below image.

    I am unable to do it. Error message says- ctx.item.i not valid. Could you help me with this?

     

    Regards,

    Ashish

    /
    • Hi Ashish,

      Try to set Dialog (modal) in your personal setting of SAP system:

      Main menu ->Help->Settings…

      And than, capture again the popup.

       

      I hope it helps you

      Regards

      Federico

      /
    • Hi Ashish,

      here is a screen picture how I realized it to get the data out of a variable:

      This is the generated code:

      // ----------------------------------------------------------------
      //   Step: pMultipleSelectionFo_
      // ----------------------------------------------------------------
      GLOBAL.step({ pMultipleSelectionFo_: function(ev, sc, st) {
      	var rootData = sc.data;
      	ctx.workflow('SAP Logon', '918c07a4-ad1a-4bdb-a277-2b2505898cfb') ;
      	// Wait until the Page loads
      	SAPLogon760.pMultipleSelectionFo.wait(function(ev) {
      		SAPLogon760.pMultipleSelectionFo.edGuiCTextField.set(rootData.trial2);
      		sc.endStep(); // end Scenario
      		return;
      	});
      }});

      I hope this will help.

      Br,

      Peter

      /
  • Thanks for sharing this. I have one issue can you please help me resolve it?

    I’m not able to do Desktop Agent Tenant Registration, basically I’m not getting the URL from the application tile on my account. When I click on ‘Go To Application’ I’m getting error as “Insufficient scope for this resource”.

    Please help me resolve this.

    Thanks in advance.

  • Hi Peter
    we have deployed our package in Cloud Factory. But when opening the agent and when selecting the project, we do not see the actual workflow, we only see Main Menu, Menu 1 and Menu 2. Any idea what we might be missing?

    Kind regards
    Gunnar

    /
    • Hi Gunnar,

      please go in the script editor to sap logon.js as shown in the picture below:

      Comment the  if clause so the code will not executed anymore. Export your package again and deploy it in the factory. It should work now.

       

       

      /
    • Hi Edgar,

      I saw this error when I executing a script in the SAP session and tried to capture a page. Please check if SAP scripting is running during page capturing.

      Br,

      Peter

      • Hi, Peter

        I Have it enabled, in the trx rz11 in SAP and  check o library desktop Studio but equal shows error when execute workflow.

         

        any other help, please?

        • Hi Edgar,

          this is not what I want to say. Please check on the screen if their is a green activation button like in the picture below.

          This was the reason in my case for a similar error message.

          Br,

          Peter

          /
          • /
          • Hi,

            there is small arrow in the below right corner. That’s are the system information. There you should find the button.

            Br,

            Peter

  • /
    • Okay. I assume “Se ejecuta el script” means a script is running. That’s it. The problem is that a script is running and you try to execute the next process during screen capturing. Please log-off from the system, log-in again and check if the status is still the same. If no script is running then try to capture the screen again. If a script is active please asked your system administrator to check why.

      A running script was the reason for an error on my side.

      Br,

      Peter

    • Hi Shrinidhi,

      please share a screenshot from the captured page including the properties and the captured data as well a screenshot where you define the activities on the page.

      Br,

      Peter

  • Hi Peter,

    Thanks for your kind replay i had realized my mistake, i.e i missed ‘_’ in the “e.SAPScripting.key._Enter_”. that’s why it was not logging in.

     

    Thanks & Regards,

    Shrinidhi

  • Hi Peter,

    I am creating a bot for currency exchange page. I need to insert a keystroke. I followed all the steps like, enabling the SAP GUI Scripting, using the activity under “Page” and entering a Key Sequence “e.SAPScripting.key._Enter_”. But still i am facing with an issue. I have attached the screenshots. This is the Currency Exchange website.

    I have attached the screenshot of the code.

    This is the error i get while running the code.

    Please help me with this.

    • Hi Peter,

      This is the output i get. It is properly working until populating the text box with the value i want, but it is not working from the next step (i.e., the keystroke step). Please guide me with this.

      /
          • Hi Harini,

            please provide a screen shot where you have captured the currency converter including the properties. You capture the page with web or UIAutomation.

            Please use:

            ctx.keyStroke(e-key.Enter);

            instead of

            e.SAPScripting.key._Enter_

            Br,

            Peter

          • Hi Peter,

            I have provided a screen shot where i have captured the currency converter including the properties. I captured with web only. And i used

            ctx.keyStroke(e.key.Enter);

            still getting the same error.

          • Hi Peter,

            I used this ctx.keyStroke(e.key.Enter); and i don’t get any error anymore, but still the keystroke doesn’t seem to work.

            This is the expected output

            and this is the output that i get

            the keystrokes are not working

    • Hi Harini,

      I think the error is with the data, since here type error.

      by seeing your code you had given the value as ‘123’, in java script number no need of ‘ ‘, in your case the value is taken as Character

      please try with the value just 123 not ‘123’

       

      Best Regards,

      Shrinidhi

       

  • Hi Peter,

    I have problem when tried debugging does not work and previously shows a popup window.

    its

    Javascript debugger is disabled

     

    Regards

     

    /
  • Hi Peter,

    I have problem when tried recogni page,

    I set criteria on my page and items, when I execute the workflow it falls on the second page for timeout

    the element no recognition

    i saw this video, link

     

    Regards

     

  • Hello Peter,

    thank you four your explanations.

    I saw your step Test the Scenario and Conclusion and i have the same Pictures. So this should be fine.

    But after starting the test at my Desktop Agent i get an error message on the Desktop Debugger. Can you please tell me what is wrong?

    Regards,

    Ralph

    /
  • Hi Peter,   Moumita,

    I’m trying to automate translation.So I far I’m able to reach the initial screen of SE63 and then able to open  the Pop Up screen.But unable to expand the highlighted node.Thus unable to proceed further.Please check and suggest corrective actions.

    Screen shots from Desktop Studio.This Pop Up screens has been captured using SAP GUI Technology.

    Workflow declaration step for this screen.First I tried to set ‘Click’ activity but it did not worked.

    What I’ve understood is,I’m trying to select the B5 node but I’m not able to do so.Please let me know, how to achieve this.

    With best regards,

    Sarbajit

    • Hi Sabarjit,

      try the following: (1) Set focus on the line (2) use click on the buttons at the bottom to navigate (3) create additional screen capture without replacing the page for the following new pages. (4) set focus on the activity you want to execute (5) use the execute button at the bottom.

      Br,

      Peter

  • Hello Peter,

    I have the following problem;

    If I use the SAP Easy Access as SAPGUI technology in the SAP iRPA Desktop Studio environment, I cannot operate the elements on the left. For example, opening up logistics.

    • I activated script support under SAP GUI configuration
    • In the Desktop Studio I selected SAP GUI Scripting and all elements in Edit project
    • I add the application as a SAP GUI technology
    • In sap-easy-access i set under the transaction rz11 the value of true

    The two panels are seen as blocks, although the toolbar buttons and other elements are individually identified.

     

    I hope you can help me.

    With best regards,

    Erhan

    • Hi Erhan,

      you do not need to capture the tree. If you capture the table tree control you should use two activities: “Get Node Item by Text” and “DoubleClick node”. You have to use the ID from the first acitivity in the second one,

      Br,

      Peter

      /
      • Hi Peter,

        Could you help me with the use of the activity “Get Node Key By Path” as I do not have the nodekey of the parent elements and I have to access an element in the subtree.

        Regards,

        Vedansh

  • Hello  Peter  ,

    Our organization uses Citrix Env for SAP Access and I am trying to create a logon application for citrix in desktop. As first step is involves opening login page in a browser.I was able to start the login process.

    Click event on the icon opens the login screen of the system.I have captured the login page of system too but I do not see any structure or elements on login page which can be used to create items as login page opens in a citrix client app.

     

    I even tried to capture it as image but it also does not work. I need to find a way through this citrix client as further steps will also be performed in same client app e.g running a transaction in SAP system.

    Kindly guide.

     

    Regards,

    Hitesh

     

     

     

      • Thanks Peter for the hint, I tried OCR connector  but it is not working,the documentation is little confusing as I do not have tab structure. My goal is to run a transaction in a  session logged in citrix env.

        1.My page is not getting recognized while execution.

        2.In workflow we start with main page or subpage?

        Regards,

        Hitesh

  • Hi Peter,

    Thank you for the article on SAP GUI RPA. I am following your steps and completed with capturing SAP LOGON. But when I tried to ‘Capturing and Declaration of the SAP GUI’, you said we need to select SAP GUI as technology but I don’t see this in my drop down list. I have activated SAP GUI Scripting on client and server side but still not sure why I am missing this option and not able proceed.

    Hope you can help me here.

    Thanks,

    Ramesh

  • /
    • Hi Venkat,

      I don’t get your problem. Select Text and Type in the captured data area. If it is not working please explain a little  bit more what happened.

      Br,

      Peter

  • Hello Peter,

    I want my bot to pickup an item from SAP Easy Access – Menu but I am unable to identify the correct method to read/select item from SAP Menu. Could you please help me to identify correct method for this?

    Regards,

    Ajit J.

     

     

     

    /
  • Hi Peter,

     

    We have applications which were developed on Fiori and the same when I try to build in using IRPA, getting “Java is not available, neither the bundled nor a global one.”

     

    Can you please help me out of this issue.

     

    Thanks,

    Venkat

    /
  • /
  • Hi Peter,

    Thanks for the sharing.

    I’m stuck with captured data, i can not add any item to criteria (there is no option for that – dblclck does not work either), any idea?

     

    Thanks,

    Akin

    /
  • Hi Peter,

    Thanks for sharing, it was working successfully for me.

    I have one question regarding my process integrated with external API: After i import the project to cloud platform and deploy it, I would like to add the API trigger to receive input data.

    According to the Help Portal ‘Select the scenario or the process to execute and that will create a job entry. Depending on the scenario or process definition a payload template is automatically generated’.

    However, in my trigger API window, the example and input schema are empty, so there is no payload template.  Why is this happened? do I have to define specific activity type in my RPA workflow in the Studio?  thanks for your help!

     

  • Hi Peters,

    i facing problem with pop-Up in ERP when i tried click, it don’t respond.

    i tried insert keyStore, wait until, pPage.exist()…, but not work .

    I’m reviewing the SAP documentation, but this  setBusyWaitTime method is missing, is it another version or is it deprecated?

     

     

     

    any other Suggest

     

    Regards,

  • Hello Peter,

    now i have another problem. I have automated the creation of a purchase requisition in the system, in transaction ME51N. In the case of automatic execution, the bot reads from an Excel file. Until then, everything works as defined in the workflow. Now the bot opens SAP Logon 750 and selects the connection. Now he would have to log in to the window, but then I get the following error message:

    Here is my Workflow-Window:

     

    Script-Window:

     

    I hope you can help me.

     

    Br.

    Erhan

  • Hi  Peter ,

    I am trying to automate one Std SAP Transaction. While doing i got stuck at Menu bar as shown below. Would you pls take a look at this & help me?

    I have to basically click Goto->Partner at Menu bar.

    Pls look at screen shot below from Desktop studio.

    My script is running until before this step. Post that system is unable to find menu function.Can you help?

    Thanks

    Chandru.R

    • Hi,

      the screen shot shows that you have not declared the page and the items properly. Please provide screenshots of all pages and their selected criteria. Please also move this threat to the Q&A area here 

      So more community members could answer and also learn from the threat.

      Br,

      Peter

  • Hi  Peter ,

    Issue i had on 21 April 2020 is now resolved.

    But i have oberved one basic issue . RAP Bot is recognizing SAP Logon Connection or system only when it is highlighted during run as shown pic. Incase  if i work on other system  & come back tried to execute the project Bot is not running as expected.

    Please look at all my attachments. Is my understanding different?

     

     

     

    Thanks

    • Hi,

      it looks that all your settings are correct. Please make sure that after the bot is started you do not use the mouse and there is no overlap between the LogOn pad and any other application, so that your application is in front of all applications.

      Br,

      Peter

  • Hi Peter

    Thank you for the wonderful tutorial. I am trying to automate an SAP table tree control. I followed the steps you have mentioned in few comments. I passed the node id to the function clickDoubleNode. The node on which I want the double click to happen is getting selected, but the double click event is not working. Am i missing something here? Would really appreciate your help.

    Thanks and regards

    Swati

     

    • Hi,

      please try it out in the tester section of the debugger. If it is not working open a questions in our Q&A section and provide screenshots.

      Br,

      Peter

  • Hi Peter,

    Thank you for your informative tutorial. i could able to replicate the same and successful. however, i have once scenario where if there is already a user logged on then a pop up comes, where we need to select either of 3 radio buttons viz. close the current session, logon with closing other session, and logon without closing other session.

    My scenario is to by pass the popup page recording from the Workflow if multiple users are not logged at a particular time Else i need to take the popup screen in order to logon into the SAP system.

    Would really appreciate your help.

    BR

    Srini

  • Hi Peter , Could you please let me know how can I handle Multiple logon in IRPA.

    When there is already a session is running then a licence screen poped out. How to handle that.

     

    Thanks

    /
    • Hi,

      there is an activity in the Flow area called “Switches output”. With this activity you can react on different screens. the activity has to be implemented after the log-in screen. Default exit is no multiple log-in screen and an alternative exit is the additional screen.

      You will find more details also in our openSAP course and in the documentation.

      Br,

      Peter

  • Hi everyone,

    I need to set some value to cell for example H column in the table. But i can’t reach the cell and got exception. Scripting is enabled. How can I solve this problem?

     

    Thank you in advance.

     

    Regards,

    Bengu

     

     

    /
    • Hello Bengu Alan,

      Sorry, I got it wrong. This is SAPGUI screen. It look like excel so i thought it was excel. One thing i want to say that if you are posting any query with screenshot then please mention some detail about it . Like for this screenshot, you should also mention about the screen that you have captured.

       

      Thanks

      • Hello,

         

        You’re right but this post was about SAPGUI that’s way I didn’t add any other details. But thank you again, you always help people on your blog 🙂

         

  • /
    Error
  • /