Skip to Content
0

ABAP TIMESTAMP to JSON format conversion

Sep 22, 2017 at 05:21 AM

335

avatar image

Greetings,

We're using CUAN_IMPORT_SRV OData service in order to upload invoice details into SAP Hybris Marketing. We need to convert ABAP TIMESTAMP in S/4 HANA into JSON timestamp field ("/Date(1462881866000)/").

Anyone knows how can we achieve this (with a sample code if possible)?

I looked for a solution on the internet however I couldn't find a simple explanation.

Thanks in advance

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Hakan Köse Sep 25, 2017 at 06:09 PM
0

Hi,

I got the solution from Florian Schwoebel :

"Hi Hakan,

You do not need to convert the format from YYYYMMDDHHMMSS to ‘seconds as of 01.01.1970’. You just need to perform a string manipulation from “20170412143912” to "2017-04-12T14:39:12". JSON will accept this format (all examples in the blog text are checked for correct syntax)"

Share
10 |10000 characters needed characters left characters exceeded
Johannes Voglsam
Sep 22, 2017 at 06:11 AM
0

Hello Hakan,

I found the following information in the Community:

Date and Time in SAP Gateway Foundation

One more ABAP to JSON Serializer and Deserializer

best regards,

Johannes

Share
10 |10000 characters needed characters left characters exceeded
Hakan Köse Sep 22, 2017 at 07:04 AM
0

Hi Johannes,

Thank for the reply. I checked those documents out however there's no specific date and time conversion example for my case. There should be method or sample code about TIMESTAMP to JSON date format.

Share
10 |10000 characters needed characters left characters exceeded