Logging to SAP using types available under the SAP Plugin

Download and share automation modules and examples.
Posts: 14
Joined: Fri Jan 22, 2016 11:17 pm

Logging to SAP using types available under the SAP Plugin

Post by nivasd16 » Wed Sep 28, 2016 3:32 am

Hi Team
I tried to used the classes available under the Ranorex.Plugin.SAPtypes for koggin into SAP. I tried to use the OpenConnection:GuiConnection also OpenConnectionByConnectionString:Guiconnection, but the SAP Logon is not launching..

Once the script is reached to the sections Openconnection. Please let me know if any solution for this

Below is the code snippet i tried .
using System;
using System.Collections.Generic;
using System.Collections;
using Ranorex;
using Ranorex.Core;
using Ranorex.Core.Repository;
using Ranorex.Plugin.SapTypes;
using SampleTest.Repository;

namespace SampleTest.Framework
/// <summary>
/// Description of Class1.
/// </summary>
public static class SAPActive

public static GuiApplication SapGuiApp { get; set; }
public static GuiConnection SapConnection { get; set; }
public static GuiSession SapSession { get; set; }
public static void openSap(string env)
//SAPActive.SapGuiApp = new GuiApplication();
string connectString = null;
connectString="ET1 [public]";

SAPActive.SapSession= (GuiSession)SAPActive.SapConnection.Sessions.Item(0);

public static void login_SAP(string myclient,string mylogin, string mypass, string mylang)
GuiTextField client=(GuiTextField)SAPActive.SapSession.ActiveWindow.FindByName("RSYST-MANDT", "GuiTextField");
//GuiTextField Client=(GuiTextField)SapActive.SapSession.ActiveWindow.FindByName("RSYST-MANDT", "GuiTextField");
GuiTextField login = (GuiTextField)SAPActive.SapSession.ActiveWindow.FindByName("RSYST-BNAME", "GuiTextField");
GuiTextField pass = (GuiTextField)SAPActive.SapSession.ActiveWindow.FindByName("RSYST-BCODE", "GuiPasswordField");
GuiTextField language = (GuiTextField)SAPActive.SapSession.ActiveWindow.FindByName("RSYST-LANGU", "GuiTextField");

client.Text = myclient;
login.Text = mylogin;
pass.Text = mypass;
language.Text = mylang;

//Press the green checkmark button which is about the same as the enter key
GuiButton btn = (GuiButton)SapSession.FindById("/app/con[0]/ses[0]/wnd[0]/tbar[0]/btn[0]");


User avatar
Ranorex Guru
Ranorex Guru
Posts: 7469
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Logging to SAP using types available under the SAP Plugin

Post by odklizec » Wed Sep 28, 2016 8:59 am


I'm afraid, I can't help you with your problem. But I would like to ask you not to post the same problem multiple times. It does not help with faster response and makes the forum cluttered with doubled posts. Thanks! ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration