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 → asXML - Canonical XML Representation → asXML, Examples of Mappings →asXML, Mapping of Elementary Data Types
The example demonstrates the mapping of elementary data types.
Source Code
REPORT demo_asxml_elementary.
CLASS demo DEFINITION.
PUBLIC SECTION.
CLASS-METHODS main.
ENDCLASS.
CLASS demo IMPLEMENTATION.
METHOD main.
DATA: num TYPE i VALUE 20,
dat TYPE d VALUE '20060627',
xmlstr TYPE xstring.
CALL TRANSFORMATION id
SOURCE number = num
date = dat
RESULT XML xmlstr.
cl_demo_output=>display_xml( xmlstr ).
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
demo=>main( ).
Description
In the statement CALL TRANSFORMATION, the data objects num and dat are bound to the XML elements number and date. The values subelement contains these elements. The content of these elements is determined by mapping the bound elementary ABAP data objects.