SAP NetWeaver AS ABAP Release 740, ©Copyright 2014 SAP AG. All rights reserved.
ABAP Keyword Documentation → ABAP − Reference → Data Interfaces and Communication Interfaces → ABAP and XML → Transformations for XML → Simple Transformations → ST - Examples →Simple Transformation, Internal Table
The example demonstrates the serializing of an internal table.
Source Code
REPORT demo_st_table.
CLASS demo DEFINITION.
PUBLIC SECTION.
CLASS-METHODS main.
ENDCLASS.
CLASS demo IMPLEMENTATION.
METHOD main.
DATA: BEGIN OF carrier_wa,
carrid TYPE scarr-carrid,
carrname TYPE scarr-carrname,
url TYPE scarr-url,
END OF carrier_wa,
carrier_tab LIKE TABLE OF carrier_wa,
xml type xstring,
html type string.
SELECT *
FROM scarr
INTO CORRESPONDING FIELDS OF TABLE carrier_tab.
CALL TRANSFORMATION demo_st_table
SOURCE carriers = carrier_tab
RESULT XML xml.
cl_demo_output=>write_xml( xml ).
CALL TRANSFORMATION demo_st_table
SOURCE carriers = carrier_tab
RESULT XML html
OPTIONS xml_header = 'NO'.
cl_demo_output=>write_html( html ).
cl_demo_output=>display( ).
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
demo=>main( ).
Description
An internal table, carrier_tab, is filled with data from the database table SCARR and is transformed to XML using the simple transformation DEMO_ST_TABLE. The ST program is as follows:
The transformation uses the ST statement tt:loop to serialize the other internal tables row by row. HTML tags are inserted into the XML data as literals.
The result of the transformation is first shown as an XML file and then as formatted HTML data further below.