Skip to Content
-1

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

Jun 14, 2017 at 08:06 AM

101

avatar image

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)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Uwe Fetzer Jun 14, 2017 at 02:23 PM
1
Share
10 |10000 characters needed characters left characters exceeded
Abhishek Gupta Jun 14, 2017 at 09:05 AM
0

you can try like this:

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

WRITE / LV_JSON.

Show 1 Share
10 |10000 characters needed characters left 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

0