XTT - XML Template Toolkit
XTT generates business documents from native Microsoft Office or Adobe templates without OLE automation on the SAP application server.
- Start with a representative document supplied by the business.
- Open it in Excel, Word, or Adobe LiveCycle Designer and replace variable content with markers in curly braces.
- Build formulas, charts, pivot tables, styles, and print settings around those markers in the original editor.
- Call
MERGE( )from ABAP with a structure, object, table, nested table, or tree. - Deliver the result with
DOWNLOAD( ),SHOW( ), orSEND( ).
The template owns presentation. ABAP owns data and business rules. Keeping that boundary clear is the main design principle behind XTT.
| № | Demo |
|---|---|
| 010 | |
| 020 | |
| 021 | |
| 022 | |
| 030 | |
| 040 | |
| 050 | |
| 051 | |
| 052 | |
| 060 | |
| 070 | |
| 080 | |
| 090 | |
| 091 | |
| 092 | |
| 100 | |
| 110 | |
| 120 | |
| 130 | |
| 131 | |
| 140 | |
| 150 | |
| 160 |
Excel template

Code
" Template storage class
" tr OAOR -> zcl_xtt_file_oaor, external sources -> ZCL_XTT_FILE_RAW
DATA(lo_file) = NEW zcl_xtt_file_smw0( 'Z_TEMPLATE_ID.XLSX' ).
" Excel output; use ZCL_XTT_WORD_DOCX or ZCL_XTT_PDF for Word or PDF
DATA(lo_xtt) = NEW zcl_xtt_excel_xlsx( io_file = lo_file ).
" R is the root marker in the template
lo_xtt->merge( iv_block_name = 'R'
is_block = VALUE ts_root(
begda = pn-begda
endda = pn-endda
" Transmission of a table (or tree)
t = lt_alv
) ).
" Download to sap_tmp, pass a path, or display Save As
" Use SHOW( ) for in-place preview
lo_xtt->download( ).
-
Output adapters
ZCL_XTT_EXCEL_XLSX- Excel Workbook (.xlsx), Excel Macro-Enabled Workbook (.xlsm)
ZCL_XTT_EXCEL_XML- Xml Spreadsheet 2003 (.xml)
ZCL_XTT_WORD_DOCX- Word Document (.docx), Word Macro-Enabled Document (.docm)
ZCL_XTT_WORD_XML- Word XML 2003 Document (.xml), Word XML Document (.xml)
ZCL_XTT_PDF- Adobe XML Form (.xdp) -
Server-side generation without OLE
The SAP application server produces the final file. Reports can run in the background and do not require desktop Office automation or VBA macros. -
Native document templates
Presentation remains separate from ABAP code. Template authors use familiar editors, preserve the original formatting, and prepare formulas, charts, and pivot tables without generating XML manually.