Continued: Strongly typed date, time and numerical fields from SAP DATS, TIMS and NUMC support in Azure Logic Apps SAP connector


We're about to release the type handling improvements for Azure Logic App SAP connector previously announced here.

The connection will have a new Boolean (true-false) parameter “SafeTyping”, enabling to treat DATS and TIMS as string rather than their XML equivalents xs:date and xs:time (where xmlns:xs="http://www.w3.org/2001/XMLSchema"). This is an opt-in behavior as we encourage our user to use strong types for early detection of issues. BizTalk Server users will recognize the name but be aware this only applies to date and time, not to NUMC as per earlier note we are handling NUMC as text value and not attempting to coerce them into integers.

     "SafeTyping": {
       "type": "bool",
       "uiDefinition": {
         "displayName": "Safe Typing",
         "description": "Use strong types if false, otherwise use string as safe type.",
         "tooltip": "Enables safe typing, which treats types as string instead of strong types (e.g. Date, Time, Datetime), relaxing type and value validations.",
         "constraints": {
...
           "required": "false",
...
         }
       },
       "defaultValue": "false"

     }

 

This parameter will affect the behavior of all of schema generation, send message (both the payload been sent and the response been received) and trigger.

 

For schema, with “SafeTyping” enabled, the DATS and TIMS SAP types will map to XML string fields with length restrictions only, like this:

     <xs:element minOccurs="0" maxOccurs="1" name="UPDDAT" nillable="true">
       <xs:simpleType>
         <xs:restriction base="xs:string">
           <xs:maxLength value="8" />
         </xs:restriction>
       </xs:simpleType>
     </xs:element>
     <xs:element minOccurs="0" maxOccurs="1" name="UPDTIM" nillable="true">
       <xs:simpleType>
         <xs:restriction base="xs:string">
           <xs:maxLength value="6" />
         </xs:restriction>
       </xs:simpleType>
     </xs:element>

With strong typing (default of “SafeTyping” false), DATS and TIMS will map to the more straightforward XML types:

<xs:element minOccurs="0" maxOccurs="1" name="UPDDAT" nillable="true" type="xs:date" />

<xs:element minOccurs="0" maxOccurs="1" name="UPDTIM" nillable="true" type="xs:time" />

 

Then for sending messages, SAP DATS and TIMS response with “SafeTyping” enabled will look like this:

<DATE>99991231</DATE>

<TIME>235959</TIME>

With strong typing (default of “SafeTyping” false), DATS and TIMS will comply to matching XML type format:

<DATE>9999-12-31</DATE>

<TIME>23:59:59</TIME>

See https://www.w3schools.com/XML/schema_dtypes_date.asp for reference.

 

Samples for minimum values

<DATE>00010101</DATE>

<TIME>000000</TIME>

vs

<DATE>0001-01-01</DATE>

<TIME>00:00:00</TIME>

 

Of interest is the default value by SAP for these fields when the fields are not null:

<DATE>00000000</DATE>

<TIME>000000</TIME>

vs

<DATE d2p1:nil="true" xmlns:d2p1="http://www.w3.org/2001/XMLSchema-instance"></DATE>

<TIME>00:00:00</TIME>

Our strong type handling here maps SAP’s default date of 000000000 to XML nil because XML does not allow year, month or date value of 0 and does not have a special initial value other than nil equivalent to SAP’s all zeroes. TIMS SAP default of 000000 is a valid XML time value of 00:00:00.

The same applies when SAP has all spaces stored in the DATS – TIMS fields, XML time will come up as 00:00:00 but date will be nill.

 

Note that for NUMC fields the original 0s from SAP will be preserved and no trimming will occur. E.g.:

<AGMT_ITEM>0</AGMT_ITEM>

Will be now:

<AGMT_ITEM>00000</AGMT_ITEM>

 

Also we had a bug not translating the SAP null values to XML nil. We use to generate empty string values like this:

<ADDR_NO xmlns="http://Microsoft.LobServices.Sap/2007/03/Types/Rfc/"></ADDR_NO>

<FORMOFADDR xmlns="http://Microsoft.LobServices.Sap/2007/03/Types/Rfc/"></FORMOFADDR>

Which will now be corrected to:

<ADDR_NO d3p1:nil="true" xmlns:d3p1="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://Microsoft.LobServices.Sap/2007/03/Types/Rfc/"></ADDR_NO>

<FORMOFADDR d3p1:nil="true" xmlns:d3p1="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://Microsoft.LobServices.Sap/2007/03/Types/Rfc/"></FORMOFADDR>

Allowing to distinguish between empty string and null values.

Comments (1)
  1. David Burg says:

    This blog has been moved off the MSDN platform. Find further content and update at https://www.linkedin.com/today/author/daviburg

    Comments are locked as part of the blog migration, so please reach out to your customer support contact for assistance with Microsoft products and services.

Comments are closed.

Skip to main content