sapdev logo background
sapdev logo sapdev logo
Comments

SAP ST TT READ WRITE documentation, setup help and example usage



Return to SAP documentation index


ARTICLE

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

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

Effect
The command 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 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 .

Example
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: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:
X abcde /X
The transformation is not symmetrical , due to minLength . After deserialization, the string str has at least 10 positions.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




ST_TT_READ
ST_TT_REF




comments powered by Disqus