Monday, 21 December 2009

CX_SY_CONVERSION_NO_DATE_TIME:XSLT exception. Value DD/MM/YYYY is not a valid date in accord with the XML format for ABAP

If you get the following error when calling a SAP BAPI via a web service from .NET:

CX_SY_CONVERSION_NO_DATE_TIME:XSLT exception.An error occurred when deserializing in the simple transformation program /1BCDWB/WSS2B813A2D0E86D9A4A67.Value 22/12/2009 1:00:00 PM is not a valid date in accord with the XML format for ABAP

Then the date type may not have been inferred correctly if you are using the .NET XSD.exe tool (e.g. if the field has a default in an SAP BAPI, it may not be able to infer the correct date type and just treats the date as a string.).

To fix this problem you can simply do a date conversion to the correct format (e.g. via the DateTime.ToString("yyyy-MM-dd"). The format it is expecting in ABAP is yyyy-MM-dd e.g. 2009-12-30.


Michael Freake said...

This was exactly my issue. When I called the function module behind the Service I could just use date as YYYYMMDD. Figuring this would be the case when I was testing the service I tried the same date format but received the noted error.

Thanks for sharing!

CK said...

This solution of DateTime.ToString("yyyy-MM-dd") will not work as WSDL has already published the property signature with System.DateTime and hence string cannot be converted to DateTime.