Compartilhar via


The “DataTypesBehavior” binding property in the SAP Adapter

Firstly, if you haven’t already seen it, have a look at the post describing the EnableSafeTyping binding property - https://blogs.msdn.com/adapters/archive/2007/11/24/the-enablesafetyping-binding-property.aspx.

Since the Adapter Pack V1 released, we have had requests from users, wherein, they want to expose the Date (DATS) and Time (TIMS) data types as a .NET DateTime (strong typing), but yet want the adapter to be able to handle common SAP values such as 00000000 for DATS (which in SAP would mean a MINVALUE or NULL for the Date field). Besides, we already know that SAP doesn’t validate the data in DATS, TIMS and NUMC fields, so you might end up receiving “invalid” data from a SAP RFC, but you yet want the strong typing in your client code.

As a result, we’ve added a new binding property named “DataTypesBehavior” in the SAP adapter. This property is actually a “complex” property, containing 12 sub-properties. I’ll first list the names of the sub-properties.

  • DateTimeMaxToDats
  • DateTimeMinToDats
  • DateTimeMaxToTims
  • DateTimeMinToTims
  • DatsMaxToDateTime
  • DatsMinToDateTime
  • TimsMaxToDateTime
  • DateTimeNullToDats
  • DateTimeNullToTims
  • InvalidDatsToDateTime
  • InvalidNumcToInt
  • InvalidTimsToDateTime
  • EmptyDatsToDateTime

I’ll explain just a few of the above; you should then be able to figure out what the rest mean.

  • DateTimeMaxToDats – this property controls the behavior when converting DateTimeMax (the .NET DateTime.MaxValue value) “To” Dats (the SAP DATS value). The .NET DateTime.MaxValue can only be present in the request message. The adapter needs to convert this to a DATS value when sending it to SAP. Therefore, this property controls the behavior of how the adapter parses the request message.
  • DatsMaxToDateTime – this property controls the behavior when converting DatsMax (the SAP DATS MaxValue, which is 99999999) “To” DateTime. DATS values can only be sent from SAP right? And, only a client consuming the adapter can understand .NET DateTime, right? Hence, this property controls the behavior of the adapter, when it receives the DATS value from SAP (as the response to a RFC invocation), and when the adapter is converting this value to XML in order to give the response to the client.

Additional information for each property, including details on the values which need to be specified for each property, can be obtained by peeking through the attached .txt file – it contains the comments present in the source code of the adapter for these individual properties.

NOTE – this binding property is present in the SAP Adapter in the Adapter Pack v2. For the Adapter Pack v1, there is a hotfix available (KB # 954539) – your Microsoft support contact should be able to obtain it for you.

DataTypesBehavior.TXT

Comments

  • Anonymous
    June 17, 2009
    Can we control the behaivor of the WCF adapter to parse 20090422 date format sent from SAP to .NET strong datetime type
  • Anonymous
    December 12, 2010
    20090422  is a valid date in both .net and SAP. what kind of behaviour do you control ?
  • Anonymous
    December 12, 2010
    These datatype behaviours are only for the boundry conditions.20090422  is a valid date in both .net and SAP. what kind of behaviour do you control ?