06-10-2008 7:27 AM
Hi experts,
Can any one tell what is call transformation used for and all also the use of 'id' given in the syntax below.
CALL TRANSFORMATION id
SOURCE (Internal table)
RESULT (XML string )
Thanks®ards,
Karthik.
06-10-2008 8:25 AM
Form SAP Help:
Simple Transformations
Simple Transformations (ST) is an SAP programming language for describing transformations between ABAP data and XML formats. ST is restricted to the two modes of serialization (ABAP to XML) and deserialization (XML to ABAP) of ABAP data, which are most important for data integration. Transformations from ABAP to ABAP and XML to XML, like in the more general XSLT are not possible in ST.
In comparison with XSLT, the main advantages of ST programs are as follows:
ST programs are declarative and thus easier to read
ST programs only have serial access to the XML data and are therefore very efficient even with large data volumes
ST programs describe serialization and deserialization simultaneously - that is, ABAP data serialized in XML with ST can also be deserialized with the same ST program.
Simple transformations that can be called using CALL TRANSFORMATION must be in the repository. ST programs can be edited using the Transformation Editor. This is called up either with transaction STRANS or by choosing Edit Object u2192 More u2192 Transformation followed by Simple Transformation in the ABAP Workbench object navigator
More information on Simple Transformations is available in the Knowledge Warehouse.
Example (from help also )
Simple Transformation Example
Serialization of a nested structure. In the following ABAP program section, a nested structure struc1 is serialized to xml_string with the Simple Transformation st_trafo and deserialized with the same transformation.
DATA: BEGIN OF struc1,
col1 TYPE c LENGTH 10 VALUE 'ABCDEFGHIJ',
col2 TYPE i VALUE 111,
BEGIN OF struc2,
col1 TYPE d VALUE '20040126',
col2 TYPE t VALUE '084000',
END OF struc2,
END OF struc1.
DATA: xml_string TYPE string,
result LIKE struc1.
TRY.
CALL TRANSFORMATION st_trafo
SOURCE para = struc1
RESULT XML xml_string.
...
CALL TRANSFORMATION st_trafo
SOURCE XML xml_string
RESULT para = result.
CATCH cx_st_error.
...
ENDTRY.
The Simple Transformation st_trafo has the following form:
<tt:transform template="temp"
xmlns:tt="http://www.sap.com/transformation-templates"
version="0.1">
<tt:root name="PARA"/>
<tt:template name="temp">
<X>
<X1>
<tt:value ref="PARA.COL1" />
<X2>
<tt:value ref="PARA.COL2" />
<X3>
<X1>
<tt:value ref="PARA.STRUC2.COL1" />
<X2>
<tt:value ref="PARA.STRUC2.COL2" />
</X>
The transformation consists of a Template temp that defines the structure of the XML document and establishes relationships between value nodes and components of the structure. The result of the transformation is as follows (line breaks and indentations were inserted for clarification purposes):
<X>
<X1>ABCDEFGHIJ
<X2>111
<X3>
<X1>2004-01-26
<X2>08:40:00
</X>
The conversion of elementary data types is the same as for asXML. The reverse transformation generates the same content in the structure result as in struc1.
Good luck.