Skip to Content

ABAP TIMESTAMP to JSON format conversion

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Sep 25, 2017 at 06:09 PM

    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)"

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 22, 2017 at 06:11 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 22, 2017 at 07:04 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded