Purpose
Demo ZCL_XTT_DEMO_022 covers both fixed merged ranges and data-driven merging. It uses flight-model data to show how repeated values can be merged without calculating the final range in ABAP.
Static merged ranges
When the range is known in advance, merge it directly in the template.
Cells B3:H3 & B5:F5

Generated result:

Merged ranges may be horizontal or vertical.
Cells B2 & E2

Result

Dynamic merging with ;merge=X
Use ;merge=X when the range grows with the generated data and its final size is not known at design time.

With normal row-oriented output, XTT merges vertically across generated rows. With ;direction=column, it merges horizontally across generated columns.
Merge rule
Only adjacent cells with equal values are merged.
In cell D10 of the report (D3 in the template), func=FIRST copies a value from level=2 to level=1. The value is not merged because that marker lacks ;merge=X; the adjacent column C includes it.

Inspect the generated values first when a merge is unexpected. Equal values and the directive must both be present.

For the hierarchy used by this example, see grouped trees.