RFC_ERROR_APPLICATION_EXCEPTION on SAP WCF Adapter

When calling a RFC method on a SAP CRM system using the WCF custom adapter with SAP binding I received the following error message:

 

The adapter failed to transmit message going to send port "WcfSendPort_SAPBinding_Rfc_ARCHIV_CONNECTION_INSERT" with URL "sap://CLIENT=018;LANG=NL;@a/**.*.**.***/35?RfcSdkTrace=False&AbapDebug=False". It will be retransmitted after the retry interval specified for this Send Port. Details:"Microsoft.Adapters.SAP.RFCException: Details: ErrorCode=RFC_EXCEPTION. ErrorGroup=RFC_ERROR_APPLICATION_EXCEPTION. SapErrorMessage=.  AdapterErrorMessage=Error returned by RfcCallReceiveEx while calling RFC: ARCHIV_CONNECTION_INSERT.

The error message doesn’t provide much information:(

In our case the message we were sending towards SAP contained a mandant element <ns0:MANDANT>18</ns0:MANDANT>

Mandant is the highest level of organizational unit on a SAP/R3 system, it’s also called Client.

At our customer the mandant was either 018 or 020. The leading zero was missing which resulted in the exception. So we changed the mandant element to contain the leading zero.

<ns0:MANDANT>018</ns0:MANDANT>