Application Development and Automation 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: 
Read only

Datetime in XML format in ABAP......

Former Member
0 Likes
6,129

Hello ,

     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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,939

Hi Gouse , Try the Below Code ....

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 '.'  .

Hello ,

     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.

5 REPLIES 5
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
2,939

You will have to format the date field as required from ABAP and send to XML.

Read only

Former Member
0 Likes
2,939

Hi,

Try this code

data: lv_var(50) type c.

CONCATENATE sy-datum+0(4) '-' sy-datum+4(2) '-' sy-datum+6(2) 'T' sy-uzeit+0(2) ':' sy-uzeit+2(2) ':' sy-uzeit+4(2) '70000'     INTO  lv_var.

Read only

Former Member
0 Likes
2,939

hi ,

   

try with

CONVERT TIME STAMP TIME_STAMP TIME ZONE TZ

      INTO DATE DAT.

Thanks,

Vish

Read only

Former Member
0 Likes
2,940

Hi Gouse , Try the Below Code ....

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 '.'  .

Read only

UweFetzer_se38
Active Contributor
2,939

In NW ABAP 7.3 Ehp 1 you can find a class named CL_REST_HTTP_UTILS. The method FORMAT_HTTP_DATE creates a date/time fomat according to RFC 822 (ie. "

Sat, 29 Oct 1994 19:43:31 GMT").

And of course there is a reverse method: PARSE_HTTP_DATE