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

convert XML string into an abap format date and time

Former Member
0 Likes
1,934

Hi,

Does anyone know of a method or a function module in ABAP which converts XML string into an abap format date and time.

Here is a part of the xml that I want to convert.

<ns2:EventDateTime>2009-07-02T10:13:45+10:00</ns2:EventDateTime>

<ns2:EventMessageTransmissionDateTime>2009-07-02T10:13:45.987+10:00</ns2:EventMessageTransmissionDateTime>

Currently EventDateTime and EventMessageTransmissionDateTime are type XSDDATETIME_Z and these are converted to proper dates and times. We will be changing these fields to a STRING instead of XSDDATETIME_Z. The reason for this is to make the field more versatile. The customer would be receiving dates with Zulu (2009-09-23T12:00:00Z), with offsets (2009-09-23T12:00:00+10:00/-10:00) and just local timestamp (2009-09-23T12:00:00). With this, we need to make the date fields as string

to be able to accept the various date formats (esp. the local timestamp).

I am looking for a standard function module or method that will convert the xml string to a proper date and time abap format.

Would appreciate anyone's help!

Thanks.

Edited by: eunice ocson on Jul 13, 2009 1:49 AM

Edited by: eunice ocson on Jul 13, 2009 1:50 AM

Edited by: eunice ocson on Jul 13, 2009 1:51 AM

Edited by: eunice ocson on Jul 13, 2009 1:51 AM

Hi,

Does anyone know of a method or a function module in ABAP which converts XML string into an abap format date and time.

Here is a part of the xml that I want to convert.

<ns2:EventDateTime>2009-07-02T10:13:45+10:00</ns2:EventDateTime>

<ns2:EventMessageTransmissionDateTime>2009-07-02T10:13:45.987+10:00</ns2:EventMessageTransmissionDateTime>

Currently EventDateTime and EventMessageTransmissionDateTime are type XSDDATETIME_Z and these are converted to proper dates and times. We will be changing these fields to a STRING instead of XSDDATETIME_Z. The reason for this is to make the field more versatile. The customer would be receiving dates with Zulu (2009-09-23T12:00:00Z), with offsets (2009-09-23T12:00:00+10:00/-10:00) and just local timestamp (2009-09-23T12:00:00). With this, we need to make the date fields as string

to be able to accept the various date formats (esp. the local timestamp).

I am looking for a standard function module or method that will convert the xml string to a proper date and time abap format.

Would appreciate anyone's help!

Thanks.

Edited by: eunice ocson on Jul 13, 2009 1:49 AM

Edited by: eunice ocson on Jul 13, 2009 1:50 AM

Edited by: eunice ocson on Jul 13, 2009 1:51 AM

Edited by: eunice ocson on Jul 13, 2009 1:51 AM

5 REPLIES 5
Read only

venkat_o
Active Contributor
0 Likes
887

Hi Ocson,

Check TEXT_CONVERT_XML_TO_SAP function module.

Thanks

Venkat.O

Read only

Former Member
0 Likes
887

Hi Venkat,

Unfortunately that FM does not exist.

Regards,

Eunice

Read only

Former Member
0 Likes
887

Hi Eunice

Use the FM 'SMUM_XML_PARSE'

for more info

[Convert XML string to ABAP|]

hope it helps you.

Thanks!!

Read only

0 Likes
887

Hi Prasanth,

The thing is I already have it as a string. It could either be like this 2009-01-13T15:33:20 or this 2009-01-13T15:33:20Z. What I'm looking for is a method/FM that could translate that automatically into a date and time. If there's an existing smarts in SAP that I could use to convert that to a proper abap format timestamp.

Regards,

Eunice

Read only

0 Likes
887

Check if [this help you..|http://www.sapfans.com/forums/viewtopic.php?f=13&t=329376]