I need to autometed some tests in the SAP environment, so I need to connect the Robot with the SAP GUI, I know that there is library for that, my I don’t know how to use it. I tried the steps below, but dind’t work and I don’t know what to do.
*** Settings ***
Library SapGuiLibrary
Library Process
Variables …/Data/SAP.py
*** Test Cases ***
Connect with SAPGUI
Start Process {Winium}
Run Process {saplogon}
Connect To Session
I’m on a RB basic level, so any help will be great.
in the SapGuiLibrary documentation there is quite an important not about having logon pad open before calling Connect To Session
So I’ll assume that the line Start Process {Winium} Run Process {saplogon} is doing that and that logon pad is open.
I haven’t used this library myself so everything here is a guess based on the doco and my limited use of SAPGUI with loadrunner.
1st thing I would try is
${conn}= Connect To Session
Log ${conn}
and see what happens
next I would try
Connect To Session
Open Connection <connection_name>
where <connection_name> is an entry in you login pad, watch the desktop of the machine you are running the robot file on and see if that connection opens
Also this should be obvious but, only 1 SAPGUI at a time, before you run your robot make sure all existing SAPGUI windows (including logon pad) are closed.
Thanks for the help, but my problem was that the script was not configured to run on the server side, right after being configured by the administrator the connection via Robot worked.
Usually when you have multiple SAP environments the SAP GUI uses the login pad window to display the list of environments you can login to, if you are not seeing the login pad window when you start the SAP GUI you might need to discuss with your SAP administrator.
I’m no expert in SAP GUI as I have only automated it a few times.
Hi Dave
First of all thanks for your reply… I am blocked on this issue as im from java selenium background and im new to RPA and python… Coming to scripting i have enabled it in client and server… As fast as my progress we are able to launch the sap exe fine but not able to connect to an connection due to some issue with connection name.This is the name of the connection i want to connect to but its throwing an error
“ValueError: Cannot open connection ‘40 R40 S/4 AS2B Recette’, please check connection name.”. Sap logon pad is opening fine but not able to connect to a session
This is my code in short
Variable
${sap_connection}= 40 R40 S/4 AS2B Recette
Test case
SapGuiLibrary.Connect To Session
SapGuiLibrary.Open Connection ${sap_connection}
From that screen shot I would say “spaces spaces spaces”
I would say that name is not actually
40 R40 S/4 AS2B Recette
but
40 R40 S/4 AS2B Recette
and the line below is
98 PAS SSO 40 R40 S/4 AS2B Recette
But as you may know multiple spaces has a special meaning in Robot Framework
I would suggest you use the SAP Scripting Tracker to check what the name is exactly (including all the spaces) and then construct your variable as below (including @joseilton’s feedback)
Hi Dave, thanks for you help, really appreciate it.
After correcting the space and trying with this version of variable
“40${SPACE}${SPACE}${SPACE}${SPACE}${SPACE}R40${SPACE}S/4${SPACE}AS2B${SPACE}Recette” it is working.
Again Thanks a lot.
Yes, you are mistaken
The escape character is \ (in almost every system, language, except DOS/Windows ).
But in Python (and because of that in RobotFramework), it must be escaped itself, so: \\.
*** Test Cases ***
Connexion to GUI
Open SAP ${SAPLOGON EXE}
Connect to SAP Server ${SAP server}
Fill Text Field Client ${SAP client}
Fill Text Field User ${SAP user}
Send SAP Keys Enter
connect to session
…
Hi @orenault thanks but i still have de issue because when i star de SAP GUI i dont need a user and pasword because a have a SSO but i cant connect with de enviroment of sap, i try your code but not working for me