cancel
Showing results for 
Search instead for 
Did you mean: 

Inbound date loses a day due to timezone issues

Former Member
0 Kudos

I have an inbound "create deep entity" process that passes a date to the SAP Gateway. The target field is a date field of type "EDATU_VBAK". When it goes into the "create deep entity" process I do a " read_entry_data" method on the data. In this method it does a "transformation" statement to transform the date from RAW XML into the deep structure which accepts it. At this point the date has one day less than what was entered on the UI.

How do I get the Gateway system to treat the date correctly and process it into the correct time zone? In the attachment you can see the first line, this is how the date is passed into the Gateway (1470744000000) and it shows the date if parsed by the browser to be Wed 10th August. Once it is transformed into my deep structure in the Gateway it is Wed 9th of August. So clearly a day has been lost due to the time zone issue.

Any advice on this would be appreciated.

Note: I know this might sound rude but if you don't have the answer please don't post on this thread. In the past when I have posted questions I have had multiple people post suggestions and wild proposals that they had no idea if they worked. They simply wanted me to go and try them and see what happens. I actually am hoping someone can give me some concrete advice which can solve the problem instead of sending me on a wild goose chase.

Thanks, any good advice will be appreciated.

Regards, Martin.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

I did not get to follow this up as the issue was closed with the client so I will close this thread.

Martin.

Former Member
0 Kudos

Any suggestions for this one? Advice will be much appreciated.

Martin.

former_member184867
Active Contributor
0 Kudos

You can give a try to the following option.

Change the Edm type of the field to Edm.DateTimeOffset , this way you will receive the data   in UTC format in the data provider. Now in the Data provider you may convert and save the UTC date to your system time zone or save the UTC time as is.

Former Member
0 Kudos

Thanks Atanu, I like this. The properties of my entity are based on a dictionary structure. Can I overwrite the type in the property or is there a matching dictionary type? I will try your suggestion in the meantime.

Thanks.

Regards, Martin.

Former Member
0 Kudos

Hi Atanu,

I tried your suggestion but when I change the Edm Core Type of the property it throws an exception. I think this is because it Edm.DateTimeOffset is not compatible with the dictionary structure date type (EDATU_VBAK). So I need a corresponding dictionary type to use in my structure that can accept the DateTimeOffset type. Any advice on finding a data type like this?

Thanks.

Martin.

Former Member
0 Kudos

Hi Atanu, I found this link:

http://help.sap.com/saphelp_nw74/helpdata/de/54/a326519eff236ee10000000a445394/content.htm

It gives a great mapping for Edm types to ABAP dictionary types. Will try that.

Thanks.

Martin.

former_member184867
Active Contributor
0 Kudos

The Edm to abap mapping can be found here https://help.sap.com/saphelp_nw74/helpdata/en/54/a326519eff236ee10000000a445394/content.htm

Check for suitable data type in this link.

May be a little bit of custom coding in MPC_EXT and proper data type assignment  will solve the error ,

If you are changing the type of the property by manual coding

don't forget to change the internal type to cl_abap_typedescr=>typekind_packed and edm type to ' Edm.DateTimeOffset'.

former_member184867
Active Contributor
0 Kudos

yes that's the link, it seems you found it while I was typing