on 10-31-2014 9:55 AM
Hi,
I usually login to SAP from my .net application by creating an instance of SAP Logon control and passing the credentials(dialogue user credentials).
tObjType = Type.GetTypeFromProgID("SAP.LogonControl.1");
oLoginCtrl = Activator.CreateInstance(tObjType);
But now I have a scenario like the customer wants my application to use RFC user credentials which will not work if I use SAP Logon control.
Is there any other way to login to SAP using RFC credentials?
Thanks in advance
language: C#
framework:4.0
VS: 2010
OS:Windows 7
Regards,
Manosh Jacob
Hi Manosh,
I have on hand just the VB code below. For C#, however, the idea shall be obvious... Instead of "SAP.Functions.Unicode" you may use also "SAP.Functions" if you do not expect issues with code pages.
Set r3 = CreateObject("SAP.Functions.Unicode")
r3.Connection.ApplicationServer = "server.ip"
r3.Connection.SystemNumber = "00" ' Put your system number
r3.Connection.User = "Username"
r3.Connection.Password = "Password"
r3.Connection.Client = "010" ' Put your client number
r3.Connection.Language = "EN"
Dim silent As Boolean
silent = True
' Put silent = False if you want a password pop up for debugging
If r3.Connection.Logon(0, silent) Then
Set func = r3.Add("BAPI_FUNCTION")
func.Call
End If
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Btw. for new application I recommend to switch over to .NET Connector. In the end it's much simpler to use and you can get much more out of it. And it's managed code.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thank you very much Hynek Petrak. It worked for me. I am pasting my code here.
tObjType = Type.GetTypeFromProgID("SAP.Functions");
oLoginCtrl = Activator.CreateInstance(tObjType);
_oSAPCon = oLoginCtrl.GetType().InvokeMember("Connection", BindingFlags.InvokeMethod, null, oLoginCtrl, null);
I have been trying .NET Connector for a while. I will move to the same soon.
Sorry I took a little time to get back.
Regards,
Manosh Jacob
Hello Manosh,
no, it means to switch over what is described in the blog located here:
http://scn.sap.com/people/thomas.weiss/blog/2011/01/14/a-spotlight-on-the-new-net-connector-30
Best regards,
Markus
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.