Show TOC

AssertionsLocate this document in the navigation structure

For the assertion content of attribute data of an element tt:cond , you can specify the following assertions. The operands of the assertions can be data nodes, variables, or values.

  • Data nodes are specified in the form dnode .

  • You specify variables in the form

    var( variable )

    where variable is a variable or a parameter .

  • You specify values in the form

    value

    where value is a value specified according to the rules for ABAP values .

Asserting the Initial Value

Assertion

Meaning

initial( dnode |var( variable ))

Met if the bound ABAP data object or the variable is initial

Example

The element X is considered during a serialization only if the ABAP data object bound to ROOT is initial.

          


          


          
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
          
<tt:root name="ROOT"/>
          
<tt:template>
          
<tt:s-cond data="initial(ROOT)">
          
<X>
          
<tt:value ref="ROOT" />
          
</X>
          
</tt:s-cond>
          
</tt:template>
          
</tt:transform>
          


          


          


            

Asserting Values

These assertions are formulated in the form

dnode | var ( ) = variablevalue

or

= dnode | var ( value ) variable

The assertion is met if the value of the bound data object or the variables corresponds to the value specified in value .

Example

The element X is considered during serialization only if the ABAP data object bound to ROOT is 11.

          


          


          
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
          
<tt:root name="ROOT"/>
          
<tt:template>
          
<tt:s-cond data="ROOT=11">
          
<X>
          
<tt:value ref="ROOT" />
          
</X>
          
</tt:s-cond>
          
</tt:template>
          
</tt:transform>
          


          


            

Linking Multiple Assertions

You can specify an assertion as a list of more than one of the above assertions, separated by commas. An assertion of this type is met if all assertions in the list are met. Within the list, every data node may appear only once.

Example

The element X is considered during serialization only if the value of the ABAP data object bound to ROOT1 is initial and the value of the ABAP data object bound to ROOT2 is 22.

          


          


          
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
          
<tt:root name="ROOT1"/>
          
<tt:root name="ROOT2"/>
          
<tt:template>
          
<tt:s-cond data="initial(ROOT1),ROOT2=22">
          
<X>
          
...
          
</X>
          
</tt:s-cond>
          
</tt:template>
          
</tt:transform>