Skip to Content

JSON data fetching and populating in internal table in SAP

Hi Team,

I have a requirement where in I want to feed data from JSON file into SAP. JSON contains a number of arrays or entities with different fields.

For eg: [ "A" { "AF1" : "AV1" , "AF2": "AV2"} , "B" { "BF1" : "BV1" , "BF2" : "BV2" , "BF3" : "BV3"} , C... and so on.

I now want to read all these data for A, B, C.. and enter it into SAP. I created a deep structure having A,B,C as structures which in turn contains all the fields. Now, how do I add all these data into the internal table? Also, there are multiple values of A, B ,C like after C we again have another set of data A.B,C and so on.

I tried with some logic by checking characters and then for brackets and accordingly adding data. But I facing many issues.

It would of great help if you all can help me with the pointers on how to achieve this.

Thank you.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Oct 27, 2015 at 06:17 AM


    You get a JSON file on the app server which you have to read and get the data into the deep structure ? May be if possible you can attach the screenshot of the file so that we can see how the data is in the file.


    Add comment
    10|10000 characters needed characters exceeded

    • Hi Kiran,

      I tried building my code as per this URL . Very trusting JSON to (deep) ABAP data structure mapper · GitHub

      However, it is working only for one structure as it holds only one string. I tried to append the data after one complete iteration but am not able to. The actual parameter used is a structure, while formal parameter passed is of type any. This parameter contains the entire data after first iteration , but since it is of type any, I am not able to assign or append or move it to my structure or work area.

      ( Line 130 - 139 .. if you would refer. )

  • Oct 27, 2015 at 07:17 AM

    Hi Dharmin,

    Try to use this class /IWCOR/CL_DS_EP_READER_JSON.

    thanking you


    Add comment
    10|10000 characters needed characters exceeded

  • Oct 27, 2015 at 01:07 PM

    Search for, How to 'Deserialize JSON to ABAP'.. Use the following class.. CL_TREX_JSON_SERIALIZER

    Add comment
    10|10000 characters needed characters exceeded