ABAP Keyword Documentation → ABAP − Reference → Data Interfaces and Communication Interfaces → ABAP and XML → Transformations for XML → asXML - Canonical XML Representation → asXML - Mapping of ABAP Data Types → asXML - Mapping of Reference Variables and Objects
asXML - Anonymous Data Objects
An anonymous data object, that is a data object created using
or the instance operator
NEW, is represented as a subelement of heap in the form:
<type id = "key" attr="...">...</type>
The value of a subelement like this is displayed in the asXML representation for named data objects or for reference variables. If the anonymous data object itself is a non-initial reference variable, according to the rules above, it references another element of heap. Element name type is the data type of the data object (or the dynamic type of the reference variables) that is specified as the XML schema type name from namespace nspace (see table below), whereby attributes attr specify technical properties of the type if necessary. The mandatory attribute id contains the unique key key of the element by which it is referenced by the display of the corresponding reference variables in values or heap.
The XML schema type name is constructed according to the following hierarchy:
REF TO dataor
REF TO object, the XML schema type name is refData or refObject. Both have the namespace http://www.sap.com/abapxml/types/built-in.
TYPES. Here, the associated namespace (see table below) indicates where the data type is defined.
The precondition for the construction of an XML schema type name is that the data type of the data object has a statically usable name. If the data type only exists as a property of a data object and therefore only has one
technical name, an exception is raised (in serializations)
that can be bypassed for XSLT programs by entering transformation option
The following table shows the namespaces for the XML schema type names, where types in the first column stands for http://www.sap.com/abapxml/types. The namespaces indicate where a data type is defined. In the uppercase identifiers PRG, CPOOL, FPOOL, TPOOL, METH, FUNC, FORM, and CLASS, characters not in ranges "a" to "z", "A" to "Z", "0" to "9", "_", or "-" are displayed as "!hex(c)", where hex(c) is the two-character hexadecimal representation of the ASCII codes for character "c".
|types/program/PRG||ABAP program prg|
|types/class-pool/CPOOL||Class Pool cpool|
|types/type-pool/TPOOL||Type group tpool|
|types/function-pool/FPOOL||Function group fpool|
|types/function/FUNC||Function module func|
|types/program.form/prg/FRM||Subroutine frm in program prg|
|types/function-pool.form/FPOOL/FRM||Subroutine frm in function group fpool|
|types/method/CLASS/METH||Method meth of a global class class|
|types/program.method/PRG/CLASS/METH||Method meth of a local class class in program prg|
|types/class-pool.method/CPOOL/CLASS/METH||Method meth of a local class class in class pool cpool|
|types/function-pool.method/FPOOL/CLASS/METH||Method meth of a local class class in function group fpool|
The following table shows the XML schema type names for elementary ABAP types. These names differ in part from the canonical XML schema data types, since the data type of anonymous data objects must be specified completely. The namespaces nspace for the elementary ABAP types of anonymous data objects are either xsd="http://www.w3.org/2001/XMLSchema" for general schema types or abap="http://www.sap.com/abapxml/types/built-in" for special ABAP schema types for which technical attributes must sometimes be specified.
|ABAP Type||XML Schema Type Name||Attributes|
The attribute maxLength specifies the length for ABAP types of generic
length. The XML schema type abap:digits restricts the value range of an element to digits only. For XML schema type abap:decimal, the length and the
number of decimal places
are specified using attributes totalDigits and fractionDigits.
The length totalDigits specifies the number of places between 1 and 31. In ABAP programs, the length for data objects of type
p is specified in bytes and the number of
places is calculated from 2×len-1.
In serializations, therefore, the value of totalDigits is always odd. In deserializations, an even value of totalDigits is increased by one implicitly.
For information about the differences between serializing to heap and embedded elements, see Serializations to Heap or Embedded.