I'm trying to log in to SAP with SNC connection and with username and password (not automatically) using SAP GUI Scripting. On my connections list there is my destination server with auto logon set to true. I know that it is possible to add the same server again and set auto logon to false and choose it, but client doesn't want to add another position to list. Normally (without SNC) I just use
CSapROTWrapper sapROTWrapper = new CSapROTWrapper();
var SapGuilRot = sapROTWrapper.GetROTEntry("SAPGUI");
var engine = SapGuilRot.GetType().InvokeMember("GetScriptingEngine", System.Reflection.BindingFlags.InvokeMethod, null, SapGuilRot, null);
var GuiApp = (GuiApplication)engine;
var connection = GuiApp.OpenConnection("My server name", true, true);
and then I can put username and password. With SNC and autologon however I am already logged in using credentials put in SNC (and I want to use different credentials without doing anything with SNC). I tried using
var connection = GuiApp.OpenConnectionByConnectionString("my.server.address", true, true);
but it fails as it doesn't connect using SNC (which is required). I tried to build connection string in java client way, which I found somewhere on the Internet:
/H/ip.add.res.s/S/3200&sncon=true&sncname=properName&sncqop=4
but each time connection is not established with information:
The 'Sapgui Component' could not be instantiated
I went through multiple SAP documents but found no information about passing SNC parameters.
The final question is: Is there a way to connect to SAP GUI using code with SNC but without autologon?