Purpose
Demo ZCL_XTT_DEMO_020 shows the standard table workflow. A flat internal table is exposed as component T, repeated by the template, and rendered in XLSX, DOCX, Excel XML, Word XML, or PDF.
Define the report context
Declare the repeated data as an internal-table component of the root structure:
" Document structure
BEGIN OF ts_root,
footer TYPE string,
header TYPE string,
t TYPE tt_rand_data, " internal flat table ( In template {R-T} )
date TYPE d, " 8
time TYPE t, " 6
datetime TYPE char14, " date(8) + time(6)
END OF ts_root.
TT_RAND_DATA is a standard table with the following row type:
" Random table data
BEGIN OF ts_rand_data,
group TYPE string,
caption TYPE string,
date TYPE d,
sum1 TYPE p LENGTH 13 DECIMALS 2,
sum2 TYPE p LENGTH 13 DECIMALS 2,
END OF ts_rand_data,
tt_rand_data TYPE STANDARD TABLE OF ts_rand_data WITH DEFAULT KEY,
Define the repeated range
The template contains the root marker {R-T} and field markers for the row components:

The repeated pattern may span several physical rows. XTT treats the range from the first {R-T} marker to the last marker for that block as one logical record.
Populate and merge the data
" {R-T} in the template. See GET_RANDOM_TABLE.
ls_root-t = cl_main=>get_random_table( ).
" Header and footer values
ls_root-footer = 'Footer'.
ls_root-header = 'Header'.
Result and Excel behavior
The resulting Word document contains one copy of the repeated range per table row:

In XLSX output, Excel tables and their formulas are expanded to cover the generated rows.

Use Ctrl+F3 in Excel to inspect workbook names.

Data-validation ranges are expanded automatically as well.

XTT preserves worksheet-scoped and workbook-scoped formulas, including names used for print titles.
