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,
          ts  TYPE utclong,
          tsp TYPE xsddatetime_z.

    dat = sy-datlo.
    tim = sy-timlo.
            TIME tim
            TIME ZONE ``
            INTO UTCLONG ts.
    tsp = cl_abap_tstmp=>utclong2tstmp_short( ts ).

    CALL TRANSFORMATION demo_st_value
      SOURCE date      = dat
             time      = tim
             datetime1 = ts
             datetime2 = tsp
      RESULT XML DATA(xml).

    cl_demo_output=>display_xml( xml ).


The transformation in question, DEMO_ST_VALUE, shows the mapping of elementary ABAP data types for date, time, and time stamp to XML and back.

<?sap.transform simple?>
  <tt:root name="DATE"/>
  <tt:root name="TIME"/>
  <tt:root name="DATETIME1"/>
  <tt:root name="DATETIME2"/>
        <tt:value ref="DATE"/>
        <tt:value ref="TIME"/>
        <tt:value ref="DATETIME1"/>
        <tt:value ref="DATETIME2"/>

Note that tsp is defined with the special type XSDDATETIME_Z from ABAP Dictionary. This type ensures that a special mapping is used for time stamps in packed numbers. This happens by default for the built-in time stamp type utclong.

The transformation is symmetrical.