11-20-2017 11:26 AM
Dear experts,
I want to deserialize JSON data to ABAP structures. The ERP system is SAP_BASIS 700 and the following class methods are not available:
So I am using the class cl_hrpayfr_json_deserializer which has a method DESERIALIZE that has input a variable of type string and returns a parameter of type ANY.
I want to deserialize the data to a structure and I understand that the return parameter of type ANY is a field symbol (?)
When I execute the code I get a runtime error of an unassigned field symbol although prior to calling the deserialize method I assign the target structure to the return parameter of type ANY.
Has anyone used the above method or used another method of deserializing?
Kind regards,
Konstantinos
11-20-2017 1:09 PM
No, of course you can't use a field symbol that you didn't assign first (ABAP basics).
Probably this parameter should be a complex structure data object corresponding to the input JSON (structure field names should probably be equal to the names in the JSON).
Maybe, instead of using this unreleased class cl_hrpayfr_json_deserializer (might be deleted in a future release, I don't have it in my ECC 6.0 EHP 7), you could use an open project, for instance https://github.com/cesar-sap/abap_fm_json . Of course, probably you will have to downport the code to ABAP 7.0.
11-20-2017 1:31 PM
"I want to deserialize the data to a structure and I understand that the return parameter of type ANY is a field symbol (?)"
I fear, you have to understand typing of parameters and the concept of field symbols first.
11-20-2017 1:57 PM
I do have understanding but I do not understand how else to deserialize input JSON.
11-20-2017 2:41 PM
"I do have understanding"
Then please debug to check where and why the exception occurs.