In an ST program, you can include another ST program trafo as follows:
<tt:include name="trafo" [templates="tmpl1 tmpl2 ..."] />
This statement makes the templates and type definitions of the included program usable in the current ST program. The ST program trafo must exist actively in the repository. Case distinction is of no importance in trafo.
The ST command tt:include can be executed in an ST program only outside of templates. By default, it includes all named templates of transformation trafoon the transformation level (an unnamed main template is not included). Make sure that no namespace conflicts occur; a transformation is not allowed to include itself.
If you specify the attribute templates, only the templates tmpl1 tmpl2 specified there and the templates called by them using tt:apply are included.
Into a transformation, only transformations can be included whose named templates are not in conflict with the existing named templates. With tt:apply you can use the included named templates as subtemplates in including templates.
The ST program below corresponds to the example from Subtemplates Without Own Data Roots, except that the subtemplate of an included ST program is used.
<tt:transform template="TEMP_MAIN"
xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="ROOT"/>
<tt:template
name="TEMP_MAIN">
<day1
tt:ref="ROOT.DAY1">
<tt:apply name="TEMP_SUB" />
</day1>
<day2
tt:ref="ROOT.DAY2">
<tt:apply name="TEMP_SUB" />
</day2>
...
</tt:template>
<tt:include name="..." />
</tt:transform>
The statement tt:include could also be placed before the main template. The included ST program can be implemented as follows:
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:template>
...
</tt:template>
<tt:template
name="TEMP_SUB">
<name>
<tt:value ref="$ref.name" />
</name>
<work>
<tt:value ref="$ref.work" />
</work>
</tt:template>
</tt:transform>