cancel
Showing results for 
Search instead for 
Did you mean: 

xsd date conversion

Former Member
0 Kudos

Hi,

I have a huge xml-structure (external definition) with a lot of date- and datetime fields. In the proxy the abap type is either XSDDATE_D or XSDDATETIME_Z. The interface apparantly expects the data to be in offset format (2012-11-08+02:00 for dates and 2012-11-08T13:34:00.000+02:00 for datetimes - the second one seems to be ABAP-type XSDDATETIME_OFFSET, the fist one might be XSDDATE_ISO?). So I think I need to convert the data from and to the internal ABAP format. I found a class CL_BS_SOA_CONVERT_XSDDATETIME to convert datetimes from Internal to xsd_datetime_z and to XSDDATETIME_offset. Can I somehow change the proxy to XSDDATETIMEOFFSET (XSDDATE_ISO is possible)? Or should the conversion be done in PI rather than in the Backend? Any suggestions.

Thanks and Regards,

Felix

Accepted Solutions (0)

Answers (3)

Answers (3)

LeonvNiekerk
Explorer
0 Kudos

Try class CL_GDT_CONVERSION

0 Kudos

Hi Felix,

What you need to do is to define your data type in ESR as a "Core Data Type" with "Representation Term - DateTime". After that the layout of type definition subscreen is changed. There you need to choose "Pattern". For ABAP XSDDATETIME_OFFSET choose option "Local with Offset", for ABAP XSDDATETIME_ISO use the last one "Global, Local or Local with Offset". Save and activet the  change in ESR and go back to SPROXY, when you need to regenerate the proxy object for you ESR date type. The selection field "ABAP Attributes Techn.Type" changes it's content.

IMHO the variant with ISO is more flexible since the proxy object has no pattern on itself and you wont get transformation exception in case of UTC datetime.

Hope it helps to answer this "sometime" very important topic.

Rgds

Tomas

Former Member
0 Kudos

Hi Tomas,

I was going through your response and wanted to check with you on how to get the attribute XSDDATETIME_LOCAL in the "ABAP Attributes Technical Type".

I get the XSDDATETIME_Z, XSDDATETIME_ISO , STRING attributes in the SPROXY dropdown but cannot see the XSDDATETIME_LOCAL attribute.

Appreciate your help on this.

Thanks and regards,

Atul

0 Kudos

Hi Atul,

use type XSDDATETIME_ISO and get the ABAP timestamp variable. The ProxyFramework will take care about the conversion between timezones and daylight saving. Then use ABAP command CONVERT timestamp with appropriate parameters to get date and time in local timezone.

This works for me.

Rgds

Tom

Former Member
0 Kudos

It will be easier and maintainable to do it in PI