Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Data Interfaces and Communication Interfaces →  ABAP and XML →  Transformations for XML →  asXML - Canonical XML Representation 

asXML - Mapping Additional XML Schema Data Types

As well as the XML schema data types required for mapping elementary ABAP types, there are additional XML schema data types that cannot be mapped directly to predefined ABAP types. To enable type-compliant deserialization of these external types to ABAP data objects, a special domain is implemented in ABAP Dictionary for each required XML schema data type. The name of the domain starts with XSD. Any elementary ABAP data objects whose data type is defined using a data element that refers to a domain of this type are mapped to the appropriate XML schema data type, both when serialized and when deserialized. The required conversions are performed internally. This applies to both XSL transformations and to simple transformations.

The following table provides a summary of the XML schema data types supported by domains, as well as a further supported type (UUID).

XML Schema Type XML Representation Domain ABAP Representation
xsd:boolean true, false XSDBOOLEAN "X", " "
xsd:date 2007-10-01 XSDDATE_D "20071001"
xsd:language EN, DE XSDLANGUAGE "D", "E"
xsd:QName prefix:name XSDQNAME "
xsd:time 11:55:00 XSDTIME_T "115500"
UUID 12345678-1234-abcd-ef12-123456789012 XSDUUID_RAW, XSDUUID_CHAR "123456781234ABCDEF12123456789012"

The following sections describe the domains and their mappings in more detail.

The following applies to all domains:

  • during the deserialization of an empty XML element in an ABAP data object (which is typed with reference to this type of domain), the initial value of the associated elementary ABAP type is assigned as usual.
  • The transformation option initial_components for suppressing initial values during the serialization has the same effect as for normal data types. This can lead to unexpected behavior during deserialization, if the transformation option clear is not used with the value "all".

Other versions: 7.31 | 7.40 | 7.54


With the exception of XSDQNAME, all domains are also supported in transformations for JSON. See the related example.


The domain XSDBOOLEAN has the data type CHAR with length 1 and therefore supports the usual ABAP representation of a truth value using "X" for true and " " for false. These values are entered as fixed values for the domain and are checked when an ABAP data object linked to this domain is serialized. The serialization creates the values "true" and "false" in XML. A deserialization also accepts the non-canonical XML values "1" and "0". Any other values raise the exception CX_SY_CONVERSION_NO_BOOLEAN. An empty element generates the value " " during deserialization.


  • The transformation option initial_components suppresses components of type XSDBOOLEAN during serialization, if the components contain the value " " for "false". Therefore this option should be used carefully.

  • The return value of the Boolean function xsdbool has the type XSDBOOLEAN.


The XML schema data type date for dates is supported by both the predefined ABAP type d and the domain XSDDATE_D. This domain has the data type DATS. When data is serialized and deserialized, the validity of the date is also checked, which is not the case with the predefined ABAP type d. An empty element generates the value "00000000" during deserialization.


The XML schema data type dateTime supports the representation of dates and times in a field, based on ISO 8601. An XML value of this type is either in UTC format, contains a time zone, or represents a local time. Five domains are assigned to this schema data type:

  • The domains XSDDATETIME_Z and XSDDATETIME_LONG_Z have the data types DEC with length 15 or 21. XSDDATETIME_Z has no decimal places; XSDDATETIME_LONG_Z has seven decimal places. These domains support the long and short form of the time stamp used in ABAP, which is always processed as the current UTC reference time. A serialization creates values in UTC format (yyyy-mm-ddThh:mm:ss.zzzzzzzZ) in XML. A deserialization accepts XML values in UTC format (closed by Z) or with time zones (closed by {+|-}hh:mm). The time zones are converted to the appropriate UTC value. No precision may be lost during deserialization. This means that only XML values with a maximum of seven decimal places can be deserialized. An empty element generates the value 0 during deserialization.
  • The domain XSDDATETIME_OFFSET has the data type CHAR with length 18. Mapping is permitted to XML values for which a time zone is specified (yyyy-mm-ddThh:mm:ss{+|-}hh:mm). The defined format for an ABAP data object of type XSDDATETIME_OFFSET is yyyymmddhhmmss{+|-}mmm. In a deserialization, the time zone of the XML value specified in hours and minutes is converted to a three-figure number of minutes. An empty element generates an empty string during deserialization.
  • The domain XSDDATETIME_LOCAL has the data type CHAR with length 14. The domain XSDDATETIME_LOCAL_DT has the data type NUMC with length 14. They permit mappings to XML values that specify a local time (yyyy-mm-ddThh:mm:ss). This means that they are not available in UTC format and no time zone is specified. The defined format for an ABAP data object of type XSDDATETIME_LOCAL or XSDDATETIME_LOCAL_DT is yyyymmddhhmmss. The main difference between the two data types are their initial values. An empty element generates an empty string during deserialization.

Invalid values raise the exception CX_SY_CONVERSION_NO_DATE_TIME.


The domain XSDLANGUAGE has the data type LANG with length 1. It enables single-character internal language IDs to be mapped to the associated two-character external ISO IDs and back again. The rule for the mapping is specified in the columns SPRAS (single-character ID) and LAISO (two-character ID) of the database table T002. In serializations, the single-character ID is found in the table T002 and the associated two-character ID is used as an XML value. The opposite happens in deserializations. In deserializations, lowercase letters are transformed to uppercase letters first. If no ID is found in the table T002, the behavior is as follows.

  • In Unicode systems, the following relationship is evaluated:
Y = ( X2 - 0x20 ) + ( X1 - 0x20 ) * ( 0x80 - 0x20 ) + 0xAC00
Here, Y is the 16-bit Unicode value of the single-character ID and X1 and X2 are the 7-bit ASCII values of the two characters in the two-character ID.
  • In serializations, a two-character ID is created (if possible), that satisfies this relationship. If this is not possible, the exception CX_SY_CONVERSION_UNKNOWN_LANGU is raised.
  • In deserializations, the single-character ID is calculated in accordance with this formula. The exception CX_SY_CONVERSION_UNKNOWN_LANGU is raised if the XML value is longer than two characters (except when the third character is a hyphen; in this case only the first two characters are used) or if the 7-bit ASCII values of the characters are less than 0x20 or greater than or equal to 0x80.
  • In non-Unicode systems, only the ID from the table T002 is allowed (in both directions). Invalid values raise the exception CX_SY_CONVERSION_UNKNOWN_LANGU. An empty element generates the value " " during deserialization.


The domain XSDQNAME has the data type STRING. The XML schema data type QName represents qualified names. In XML, a qualified name can have a prefix that is separated by a colon. A prefix of this type must be associated with a URI in a namespace declaration of the current element or a higher-level element. In ABAP, a name of this type is represented as the content of a string in the form "{URI}name".

When an ABAP object of the type XSDQNAME is serialized, the URI specified in curly brackets is used to generate the associated prefix. If there is no namespace declaration for the URI in the right context, it is inserted in the current element, with the resulting namespaces containing the names "n0", "n1", ... If the URI is associated with the default namespace, no prefix is generated. If no URI is specified in curly brackets, again no prefix is generated. This latter case is possible only if the default namespace is not used simultaneously in the current element. Otherwise, the exception CX_ST_INVALID_XML is raised (which can occur only in simple transformations).

When a value with a prefix is deserialized to an ABAP data object of the type XSDQNAME, the system searches for a URI in an associated namespace declaration. If no URI is found, the exception CX_SY_CONVERSION_NO_QNAME is raised. If a value without prefix is deserialized, the URI of the default namespace is used (if available) or only the name is placed in the string.

An initial data object of the type XSDQNAME generates an empty element when serialized, and vice versa when deserialized. In both serializations and deserializations, the correctness of the specified name with regard to the valid naming conventions is checked. If violated, an exception of the class CX_SY_CONVERSION_NO_QNAME is raised.

The class CL_ABAP_XSDTYPE_HELPER contains the methods TO_XSDQNAME and FROM_XSDQNAME for the conversion of URIs and names to the type XSDQNAME, and vice versa.


The XML schema data type time for dates is supported by both the predefined ABAP type t and the domain XSDTIME_T. This domain has the data type TIMS. When data is serialized and deserialized, the validity of the time is also checked, which is not the case with the predefined ABAP type t. An empty element generates the value "000000" during deserialization.


The domain XSDUUID_RAW has the data type RAW with length 16. The domain XSDUUID_CHAR has the data type CHAR with length 32. They support 16-character byte-like UUIDs and 32 character character-like UUIDs, as created, for example, by the class CL_SYSTEM_UUID in ABAP data objects. A serialization creates the hexadecimal XML schema representation from these UUIDs, with hyphens and lowercase letters. Deserializations accept uppercase letters as well. A character-like UUID can contain only uppercase letters in serializations. Invalid UUIDs raise the exception CX_SY_CONVERSION_NO_UUID. An empty element generates byte strings or character strings filled with hexadecimal zeros during deserialization. .


Exceptions from mappings cannot be handled directly. Instead, the exception CX_TRANSFORMATION_ERROR (or one of its subclasses) from statement CALL TRANSFORMATION can be handled. The attribute PREVIOUS then contains a reference to the original exception.