odataabapsap-gateway

Modify response headers in SEGW Odata service


I have an OData Service Created with SEGW. In my DPC_EXT class I want to modify the response headers.

in other words, before the entityset is returned I want to add my custom header to the response, so that the front-end can handle those custom headers.

I found only the lo_facade->get_request_header( ) method, but that didn't help me because those are the request headers.

How can I add a custom header to the HTTP response of my entityset?


Solution

  • I figured it out. One should add following code in the redefinition of entityset:

    DATA: ls_header TYPE ihttpnvp.
    ls_header-name = 'ZISM_WARN_MSG'.
    ls_header-value = iv_message.
    set_header( is_header = ls_header ).