Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 
Former Member

This blog is to illustrate following solution which might be helpful in certain scenario:

     1. Set Custom HTTP Header in sapui5

     2. Get Custom HTTP Header in Gateway

So Let's start !

1. How to set custom HTTP Header in sapui5

This is simple and can be achieved by setHeaders method of either sap.ui.model.odata.v2.ODataModel or sap.ui.model.odata.ODataModel.

Code snippet:

Able to see customer header sets in F12:


2. How to get custom HTTP Header in GW

Also simple by calling get_dp_facade of interface /iwbep/if_mgw_conv_srv_runtime.

Code snippet:


Able to see in GW code runtime:


Now we able to set HTTP custom header in UI5 and get in GW.

This is sometimes helpful when you want to pass additional data from UI to GW but found nowhere to place them.

e.g. When implement get_entity/get_stream method, few places we can put parameters. Then maybe header is a place to consider.

Hope it helps !