ABAP Keyword Documentation →  ABAP − Reference →  Data Interfaces and Communication Interfaces →  ABAP and XML →  Transformations for XML →  asXML - Canonical XML Representation →  asXML, Examples of Mappings → 

asXML, Mapping of Tables

The example demonstrates the mapping of internal tables.

Source Code

REPORT demo_asxml_table.

CLASS demo DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS main.
ENDCLASS.

CLASS demo IMPLEMENTATION.
  METHOD main.
    DATA: itab TYPE TABLE OF i,
          xmlstr TYPE xstring.

    DO 3 TIMES.
      APPEND sy-index TO itab.
    ENDDO.

    CALL TRANSFORMATION id
                        SOURCE table = itab
                        RESULT XML xmlstr.

    cl_demo_output=>display_xml( xmlstr ).
  ENDMETHOD.
ENDCLASS.

START-OF-SELECTION.
  demo=>main( ).

Description

Every row of the internal table itab is displayed in a subelement item of the table.