2017 Nov 16 8:02 AM
Hi Experts
I am trying to Upload JSON file into SAP internal table and perform some actions on it.
I have referred already to these links:
https://blogs.sap.com/2013/01/07/abap-and-json/
https://answers.sap.com/questions/195916/complex-json-structure-to-abap.html and
https://archive.sap.com/discussions/thread/3817827
However, there is no information on how to UPLOAD a json file directly into an internal table.
Any pointers will be appreciated.
Regards
Dinesh
2017 Nov 20 7:13 AM
Hi..
Thanks for helping.. Solved the issue on own by reading character by character. In actual the json file was pretty complex and Standard SAP was taking a lot of time to deserialize.
Thanks
Hi..
Thanks for helping.. Solved the issue on own by reading character by character. In actual the json file was pretty complex and Standard SAP was taking a lot of time to deserialize.
Thanks
2017 Nov 16 4:29 PM
Hi dear.
Follow this example, if it's what I imagined.
First, you have to create a structure like your json response;
TYPES:
TY_T_NAMES TYPE TABLE OF STRING WITH EMPTY KEY,
BEGIN OF TY_ROOT,
MESSAGE TYPE STRING,
NAMES TYPE TY_T_NAMES,
END OF TY_ROOT.
DATA RESULT TYPE TY_ROOT.
DATA(_JSON) = '{' &&
'"Message":"Hello",' &&
'"Names":["John","Julie","Mark","Juan"]' &&
'}'.
After that, you can use this method to deserialize the data;
/UI2/CL_JSON=>DESERIALIZE(
EXPORTING
JSON = _JSON
CHANGING
DATA = RESULT ).
Check it


Enio,
Regards;
2017 Nov 20 7:13 AM
Hi..
Thanks for helping.. Solved the issue on own by reading character by character. In actual the json file was pretty complex and Standard SAP was taking a lot of time to deserialize.
Thanks
2017 Nov 20 8:14 AM
For complexity, I can understand, but for performance a test of custom ABAP versus kernel had shown that ABAP is slower than kernel (performance ratio was 1.7 for ABAP versus 1 for Kernel - https://wiki.scn.sap.com/wiki/display/Snippets/Performance+of+JSON+from+scratch+-+sXML+versus+ZCL_MD... )
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |