Skip to Content
author's profile photo Former Member
Former Member

Creating datetime in XML format from ABAP

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 08:23 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 08:53 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.