Show TOC

 Creating a Transformation ProgramLocate this document in the navigation structure

Use

A transformation program, like any other ABAP program, is a repository object that is assigned to a package, a change and a transport request. In a transformation program, you implement the transformation rules using the following programming languages:

  • XSLT (and its additional statements)
  • Simple Transformations.
Procedure
  1. In the Object Navigator (transaction SE80), choose the package you need.
  2. In the context menu, choose Create → Other (1)   → Transformation.

    The Create Transformation Program dialog box appears.

  3. Enter a name and short description for the new transformation program.
  4. Choose between an XSLT transformation and a Simple Transformation.
  5. Choose Continue.
    Note

    To generate a runtime version of the transformation program, choose Transformation → Activate.

Result

The system creates a transformation program as a repository object and includes it in the object list under Transformations.

Tip

If you have created an XSLT transformation, the following content is generated:

<xsl:transform version="1.0"

 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

 xmlns:sap="http://www.sap.com/sapxsl"

>

<xsl:strip-space elements="*"/>

<xsl:template match="/">

</xsl:template>

</xsl:transform>

Standard Source Code and Program Structure of an XSLT Transformation Program

Source Code Description

<xsl:transform version="1.0"

Specifies the XSL version. Each XSLT program should support version 1.0.

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

Declares the namespace for the XSL standard. Each valid XSLT program should support this standard.

xmlns:sap="http://www.sap.com/sapxsl"

Declares the SAP namespace extension necessary for ABAP calls.

<xsl:strip-space elements="*"/>

For better performance, the space elements (spaces, tabulator, return, and so on) are excluded from all elements of the document tree at runtime. This line is particularly important for representing data structures.

Insert your source code with global elements (like parameters) here.

<xsl:template match="/">

Defines the beginning of the XSL template and associates the template with the root of the XML document.

Define one ore more templates for transformation rules here.

</xsl:template>

Defines the end of the XSL template.

</xsl:transform>

Defines the end of the XSLT program.

Tip

If you have created a Simple Transformation, the following content is generated:

<?sap.transform simple?>

<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">

<tt:root name="ROOT"/>

<tt:template>

</tt:template>

</tt:transform>

Standard Source Code and Program Structure of a Simple Transformation Program

Source Code Description

<?sap.transform simple?>

Defines the type of the source code. You do not need to edit this line manually, it is automatically generated during checking or activating.

<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">

Top-level element for a Simple Transformation with namespace declaration.

<tt:root name="ROOT"/>

Declaration of an ABAP root node. Here you can declare any number of root nodes (one is the minimum). The name ROOT is only an example.

<tt:template>

Defines the beginning of the template.

Here you can define your transformation.

</tt:template>

Defines the end of the template.

For modularization purposes, here you can define any number of additional templates.

</tt:transform>

Defines the end of the Simple Transformation program.

Note

For more information, see Simple Transformations .

In both cases, this standard source text is the starting point for your own implementation of the transformation rules.

See also:

SAP XSLT Processor Reference

Testing a Transformation Program