cancel
Showing results for 
Search instead for 
Did you mean: 

NCo 3.02 Context & Exceptions (VB 2010)

Former Member
0 Kudos

Sometimes it is necessary to bracket BAPI calls using the statements RfcSessionManager.BeginContext and RfcSessionManager.EndContext. But what happens in detail if an exception is raised?


try
  Dim BAPI_Worklist As IRfcFunction = Repo.CreateFunction("QIRF_SEND_REQUIRMENTS_GET_DAT2")

  RfcSessionManager.BeginContext(SAP_Destination)
     BAPI_Worklist.Invoke(SAP_Destination) ' --> raises exception
     Dim BAPI_SendCommit As IRfcFunction = Repo.CreateFunction("QIRF_SEND_COMMIT_TO_QM")
     BAPI_SendCommit.Invoke(SAP_Destination)
  RfcSessionManager.EndContext(SAP_Destination)

Catch ex As RfcAbapException
      If ex.Key = "WORKLIST_EMPTY" Then
         'do nothing.
        ' RfcSessionManager.EndContext(SAP_Destination) ???
      End If
End Try

"BAPI_Worklist.Invoke" raises an exception if there's no SAP worklist data to fetch. But as you see, the EndContext statement is not executed. But the context seems to be closed as it is not possible to add another EndContext statement (the one with question marks). This statement would only raise a new exception.

There statements are executed in a backgroundworker thread which is removed after execution. Within the NCo dll there seems to be a timer which produces exactly 600s after the exception a new exception and a new entry in the file "dev_nco_rfc.log":


SAP.Middleware.Connector.RfcCommunicationException: no SAP ErrInfo available
SAP.Middleware.Connector.CpicConnection.CpicReceive(Int32 timeout)
SAP.Middleware.Connector.CpicConnection.Read(Byte* buffer, Int32 offset, Int32 count)
SAP.Middleware.Connector.RfcConnection.ReadBytes(Byte* buffer, Int32 count)
SAP.Middleware.Connector.RfcConnection.ReadRfcIDBegin(Int32& length)
SAP.Middleware.Connector.RfcConnection.ReadUpTo(RFCGET readState, RfcFunction function, RFCID toRid)
SAP.Middleware.Connector.RfcConnection.RfcReceive(RfcFunction function)
SAP.Middleware.Connector.RfcConnection.ResetSAPServerContext()
SAP.Middleware.Connector.RfcSessionState.Dispose(Boolean disposing)

As there is no active thread to catch the timeout exception, the program terminates. I can live with the WORKLIST_EMPTY exceptions but I have to eliminate the 600s timeout. Any good idea what to do?

Kind regards,

Masgrim

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

There was a bug in NCo 3.02. Later versions don't have this problem anymore.

Former Member
0 Kudos

Hi

NCo 3.02 is the latest one...or after that any patch level is available for Nco ?

Regards

Dilip Vyas

Former Member
0 Kudos

You are right - it is still main version 3.02. But if I look at the file details, I see file version 3.0.2.2 & assembly version 3.0.0.42. This subversion (and all the following subversions, I assume) is all right.