Jaa


WCF SAP Adapter “Gotchas”

Some recent cases have highlighted a couple of issues with the WCF SAP adapter. After some digging it turns out these are too common. The point here is to get these on the BizTalk blog.

The first issue is intermittent failure to receive SAP documents. There is no pattern to the failures. In some cases the first documents in a batch fail and the rest process successfully. The failed documents eventually are processed. Research indicates there is a design flaw in the adapter.

 

Problem

An error is triggered whenever there is an interval greater than about 15 minutes between receives of IDOC’s. This error causes one IDOC (the one in the middle of being transmitted) to be stuck permanently in SAP (in the transmitting state). Once the error occurs, the WCF Adapter faults, and restarts itself. During the restart, the connection is down and all IDOC’s sent during this time end up in SAP's retry queue (thanks to Xiao Dong Zhu).

Fortunately the fix for this issue is not too bad. Open the port to the SAP “Binding” tab. Scroll down to the “Standard Binding Element” section. Observe the “receiveTimeOut” property is set to “00:10:00”.

 

clip_image002

 

Solution

Update this setting to the maximum value (24.20:31:23.6470000).

 

clip_image004

 

The next issue can also be found in some Internet chatter.

 

Problem

WCF SAP tracing shows the following error.

[1]1810.0B34::01/26/2010-15:06:27.248 [CSharp]:[Wcf] BtsErrorHandler.HandleError called with Exception: Microsoft.ServiceModel.Channels.Common.XmlReaderGenerationException: An error occurred when trying to convert byte array: [32-00-30-00-31-00-30-00-30-00-30-00-30-00-30-00] of RFCTYPE: RFCTYPE_DATE with length: 8 and decimals: 0 to a .Net type. The parameter/field name is: CREDAT. ---> System.ArgumentOutOfRangeException: Year, Month, and Day parameters describe an un-representable DateTime.

<E2ETraceEvent xmlns="https://schemas.microsoft.com/2004/06/E2ETraceEvent">

<System xmlns="https://schemas.microsoft.com/2004/06/windows/eventlog/system">

<EventID>0</EventID>

<Type>3</Type>

<SubType Name="Error">0</SubType>

<Level>2</Level>

<TimeCreated SystemTime="2010-01-26T20:54:27.3084730Z" />

<Source Name="Microsoft.Adapters.SAP" />

<Correlation ActivityID="{21868c20-2c8f-423e-8f1b-90291ad032cc}" />

<Execution ProcessName="BTSNTSvc64" ProcessID="4008" ThreadID="25" />

<Channel />

<Computer>PBGBT1LBD01</Computer>

</System>

<ApplicationData>

<TraceData>

<DataItem>

<TraceRecord Severity="Error" xmlns="https://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord">

<TraceIdentifier>An error occurred when trying to convert byte array: [32-00-30-00-31-00-30-00-30-00-30-00-30-00-30-00] of RFCTYPE: RFCTYPE_DATE with length: 8 and decimals: 0 to a .Net type. The parameter/field name is: CREDAT.</TraceIdentifier>

<Description>ConvertRfcBytesToNetType</Description>

<AppDomain>DefaultDomain</AppDomain>

<Source>System.ArgumentOutOfRangeException/2256335</Source>

</TraceRecord>

</DataItem>

</TraceData>

</ApplicationData>

</E2ETraceEvent>

Solution

Recreate the RFC-destination in the SAP system (https://msdn.microsoft.com/en-us/library/dd788587(BTS.10).aspx ). Set it to Unicode. SAP is trying to send out an Unicode-IDOC while the RFC-destination is set to non-Unicode and the data is being truncated (thanks John Bailey).

Hopefully these two items will make the switch to the WCF SAP adapter a smooth process.

Comments

  • Anonymous
    February 21, 2011
    Hi Lem,Thanks for your blog about problem with the WCF-SAP adapter. We are also facing the first problem in receiving multiple trfc call from SAP system where SAP adapter faults and restarts the receive host instance automatically and after that start receiving messages.But sometimes it keeps the message in running state on sap queue. I have increased the receiveTimeOut Property to maximum value to : 23:59:59Still we see some incidents of adapter faults randomly. Is this a bug with WCF SAP adater or there is any work around to resolve this. We have huge flow of messages from SAP and restart of host in production will not be acceptable to client.Please suggest.Thanks,Rohit