SAP NetWeaver AS ABAP Release 740, ©Copyright 2014 SAP AG. All rights reserved.
ABAP Keyword Documentation → ABAP − Reference → Data Interfaces and Communication Interfaces → ABAP and XML → Transformations for XML → Simple Transformations → ST - Serialization and Deserialization → ST - Flow Control → ST - Flow Control with Variables →ST - tt:switch-var, Case Distinction for Variables
Syntax
<tt:switch-var>
<tt:[s-|d-]cond-var ...
<tt:[s-|d-]cond-var ...
...
</tt:switch-var>
Effect
The statement tt:switch-var allows case distinctions in which, unlike tt:switch, you can only specify cases for data content, not for data flow. In tt:switch, a list of cases can be shown where each case is formulated syntactically by a condition for variables, a tt:cond-var subelement. Other direct subelements are not possible in tt:switch-var.
You can specify no more than one case that does not contain a check condition.
Serialization and Deserialization
Serialization and deserialization follow these rules:
Note
Unlike the general case distinction with tt:switch, the content of the cases is irrelevant.
Example
The following transformation extends the example from Conditions for Variables.
Depending on the value of the ABAP data object bound to ROOT, the serialization generates either of the following:
or
or
is created. The position of the element tt:cond-var without explicit condition within tt:switch-var is irrelevant. However, the order of the elements tt:cond-var with explicit conditions is relevant.