admin管理员组

文章数量:1122832

I am using C# code to automate a task in SAP.

The SAP Logon 770 installed provides a list of systems that I can logon to.

When I double click on any system, SAP will detect my login id and try to log me in without a password. If I want to provide a different credentials, I have to right-click the system and choose (SNC Logon Without Single Sign-On Shift-Enter). There I am allowed to type a user id, and password.

The code below almost works except that it defaults to the Single Sign-On option, which does not allow me to provide the password, failing the login process.

using SAPFEWSELib;

GuiApplication app = new GuiApplication();
GuiConnection conn = app.OpenConnection("01. SYSTEM DESC. HERE", true);
GuiSession session = (GuiSession)conn.Sessions.Item(0);

// this works fine
GuiTextField user = (GuiTextField)session
                                .ActiveWindow
                                .FindByName("RSYST-BNAME", "GuiTextField");

// the following line causes an exception, since the password field is not found
// it is only found on the non-single-sign-on screen
GuiTextField passwd = (GuiTextField)session
                               .ActiveWindow
                               .FindByName("RSYST-BCODE", "GuiPasswordField");  

How can I tell SAP Gui Scripting to open a Non-Single-Sign-On logon screen? Or better yet, How can access an already existing session that has been signed on?

I tried the following but none worked for me:

GuiConnection conn = (GuiConnection)app.Connections.Item(0);

本文标签: cHow can I create a nonSingleSignOn SAP GUI sessionStack Overflow