Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Data Interfaces and Communication Interfaces →  ABAP and XML →  Transformations for XML →  ST - Simple Transformations →  ST - Serialization and Deserialization →  ST - Flow Control 

ST - tt:group, Grouping

Other versions: 7.31 | 7.40 | 7.54


  <tt:[s-|d-]cond [frq="..."] ...
  <tt:[s-|d-]cond [frq="..."] ...


In deserializations, variable inbound XML streams containing groups of related elements in any order can be responded to using the statement tt:group. Hereby, a list of cases is specified in tt:group, where the syntax of each case is formulated by a conditional transformation, namely a subelement tt:[s-|d-]cond. In this case, tt:[s-]cond defines a serialization-relevant case, and tt:[d-]cond a deserialization-relevant case. Other direct subelements are not possible in tt:group. The statement tt:group can be a subelement of tt:[s-|d-]cond.

In contrast to conditional transformations positioned outside of tt:group, there is no need to specify at least one attribute using, data or check for a case, provided that the content of tt:[s-|d-]cond is not a pattern.

In the list of cases, the following must be noted:

  • Any number of serialization-relevant cases can be specified in which no attribute using, data, or check is specified.
  • Only one deserialization-relevant case that does not contain a pattern can be specified. This case is called standard deserialization.

To control how often a deserialization-relevant case must or can be executed in deserializations, tt:[d-]cond within tt:group can contain the additional attribute frq (frequency) with one of three allowed values:

  • </tt:[d-]cond ... frq="1" >
Required case. The case must be executed exactly once while the group is processed.
  • </tt:[d-]cond ... frq="?" >
Optional case. The case is executed up to once while the group is processed.
  • </tt:[d-]cond ... frq="*" >
Multiple case. The case can be executed any number of times while the group is processed.

For frq="?" and frq="*", the expected element must not necessarily exist in the inbound XML stream.

Implicit frequency: If the attribute frq is not specified explicitly,

  • frq="1" is used implicitly in tt:cond cases that do not contain data conditions (that must be executed in serializations).
  • frq="?" is used implicitly in tt:cond cases that contain a data condition (that need not be executed in serializations).


In serializations, the element tt:group is executed once as follows: All serialization-relevant cases with a met prerequisite or no prerequisite using, data, or check are executed in the given order.


In deserializations, the element tt:group initiates a loop. The system tries to select every required case (frequency 1) once. As soon as this happens, the loop ends. Until then, optional cases (frequency ?, up to once) and multiple cases (frequency *, also multiple) can also be selected. In every loop pass, one of the deserialization-relevant cases whose maximum case frequency has not yet been reached is selected as follows:

  • The first case that contains a suitable pattern is executed (deserialization and assertions met).
  • If no such case exists, the system tries to execute the standard deserialization, if it exists. If the possible prerequisites using, data, or check of the standard deserialization are not met, the exception CX_ST_REF_ACCESS is raised.
  • If no standard deserialization exists, the exception CX_ST_GROUP_MISSING_CASE is raised.

  • Example

    The following transformation shows how groupings work:

      <tt:root name="ROOT1"/>
      <tt:root name="ROOT2"/>
      <tt:root name="ROOT3"/>
      <tt:root name="ROOT4"/>
                <tt:value ref="ROOT3"/>
            <tt:cond frq="?">
                <tt:value ref="ROOT2"/>
            <tt:cond frq="*">
                <tt:value ref="ROOT1"/>
              <tt:skip count="1"/>
            <tt:value ref="ROOT4"/>

    Assume that an inbound XML stream has the following form:


    The deserialization proceeds as follows:

  • In the first loop pass, element X1 is used and the first element X1 deserialized; ROOT1 is set to 1.
  • In the second loop pass, element X1 is used again because of condition tt:cond frq="*" and the second element X1 deserialized; ROOT1 is set to 2.
  • In the third loop pass, element X2 is used and the first element X2 deserialized; ROOT2 is set to 3.
  • In the fourth loop pass, element X2 cannot be used again because of condition tt:cond frq="?". Instead, the second element X2 is skipped in the standard deserialization with tt:skip. Specifying count is necessary because otherwise all subsequent elements would be skipped.
  • In the fifth loop pass, element X3 is used and the first element X3 deserialized; ROOT3 is set to 5.
  • All required cases of the group have been selected, so the loop ends. The element X4 is deserialized outside of tt:group and ROOT4 is set to 6.