Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Creating datetime in XML format from ABAP

Former Member
0 Kudos

Hello All:

I have a ABAP program that creates an XML file and everything is fine. I just need one date field in XML to conform to W3CC standard (EX: 2006-12-01T10:53:05.2170000). I need datetime in the format "2006-12-01T10:53:05.2170000". How do I acheive this in ABAP?

Thanks.

Mithun

1 ACCEPTED SOLUTION

Former Member
0 Kudos

That seems to be easy:


DATA:
  lv_timestamp  TYPE timestampl,
  lv_xml_date   TYPE string.

GET TIME STAMP FIELD lv_timestamp.

CONCATENATE lv_timestamp+0(4)
            lv_timestamp+4(2)
            lv_timestamp+6(2)
  INTO lv_xml_date
  SEPARATED BY '-'.

CONCATENATE lv_xml_date
            'T'
  INTO lv_xml_date.

CONCATENATE lv_timestamp+8(2)
            lv_timestamp+10(2)
            lv_timestamp+12(2)
  INTO lv_xml_date+12(8)
  SEPARATED by ':'.

CONCATENATE lv_xml_date
            lv_timestamp+5(7)
  INTO lv_timestamp
  SEPARATED BY '.'.

Reward points, if reply is applicable

Edited by: Mike Schernbeck on Jan 30, 2008 9:24 PM

3 REPLIES 3

Former Member
0 Kudos

That seems to be easy:


DATA:
  lv_timestamp  TYPE timestampl,
  lv_xml_date   TYPE string.

GET TIME STAMP FIELD lv_timestamp.

CONCATENATE lv_timestamp+0(4)
            lv_timestamp+4(2)
            lv_timestamp+6(2)
  INTO lv_xml_date
  SEPARATED BY '-'.

CONCATENATE lv_xml_date
            'T'
  INTO lv_xml_date.

CONCATENATE lv_timestamp+8(2)
            lv_timestamp+10(2)
            lv_timestamp+12(2)
  INTO lv_xml_date+12(8)
  SEPARATED by ':'.

CONCATENATE lv_xml_date
            lv_timestamp+5(7)
  INTO lv_timestamp
  SEPARATED BY '.'.

Reward points, if reply is applicable

Edited by: Mike Schernbeck on Jan 30, 2008 9:24 PM

Former Member
0 Kudos

Thanks Mike. I rewarded full points. One more question. Is there a FM to get Greenwich standard time applicable to your time zone?

Thanks.

Mithun

0 Kudos

Perhaps, one of these fits your need:

MA_CNV_TIMESTAMP_IN_GMTTSTAMP

MA_CNV_TSTAMP_IN_GMTDATETIME