Skip to Content
Jun 28 at 10:22 AM

ABAP Class to convert JSON into internal table in SAP S/4HANA Cloud


Very often in S/4HANA Cloud ES projects, we are requested to call standard OData APIs (such as sales orders, purchase orders, etc.) within BADIs using custom ABAP code. Most of the time, it's very specific data that needs to be fetched so we pass all possible parameters via HTML so the API response brings exactly what we need using $filter, $select, and so on. However, there are situations where we need to fetch lots of data that eventually need to be converted into an internal table so we can handle the data as necessary - for instance: fetching all items from a specific sales order.

That being said, we would like to know if S/4HANA Cloud has a standard ABAP class to parse the JSON response payload into internal ABAP tables. It's really time-consuming to convert the API response payload into an internal ABAP table manually. we have been doing lots of substring operations with the response (such as "substring_after", "substring_before", etc.) to actually get where I want.

We used to have the ABAP class/ui2/cl_json=>deserialize back in the days of OnPrem but now, this is not available anymore in S/4HANA Cloud ES. More than ever, we need a standard class to handle it because APIs has never been used so often in the past.