cancel
Showing results for 
Search instead for 
Did you mean: 

What's the behaviour of a Server Stub when the SAP goes down.

Former Member
0 Kudos

Hi,

I've created an application that is a server stub waiting for SAP requests, from what I understood, when I start the server it will register it self in the SAP server using the program ID and some other details to register.

My question is, when SAP server goes down (i.e.: for maintenance or some other issue that requires for the SAP server to be shut downed), must I restart my servers to re-register in the SAP server?

This is kind of urgent, is there any way to recover this programmatically?

Thanks

Message was edited by: Nuno Felino

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Could anyone convert the example above to VB.Net? Could you also explain how the MySAPServerHost will interact with the Proxy Server. Thanks...

public delegate void OnServerException(MySAPServerHost host,System.EventArgs e);

public class MySAPServerHost: SAP.Connector.SAPServerHost

{

public event OnServerException ServerException;

public MySAPServerHost(): base()

{}

public override ActionOnServerException OnServerException(SAPServer server, Exception e)

{

Console.WriteLine("A Server Exception was thrown"+e);

ServerException(this, System.EventArgs.Empty);

return SAP.Connector.ActionOnServerException.AutoReconnect;

}

}

Former Member
0 Kudos

Hi,

You have created RFC Server as a windows service.Would you please tell how to do that.Because bydefault it comes as a consoleapplication.Give the sample if you have

Former Member
0 Kudos

Hi Nuno,

Could you direct me please to some samples/tutorials for accessing a .Net application (which I suppose it has to be a Windows service) from SAP.

So far, I found lots of examples about accessing SAP from .Net but not vice-versa.

Thank you,

Mihai

reiner_hille-doering
Active Contributor
0 Kudos

Have you looked at the CSServerSimple / VBServerSimple example (e.g. C:\Program Files\SAP\SAP .NET Connector 2.0\Samples)? And of cause read the RFC server section in SAP .NET Connector online documentation.

Former Member
0 Kudos

At this time, this is what happened, I've created a server stub that is listenning to SAP requests, I changed it into a Windows service, added logs and several things to monitor it.

I left it on Tuesday running with no problems, today (Monday morning) I try to call it's functions from SAP and nothing worked, I went to transaction sm59 and when I tested the connection I got an error saying that program_id xyx was not registered (or somethig like this). No errors were logged, no dump file was created, from the application point of view no error was found, I'm still trying to know if the server went down during this weekend (Friday night I tried it and it worked fine), but if it went down, does the server stub created automatically reconnects to the SAP server?

After I restarted the application everyhing worked!! Can anyone help?

Former Member
0 Kudos

I had a Problem which was quite the same. But I found a little workaround. Try this:

- Create a Derived Class from the SAP Server Host, which looks like this:

public class ServerHost : SAP.Connector.SAPServerHost

{

public event OnServerException ServerException;

public override SAP.Connector.ActionOnServerException OnServerException(SAP.Connector.SAPServer server, System.Exception e)

{

Console.WriteLine("A Server Exception was thrown"+e);

ServerException(this, System.EventArgs.Empty);

return SAP.Connector.ActionOnServerException.AutoReconnect;

}

}

After that, you have an Event you can deal with. Now I created a method, which is called after the event raises. Within this Method, I start my Server as I did when I started the program. I also implemented a little Wait Routine, which waits a little before I start the server again. But this doesn't have to be implemented.

For my purpose this works. Perhaps this Idea can help you, too.

Regards,

Oliver

Former Member
0 Kudos

Hi Rill,

I had noticed your earlier post, just a final help, is this it? It this the required code?

My code at this moment is:

public delegate void OnServerException(MySAPServerHost host,System.EventArgs e);

public class MySAPServerHost: SAP.Connector.SAPServerHost

{

public event OnServerException ServerException;

public MySAPServerHost(): base()

{}

public override ActionOnServerException OnServerException(SAPServer server, Exception e)

{

Console.WriteLine("A Server Exception was thrown"+e);

ServerException(this, System.EventArgs.Empty);

return SAP.Connector.ActionOnServerException.AutoReconnect;

}

}

I placed a wrong configuration (point to an inexistente program_id) and nothing happens, should the callback function be called?

Former Member
0 Kudos

I think, this should work. But the Problem is, that you are dependent to the Function of the SAP .NET Connector. And I don't know exactly in which cases this Exception is thrown. But I tested it with the following cases and it worked:

- Put in a wrong Host ID

- The Server was running and i cut off the Network cable

But, you must know, that it takes a few seconds until this exception is called. I don't know why!

Regards,

Oliver

Former Member
0 Kudos

Hi again Oliver,

My problem now is to simulate the shutdown of the SAPServer, it seems to me that when SAP goes down it looses it's references to the servers that were running. When it comes up it doesn't know the address of the running servers...

Is it possible to detect this? If I could detect this I would stop and then start all the servers stub instances and re-register them in the SAP.

Can you help me on this?

Former Member
0 Kudos

No Sorry,

with this I can't help you. But ask someone from SAP!!

Regards,

Oliver