on 08-14-2011 10:50 PM
Using .Net Connector 3.0\Compiled with .NET Framework 2.0 and MS Visual Studio 2008, C#
Hello All,
I created an application where the user can input SAP user name and password in a dialog. Then it connects to SAP and executing some RFC. Working fine.
When the user put in a wrong SAP username or password I get an exception. OK.
But what do I have to do, to let him login again with the correct username and password.
Here is my coding:
IDestinationConfiguration config = new myBackendConfig(); // provides all connection parameters including user/pwd
RfcDestination prd = RfcDestinationManager.GetDestination(config.GetParameters(connId));
RfcRepository repo = prd.Repository;
When I call this second time with correct user/password, then the prd.Repository will run into an exception with message:
"Der Wert darf nicht NULL sein.\nParametername: key" (german)
My translation: "Value must not be NULL.\nParameter name: key".
Any help would be appreciated!
Regards,
Peter
Hello Peter,
I was struggling with the same issue.
NCo provides an delegate for handling change events: RfcDestinationManager.ConfigurationChangeHandler. But I found no documentation about this and could'n get it running.
Here is my workaround:
For destination configuration use the way as described in NCo_30_Overview.pdf (page 7 and 8).
If the compiler warns you, that the event is never used, just add the following line to MyBackendConfig:
private void ConfigurationChangedEventDummyCall() { ConfigurationChanged(null, null); }
Change your coding as follows:
IDestinationConfiguration config = new MyBackendConfig();
RfcDestinationManager.RegisterDestinationConfiguration(config);
RfcDestination prd = RfcDestinationManager.GetDestination("PRD_000");
before you try to get the Repository, execute a Ping and catch the Exception:
try...
prd.Ping();
This prevents you from getting the "Der Wert darf nicht NULL sein" error on the second call.
If Ping fails, unregister the configuration, change username and/or password, create a new config and register again.
catch...
RfcDestinationManager.UnregisterDestinationConfiguration(config);
// change config here... (prompt for username / password)
config = new MyBackendConfig();
RfcDestinationManager.RegisterDestinationConfiguration(config);
RfcDestination prd = RfcDestinationManager.GetDestination("PRD_000");
again
prd.Ping();
If the second ping is working, logon was ok and you can continue and get the Repository without an error.
Regards,
Ingo
Edited by: Ingo Frank on Sep 19, 2011 4:24 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Peter,
In standard it wont lock for the first time.You means is not allowing to login again.
Regards,
Madhu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
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.