What does it do? This statement calls the specified XSL transformation> (XSLT) or a Simple Transformation> (ST). The source of the transformation is specified behind SOURCE> and the result is stored as specified behind RESULT>. PARAMETERS> can be used to pass parameters to the transformation. The addition OPTIONS>> can be used to specify transformation options options>. The possible transformation types are:
from XML to XML (for XSLT only)
from XML to ABAP (for XSLT and Simple Transformations only)
from ABAP to XML (for XSLT and Simple Transformations only)
from ABAP to ABAP (for XSLT only) JSON-XML>, which maps JSON> data to XML, can be used to execute all categories of transformations for JSON that are also possible for XML. For more information, see Transformations for JSON>.
Latest notes:
The characters < >, >>, >, '>, and '>, which have a separate meaning in XML syntax, are handled automatically for XML data. When XML data is written, the required XML notation lt;, lt;>, gt;>, amp;>, quot;>, or apos;> is automatically created in values of elements or attributes. When XML data is read, the XML notation is transformed to the corresponding characters. It is not usually necessary to apply the escape character function escape>> or a similar method to character-like XML results of the statement CALL TRANSFORMATION > and would produce incorrect results. An exception to this rule is creating HTML data with XSLT if it contains JavaScript parts.
When JSON data is written, special characters> in character-like values are prefixed automatically with the escape character >. Conversely, the escape character is removed from character-like values when JSON data is read. NON_V5_HINTS
When a transformation is performed, methods from the class libraries for XML> are used internally.
In the case of XSLT, a DOM> is always needed as a source. This DOM is constructed and processed using the iXML Library>. In the case of the identity transformation> ID>, the iXML Library> is used only if the corresponding objects are specified as source or target.
ST is processed serially, using the sXML Library >. The library that is used affects the character set that is supported. The iXML Library supports UCS-2> and the sXML Library supports UTF>. ABAP_HINT_END
ABAP_EXAMPLE_VX5 The transaction Standard SAP Help forEMO>> demonstrates various transformations from ABAP data to XML> and JSON>. ABAP_EXAMPLE_END • ID CALL TRANSFORMATION
ABAP Alternative 1 ... ID ...> BEGIN_SECTION ID CALL-TRANSFORMATION-ID
What does it do? Specifies the identity transformation> ID > directly. This transformation exists as an XSL transformation in the repository but is executed by the runtime framework in an optimized ID engine, depending on the transformation source or target. For more information, see:
Identity transformation>
Identity Transformation for JSON>
ABAP_EXAMPLE_ABEXA Executable Example of an Identity Transformation> ABAP_EXAMPLE_END END_SECTION ID CALL-TRANSFORMATION-ID
ABAP Alternative 2 ... trans$|(name) ...> BEGIN_SECTION ID CALL-TRANSFORMATION
What does it do? Specifies any transformation. The transformation addition can be specified either statically or dynamically:
trans> If static, the transformation is specified directly as trans>.
(name)> BEGIN_SECTION ID CALL-TRANSFORMATION-DYNAMIC If dynamic, the transformation is specified as the uppercase content of a parenthesized character-like data object name>. END_SECTION ID CALL-TRANSFORMATION-DYNAMIC The specified transformation must exist as an XSLT program> or as a Simple Transformation> in the repository>. If a dynamically specified transformation is not found, an exception of the class CX_INVALID_TRANSFORMATION> is raised.
ABAP_EXAMPLE_ABEXA Executable Example of a Simple Transformation > ABAP_EXAMPLE_END END_SECTION ID CALL-TRANSFORMATION • SOURCE CALL TRANSFORMATION • XML CALL TRANSFORMATION SOURCE
ABAP Addition e2 ... $}$|(stab)$}>
What does it do? Specifying the source. Transformation of XML Data> When XML src_xml> is specified, the XML> data contained in src_xml> is transformed. src_xml> can exist in the following forms:
As a data object with the type string> or as a standard table> with a flat> character-like line type, which can contain the following data:
Character-like XML> data in XML 1.0 format.
Character-like JSON> data. When any transformation trans$|(name)> is used, the JSON data is converted to the associated JSON XML format> and passed to this transformation. The predefined identity transformation> ID>> handles the JSON data directly.
As a data object with the type xstring> or as a standard table> with a flat> byte-like line type, which can contain the following data:
Byte-like representation of the characters in XML> data in XML 1.0 format, in accordance with a code page such as UTF-8.
XML> data in Binary XML > format.
Byte-like representation of the characters in JSON > data, in accordance with a code page such as UTF-8. When any transformation trans$|(name)> is used, the JSON data is converted to the associated JSON XML format> and passed to this transformation in this way. The predefined identity transformation> ID>> handles the JSON data directly. BEGIN_SECTION VERSION 5 OUT
As an interface reference variable for objects in the iXML Library> (XSLT only):
Interface reference variable with the type IF_IXML_ISTREAM> that points to an input stream> that reads XML data.
Interface reference variable with the type IF_IXML_NODE> that points to a node or an entire XML document in DOM representation>. END_SECTION VERSION 5 OUT
As a reference variable of the type BEGIN_SECTION VERSION 5 OUT IF_SXML_READER> or END_SECTION VERSION 5 OUT CL_SXML_READER> for XML Reader> in the sXML Library>. The transformation moves the reader by one node and processes the entire matching subtree. If the transformation is successful, the reader is located at the end of the processed data. Any valid reader can be specified:
XML readers for XML> data in XML 1.0 format.
XML readers for XML> data in Binary XML> format.
XOP readers for XML> data in XOP> format.
JSON readers for JSON data>. When any transformation trans$|(name)> is used, the JSON reader returns the JSON data in JSON-XML> format. When a predefined identity transformation> ID>> is used, the JSON data is handled directly.
Latest notes:
The interface IF_SXML_READER> and the class CL_SXML_READER> are part of the API of the sXML Library>, whose objects can be accessed using CALL TRANSFORMATION>.
Transformations of XML data in XOP format> are only possible with an XOP reader in the sXML Library. All other formats can be also specified in appropriate strings or internal tables.
When XML data is specified in strings or internal tables, it is best to use byte strings or byte-like line types and the UTF-8 code page for the representation.
The methods CONVERT> of the interfaces IF_ABAP_CONV_IN>> and IF_ABAP_CONV_OUT>> of objects created using the class CL_ABAP_CONV_CODEPAGE>> can be used to transform character-like XML data or JSON data to a byte-like representation in accordance with a code page and vice versa. NON_V5_HINTS
The interfaces IF_IXML_ISTREAM> and IF_IXML_NODE> are part of the API of the iXML Library>, whose objects can be accessed using CALL TRANSFORMATION>.
For compatibility reasons, src_xml> can also be a class reference variable of the type CL_FX_READER>. The class CL_FX_READER>, however, is scheduled for replacement by CL_SXML_READER>. ABAP_HINT_END Transformation of ABAP Data> bn1 = e1 ...> or (stab)> is used to specify the ABAP data e1 e2 ...> to be transformed.
When the identity transformation> ID> is called, the ABAP data is either serialized to the canonical XML format> asXML> or to the canonical JSON format> asJSON>, depending on the target.
When an XSLT program is called, the ABAP data is serialized to the canonical XML representation>, which is then used as the source of the XSL transformation. bn1 bn2 ...> is used to specify the names of the XML elements that represent the ABAP data objects in the canonical XML representation.
When a Simple Transformation is called, the transformation has read-only access to the ABAP data using the names bn1 bn2 ...>. Instead of using a static parameter list, the data objects can be passed dynamically as value pairs in the columns of an internal table stab > that has the type abap_trans_srcbind_tab> from the type pool> ABAP>>. Serializations convert the elementary components of the ABAP data objects to asXML> or asJSON>, in accordance with the mappings for built-in ABAP types> or for further XML schema data types> . This can raise the exceptions described there, some of which can be bypassed by using transformation options>. The case of the names in the XML data or JSON data depends on how they are specified in the ABAP runtime framework. If specified statically ( b1>, b2>, ...), uppercase is used and if specified dynamically in stab>, the case used there is used.
Latest notes: When a Simple Transformation is called, the serialization always creates an internal XML writer>, which can be addressed using the interface IF_SXML_WRITER> from sXML> Library. The object is accessed using attributes of the ST statement tt:call-method>>. NON_V5_HINTS ABAP_HINT_END
ABAP_EXAMPLES_ABEXA
For an overview of all possible XML sources, see XML Sources of Transformations> .
For deserializations of ABAP data from an XML reader in the sXML Library, see sXML-Library, Transformation from XML Reader>. ABAP_EXAMPLE_END • RESULT CALL TRANSFORMATION • XML CALL TRANSFORMATION RESULT
ABAP Addition f2 ...$}$|(rtab)$}>
What does it do? Specifying the target. Transformation to XML Data> When XML rslt_xml> is specified, a transformation to XML> data takes place and this data is passed to rslt_xml>. rslt_xml> can exist in the following forms:
As a variable with the type string> or as a standard table with a flat character-like line type. The XML data returned by the transformation is stored in XML 1.0 format as a character string in the string or in the table. Here, a byte order mark (BOM) is used as a prefix.
As a variable with the type xstring> or as a standard table with a flat byte-like line type. The XML data returned by the transformation is stored in XML 1.0 format as a byte string in the string or table. The byte string represents the characters of the XML data in accordance with the code page UTF-8. A byte order mark (BOM) is not used as a prefix.
As an inline declaration DATA(var)>> or FINAL(var)>>, where a variable with the type xstring> is created. BEGIN_SECTION VERSION 5 OUT
As an interface reference variable for objects in the iXML Library> (XSLT only):
Interface reference variable with the type IF_IXML_OSTREAM> that points to an output stream> that writes XML data.
Interface reference variable with the type IF_IXML_DOCUMENT> that points to an XML document> in DOM> representation. END_SECTION VERSION 5 OUT
As a reference variable with the type BEGIN_SECTION VERSION 5 OUT IF_SXML_WRITER> or END_SECTION VERSION 5 OUT CL_SXML_WRITER> for XML> writers in the sXML> Library. The result of the transformation is added to the current element of the writer as a subtree. Any valid writer can be specified:
XML writers for XML> data in XML 1.0 format.
XML writers for XML> data in Binary XML> format.
XOP writers for XML> data in XOP> format.
JSON writers for JSON> data. A transformation trans$|(name)> must create XML data in JSON-XML> format. The predefined identity transformation> ID>> creates the appropriate data directly.
Latest notes:
The interface IF_SXML_WRITER> and the class CL_SXML_WRITER> are part of the API of the sXML Library>, whose objects can be accessed using