SAP ABAP: reading payload via IF_HTTP_EXTENSION class

The process of creating a RESTful handler in SAP is a relatively simple process.  Simply create a new class extending an interface IF_HTTP_EXTENSION and implement the HANDLE_REQUEST method.

As part of the implementation you will get access to the SERVER parameter:

server TYPE REF TO if_http_server

The URL & FORM parameters are well documented on-line but lack information on how to deal with payload that can be passed as part of the call.

To gain access to the payload information execute the following command:

server->request->get_cdata( ).

The command will return a string value of the payload data. If that information is passed as a JSON string it can be parsed in to a associated table using Z_JSON_OUT function module that can be downloaded via ZJSON saplink library.

Leave a Reply


captcha *