Don’t you hate it when you’re talking on the cell phone and the call drops? I was talking to my wife on the way to my client site this week and was telling her about this awesome blog post I was writing when the call dropped. Bummer. Since I really wanted to tell her about my blog, I wanted to complete the conversation. But first, I had to wait for service. Then I had to call her back, and have her answer. Then I uttered the phrase that all cell phone users know, “What was the last thing you heard me say?” It was a fairly messy recovery, but I was finally able to talk about my blog!
When two software systems integrate, we also have to deal with the “dropped call” problem. SAP NCo 3.0 offers a few different levels of data recovery options depending on whether NCo is the client or the server. But before any data recovery can happen, the first step is to call the other party back. This blog post describes the general process to reconnect an NCo RfcServer to an SAP gateway host.
I have read in other blogs that SAP claims their RfcServer object will automatically reconnect if it detects a dropped connection. While this may be true, I have not seen this automatic reconnection occur in all the testing that I have done. So, left to my own devices, I set out to figure out the best way to reconnect an RfcServer.
The first thing I did was to map out the “dropped call” process diagram.
I know that some of you are thinking that after a call is dropped it is not necessary to hang up. This is true. But the connection needs to be cleaned up. In the mobile phone analogy, the phone automatically detects the dropped call and hangs up for you. What I found during my research is that NCo 3.0 doesn’t automatically clean up broken connections, nor does it automatically clean up failed connection attemps.
Armed with this flow chart, my new found understanding of NCo 3.0, some Diet Mountain Dew, and a bag of Skittles, I decided to tackle coding a similar solution in C# using NCo 3.0.
But first, I tweaked my flow chart:
The result was a RfcServer NCo 3.0 project that would automatically recover from connection errors. The key concept is to call the Shutdown() method of the RfcServer object after each connection failure. Add in an event handler for the RfcServerError Event and a timer, and the rest falls into place.
Additional SAP NCo 3.0 Information
Follow these links for more information about SAP NCo 3.0 programming: