Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Data Interfaces and Communication Interfaces →  ABAP and XML →  Transformations for XML →  ST - Simple Transformations →  ST - Serialization and Deserialization →  ST - Transformation of ABAP Values →  ST - tt:value, Elementary Data Objects 

Simple Transformation, tt:value

Serializes and deserializes elementary data objects

Other versions: 7.31 | 7.40 | 7.54

Source Code

    DATA: dat         TYPE d,
          tim         TYPE t,
          time_stamp  TYPE xsddatetime_z.

    dat = sy-datlo.
    tim = sy-timlo.
    CONVERT DATE dat TIME tim INTO TIME STAMP time_stamp TIME ZONE ``.

    CALL TRANSFORMATION demo_st_value
      SOURCE date = dat
             time = tim
             datetime = time_stamp
      RESULT XML data(xml).

    cl_demo_output=>display_xml( xml ).

Description

Note that time_stamp is defined with the special type XSDDATETIME_Z from ABAP Dictionary. This type ensures that a special mapping is used for the time stamp. The transformation in question, DEMO_ST_VALUE, shows the mapping of elementary ABAP data types for date, time, and classic time stamp to XML and back.

<?sap.transform simple?>
<tt:transform
  xmlns:tt="http://www.sap.com/transformation-templates">
  <tt:root name="DATE"/>
  <tt:root name="TIME"/>
  <tt:root name="DATETIME"/>
  <tt:template>
    <Date_and_Time>
      <Date>
        <tt:value ref="DATE"/>
      </Date>
      <Time>
        <tt:value ref="TIME"/>
      </Time>
      <DateTime>
        <tt:value ref="DATETIME"/>
      </DateTime>
    </Date_and_Time>
  </tt:template>
</tt:transform>

The transformation is symmetrical.