Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Data Interfaces and Communication Interfaces →  ABAP and XML →  Transformations for XML →  ST - Simple Transformations →  ST - Serialization and Deserialization →  ST - Reading and Writing Variables 

ST - tt:read-write, Read or Write Variables

Other versions: 7.31 | 7.40 | 7.54


<tt:read-write var="variable" [type="type" [length="len"] 
                              [xsd-type...] />


The command tt:read-write is a short form of the following two statements:

<tt:read var="variable" [type="type" [length="len"]
                        [xsd-type...] />
<tt:write var="variable" [map="..."]
                         [xsd-type...] />

Specifying tt:read-write has the same effect as the statements tt:read and tt:read specified one directly after the other.

The attribute type and the attributes length and decimals specified using this attribute are used by tt:read only. As with tt:read, the attribute length can only be specified together with type.


Serialization and Deserialization Using a Variable In serializations, the variable VARI is assigned the values of the data object bound to ROOT and is written to XML using read-write. In deserializations, the value of the variable is read from XML and assigned to the data object bound to ROOT.


  <tt:root name="ROOT"/>
  <tt:variable name="VARI"/>
    <tt:assign ref="ROOT" to-var="VARI"/>
      <tt:read-write var="VARI" type="STRING"
    <tt:assign to-ref="ROOT" var="VARI"/>

The following ABAP program can call the transformation:

DATA  str TYPE string.
DATA xstr TYPE xstring.

     SOURCE root = string`abcde`
     RESULT XML xstr.

cl_abap_browser=>show_xml( xml_xstring = xstr ).

     SOURCE XML xstr
     RESULT root = str.

The result of the serialization is:

<X>abcde     </X>

The transformation is not symmetrical, due to minLength. After deserialization, the string str has at least 10 places.