Strongly typed date and time fields for SAP connector, and NUMC fields


These types have been a source of headache for users of BizTalk Server SAP Adapter as demonstrated by the amount of blog posting, forum questions and the existence of the SAP adapter binding connection parameter "EnableSafeTyping" and the further complication of a fine grain 12-toggles DataTypeBehavior binding connection parameter. Refer to posts from last decade:

https://blogs.msdn.microsoft.com/adapters/2007/11/24/the-enablesafetyping-binding-property/
https://blogs.msdn.microsoft.com/adapters/2008/08/13/the-datatypesbehavior-binding-property-in-the-sap-adapter/

As we are working on the new SAP connector (demo'ed in recent public conferences) with trigger and in particular schema generation for public preview for Logic App, we have taken the time to reflect onto the handling of these fields, as they affect the generated schemas.

You will notice that past messages that used to work with the current public preview SAP application and message server connectors, like this:

<BAPI_REQUISITION_CREATE xmlns="http://Microsoft.LobServices.Sap/2007/03/Rfc/">
  <AUTOMATIC_SOURCE>A</AUTOMATIC_SOURCE>
  <SKIP_ITEMS_WITH_ERROR>S</SKIP_ITEMS_WITH_ERROR>
  <REQUISITION_ITEMS>
    <BAPIEBANC xmlns="http://Microsoft.LobServices.Sap/2007/03/Types/Rfc/">
    <DOC_TYPE>NB</DOC_TYPE>
    <PUR_GROUP>003</PUR_GROUP>
    <MATERIAL>500-120</MATERIAL>
    <PLANT>1100</PLANT>
    <STORE_LOC>0001</STORE_LOC>
    <QUANTITY>10.00</QUANTITY>
    <DELIV_DATE>20060915</DELIV_DATE>
  </BAPIEBANC>
  </REQUISITION_ITEMS>
</BAPI_REQUISITION_CREATE>

Will, like BizTalk Server's default behavior, fail on send with this:

The string '20060915' is not a valid AllXsd value.

In the larger error exception:

Microsoft.ServiceModel.Channels.Exception.XmlReaderParsingException: An error occurred when trying to convert the XML string 20060915 of RFCTYPE RFCTYPE_DATE with length 8 and decimals 0 to a .NET type. Parameter/field name: DELIV_DATE Error message: The string '20060915' is not a valid AllXsd value.. ---> System.FormatException: The string '20060915' is not a valid AllXsd value.

You need to change the value to '2006-09-15'.

Why? Because 20060915 is not in the date type format of XML fields. See reference w3c documentation on XML data types for date at https://www.w3schools.com/XML/schema_dtypes_date.asp

Similarly in the response from SAP, you might have expected

      <DELIV_DATE>20060915</DELIV_DATE>
      <REL_DATE>00000000</REL_DATE>

These are now changing to strongly typed compliant values:

      <DELIV_DATE>2006-09-15T00:00:00</DELIV_DATE>
      <REL_DATE>0001-01-01</REL_DATE>

Rather than have users need to fine-grain control 13 parameters, we are working on a sensible out of the box behavior which will be strong typed, XML compliant and supporting the null, min and max SAP values.

The fields of SAP type NUMC will be always kept in their native string type, and there will not be logic to force them into an integer type. This because the described intend of the NUMC data type in SAP is to hold account numbers, zip codes, social security numbers, phone numbers and the like, which both do not make sense to handle as integer, neither can the integer type ensure to retain potential distinguishing and required elements such as heading zeros (0) or dash (-) delimiters.
If you have made use of a mix of the date-as-string and NUMC-as-integer BizTalk behaviors, do plan accordingly to add small XML-adjusting actions before and after the new SAP connector Send Message action, such that you convert SAP-style date and time values to XML compliant ones, as well as convert SAP NUMC strings to the integer format you expect. We are also working on providing an advanced connection parameter to keep the popular BizTalk EnableSafeTyping behavior (but not the 12 fine grained data type conversion controls).

Comments (0)

Skip to main content