In this recipe, we will see how we can create transformations for dictionary table types. We will first create a table type using SE11
and then generate its transformation using the graphical tool editor of the transaction XSLT_TOOL
.
We will create a table type, ZST6_TT_PER
, that will comprise of employee number, PERNR, employee name, NAME, and grade field, GRADE.
We will now carry out the following steps:
SE11
. We will first create a line type by the name of ZST6_ST_PER. Enter the name in the Data Type field. Then, click on the Create button and choose the Structure option in the dialog box that appears.SE11
. We give it the name ZST_TT_PER
. We make sure that the line type defined earlier is used as the line type for the table type.XSLT_TOOL
. Create a simple transformation.MYTAB
and ZST_TT_PER
in the Root-Name and Type-Name fields respectively. (Alternatively, we may enter the line type created earlier, that is, ZST6_ST_PER
, in the Type-Name field and check the Line Type? indicator). Then, press Enter.We first declared a line type and then created a table type. We then created a new simple transformation. We then inserted a root element named MYTAB
based on the dictionary type ZST6_TT_PER
defined earlier. Drag-and-drop added the table MYTAB
to Transformation
and also included all the components, PERNR
, NAME
, and GRADE
. The generated code of the transformation is shown in the following screenshot:
In the template, a loop is run on each line of the table MYTAB. The contents of the fields PERNR, NAME, and GRADE are written within the XML text element ZT6_ST_PER (based on the name of the line type). The completed graphical form of the transformation is shown in the following screenshot:
The transformation may then be called in programs using the statement CALL TRANSFORMATION
.
18.216.27.251