SAP CALL TRANSFORMATION OPTIONS ABAP Statements

Get Example source ABAP code based on a different SAP table
  



CALL TRANSFORMATION - transformation_options

Short Reference
• OPTIONS CALL TRANSFORMATION


ABAP Syntax ... OPTIONS [clear = val]

[data_refs = val]
[initial_components = val]
[technical_types = val]
[value_handling = val]
[xml_header = val] ... .

ABAP Addition
1 ...clear
2 ... data_refs
3 ... initial_components
4 ... technical_types
5 ... value_handling
6 ... xml_header

What does it do? The addition OPTIONS enables predefined transformation options to be specified, to which specific values can be assigned to control transformations. The values must be defined as data objects val of type c or string . Each transformation option may only be specified once.



Latest notes:The transformations apply to XML and also to
JSON (where applicable).

ABAP Addition

What does it do? The transformation option clear controls how the ABAP target fields are initialized when deserializing XML or JSON to ABAP. Possible ValuesMeaning allAll target fields specified after RESULT are initialized before calling the transformation. This is the recommended setting. suppliedFor ST, the target fields which have a root node assigned to them in the ST program are initialized before calling the transformation. In XSLT, target fields for which there is a root node in the XML data are initialized before importing the nodes. Other target fields keep their value. noneDefault, the target fields specified after RESULT are not initialized, except for internal tables



Latest notes:Using the default setting (none) can become a
critical issue when non-existent or empty elements are deserialized in data objects. With non-existent elements, all data objects retain their original values. With empty elements, structures retain their values. In such cases, we recommend that you use clear with the value 'all'.

ABAP Addition

What does it do? The transformation option data_refs controls the output of data references if the transformation is from ABAP to XML or JSON. Possible ValuesMeaning noDefault for ST, no data references are output. heapDefault for XSLT and only allowed there; data referenced using heap references is produced as subelements of the asXML elements <(><<)>asx:heap> or the asJSON object %heap. Data objects references using stack references are not serialized. heap-or-errorOnly possible for XSLT. As heap, whereby the exception CX_XSLT_DESERIALIZATION_ERROR is raised if the data to be serialized contains stack references. heap-or-createOnly possible for XSLT. Like heap , but data objects referenced using stack references are handled like data objects referenced using heap references. embeddedOnly possible for XSLT. Referenced data objects are produced together with the reference. It is not possible to deserialize XML or JSON data created in this way, since the identity of the objects is lost when serialized.



Example ABAP Coding
For information about the differences between
serializing to heap and embedded elements, see Serializations to Heap or Embedded.

ABAP Addition

What does it do? The transformation option initial_components controls the output of initial structure components when transforming from ABAP to XML or JSON. Possible ValuesMeaning includeInitial components of structures are output. suppress_boxedDefault setting, does not produce initial boxed components of structures; produces initial components of all other structures. suppressInitial components of structures are not output.

Latest notes:The suppression of initial components during serialization reduces the data volume. However, this option should be used with caution and only if you have complete control over the deserialization process. If the option clear is not used with the value 'all' during serialization, then suppressed components in ABAP data objects are ignored and the target fields retain their values. Deseri alization in external systems can cause problems if a suppressed component is expected. The suppression of initial components also affects structure components that are typed with the domains for XML schema data types. For example, a component typed with the domain XSDBOOLEAN is not displayed if it has the value abap_false. This can also cause unwanted results.

ABAP Addition

What does it do? The transformation option technical_types controls the behavior if no type description can be serialized when serializing data references to asXML or asJSON. This is the case when the technical type properties of the dynamic type of the data reference variable are known, but the type does not have a name. Possible ValuesMeaning error Default for XSLT and only allowed there. The serialization of a data reference variable with bound dynamic type raises the exception CX_XSLT_SERIALIZATION_ERROR. ignoreOnly possible for XSLT. A data reference variable with bound dynamic type is ignored during serialization.

ABAP Addition

What does it do? The transformation option value_handling controls the tolerance of conversions when mapping elementary ABAP types. Possible ValuesMeaning defaultDefault setting; during serialization, if there is an invalid value in a field of type n, the exception CX_SY_CONVERSION_NO_NUMBER is raised. When deserializing, the exception CX_SY_CONVERSION_DATA_LOSS is raised if target fields of the types c, n, or x are too short or the exception CX_SY_CONVERSION_LOST_DECIMALS is raised if target fields of the type p have too few decimal places. moveOnly possible in serializations. Invalid values in a field of type n are copied to XML or JSON without being changed. accept_data_lossOnly possible in deserializations. If target fields of types c, n, or x are too short, surplus data for c and x is truncated to the right and surplus data for n is truncated to the left. accept_decimals_lossOnly possible in deserializations. If target fields of the type p have too few decimal places, they are rounded up to the available decimal places. reject_illegal_charactersOnly possible in deserializations. If a value to be deserialized contains characters that are not valid for the encoding of the XML or JSON data or for the current code page of AS ABAP, an exception of the type CX_SY_CONVERSION_CODEPAGE is raised. If the XML or JSON data is passed as an iXML input stream, the setting of the iXML parser overrides the encoding of the XML or JSON data.

Latest notes:The exceptions mentioned cannot be handled directly by CALL TRANSFORMATION and are packed into CX_TRANSFORMATION_ERROR or its subclasses. If a value is specified that is not supported in the specified direction however, the directly handleable exception CX_SY_TRANS_OPTION_ERROR is raised.




Example ABAP Coding
If value_handling = 'reject_illegal_characters'
is specified, for example, an exception is raised if, in the XML header of XML data in the Latin-1 character set, encoding='utf-8' is specified and the XML data contains characters other than those of the 7-bit ASCII character set.

ABAP Addition

What does it do? The transformation option xml_header controls the output of the XML header when transforming to XML and writing to a data object of type c, string, or to an internal table. Possible ValuesMeaning noNo XML header is output. without_encodingAn XML header is output without specifying the encoding. fullDefault setting; an XML header is output, specifying the encoding.



Return to menu