Ansicht
Dokumentation

ABENST_TT_READ_WRITE - ST TT READ WRITE

ABENST_TT_READ_WRITE - ST TT READ WRITE

BAL_S_LOG - Application Log: Log header data   CPI1466 during Backup  
This documentation is copyright by SAP AG.
SAP E-Book

- tt:read-write, Read or Write Variables

tt:read-write var="variable" $[type="type" $[length="len"$]
                                           $[decimals="dec"$]$]
                              $[map="..."$]
                              $[minLength$|maxLength="len"$]
                              $[xsd-type...$] />


Effect

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

tt:read var="variable" $[type="type" $[length="len"$]
                                     $[decimals="dec"$]$]
                        $[map="..."$]
                        $[minLength$|maxLength="len"$]
                        $[xsd-type...$] />

tt:write var="variable" $[map="..."$]
                         $[minLength$|maxLength="len"$]
                         $[xsd-type...$] />

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

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

Example

Serialization and Deserialization. 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:transform

  xmlns:tt="http://www.sap.com/transformation-templates">
  tt:root name="ROOT"/>
  tt:variable name="VARI"/>
  tt:template>
    tt:assign ref="ROOT" to-var="VARI"/>
    X
      tt:read-write var="VARI" type="STRING"
                                minLength="10"/>
    /X>
    tt:assign to-ref="ROOT" var="VARI"/>
  /tt:template>
/tt:transform>

The following ABAP program can call the transformation:

DATA  str TYPE string.
DATA xstr TYPE xstring.

CALL TRANSFORMATION kellerh_test
     SOURCE root = string`abcde`
     RESULT XML xstr.

cl_abap_browser=>show_xml( xml_xstring = xstr ).

CALL TRANSFORMATION kellerh_test
     SOURCE XML xstr
     RESULT root = str.

The result of the serialization is:

Xabcde     /X>

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






PERFORM Short Reference   CPI1466 during Backup  
This documentation is copyright by SAP AG.

Length: 6209 Date: 20240420 Time: 050309     sap01-206 ( 36 ms )