Skip to Content
-1

How to convert internal table of type LISTZEILE into JSON or XML?

Hi Experts,

I have a requirement where in I have to expose Standard SAP reports to Gateway services.

So I have utilized INST_EXECUTE_REPORT function module and output of the above FM with 'RM06ELLB' as input is as follows:

If I display the same in Gateway, it displays as:

Is there any way that I can convert the above ZEILE fields into a formatted json or xml structure like this:

"zeile" : { "Material" : "100-120" , "Plant" : "1000" }

Regards,

Arpitha

1.png (18.0 kB)
2.png (27.5 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jun 14, 2017 at 02:23 PM
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 14, 2017 at 09:05 AM

    you can try like this:

    LV_JSON = /UI2/CL_JSON=>SERIALIZE( DATA = <TABLE_NAME> COMPRESS = ABAP_TRUE ).

    WRITE / LV_JSON.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Abhishek,

      Thank you for your quick response.

      But the above method is converting whole ZEILE line to json. I need to convert based on the fields of ZEILE.

      Regards,

      Arpitha