Simple Transformations are SAP programs which are used to convert ABAP data to XML and XML to ABAP data.They are like any other ABAP program and are managed through transport organizer.
Creating a Simple transformation
Simple transformations can be created with SE80 – ABAP Development workbench tcode. Select package and the right click on the transformation in the available objects list Name. Click on Create option.
Upon clicking, the creation dialog box appears as below. Enter the required information and press ok to create the Simple Transformation.
How to call a simple transformation in our custom program
They are defined with the key word – TRANSFORMATION in ABAP environment and can be called by the below statement,
Scenario Explaining more about simple transformation
The following scenario will give an idea about conversion of XML data into ABAP data, which is further written as an report output.
Say the XML input to the transformation would be as like below.
As shown below, we can use the transformation in our report program to convert XML data to ABAP data. The simple transformation Z_TEST_STRANS42, with below coding is applicable to do the above said functionality.
Inside the transformation, the template is mapped to the header tag and the line item details are read sequentially into the respective fields of the internal table. In our example, it is <teamMember> which is holding the line item details.
Input XML File to the transformation:
We can view how the transformation works in debugger mode via the transaction XSLT.
For our example, Lets execute our transformation on debugger mode in XSLT transaction.
As said earlier, first the template name as specified in the transformation coding is mapped with the incoming XML string. In our example it is ‘teamMember’.
Next, it prepares to read the first tag value inside the template. In our case it is ’Name’ tag.
Likewise, it completes reading all the tag values and populates them in the corresponding fields of the internal table GT_PROFILE.
Upon execution of the transformation, the results are mapped into the internal table fields as shown below.
Below is the output of the report, as written from the internal table.