SAP ST TT COND-VAR



Get Example source ABAP code based on a different SAP table
  


• cond-var ABAP_ST_ELEMENT

ABAP_ST - tt:cond-var, Condition for Variables

ABAP_SYNTAX
< tt:cond-var check='...'>
...
< /tt:cond-var>

What does it do?
The statement tt:cond-var allows conditional transformations for which, unlike tt:$[s-$|d-$]cond, only data content can be specified and not conditions for the data flow. The content of tt:cond-var is processed depending on a check condition. cond is the same as general conditions, with the exception that variables and values can be specified as operands, but not data nodes.
Outside of tt:switch-var, a condition check must be specified.

Serialization and Deserialization
In serializations and deserializations, the condition is checked and the content of the element tt:cond-var is only processed if the condition is met.



Latest notes:

Unlike general conditional transformations with tt:$[s-$|d-$]cond, the content of the XML input stream for tt:cond-var is irrelevant.
NON_V5_HINTS
ABAP_HINT_END

ABAP_EXAMPLE_VX5
The following transformation DEMO_ST_COND_VAR demonstrates a condition for a parameter:
TRNS DEMO_ST_COND_VAR
In tt:apply, the value of the data root ROOT is passed to the parameter PARA of the subtemplate SUB and checked there. Depending on whether the ABAP data object bound to ROOT is smaller, greater than, or equal to 100, the serialization creates either of the following: < X val='small'>... < /X>
or < X val='big'>... < /X>
is created. var(PARA) could be written in the conditions check instead of PARA.
ABAP_EXAMPLE_END