DataXstream OMS+

NCo 3.0: Reconnecting a Broken RFC Server Connection

NCo 3.0: Reconnecting a Broken RFC Server Connection

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.

1 Comment

  1. Avatar for Daniel Bizzera
    Daniel Bizzera
    April 9, 2013 at 3:07 pm · Reply

    Hi, I’m from Argentina.
    We have a problem with Sap Connector. We have 2 applications sending data throught a RFC, installed in the same environment. And the problem is the following:
    When both apps trys to send data only one can, and the other stops sending and lost the connection. The only way is turn off one of its and send data by the active app, turn off this, turn on te other, send data…. ufff!
    Can you help us?

    Thanks, very much!!

    Daniel.

Leave a reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.