Metadata Does Not Populate in S/4 HANA Systems

In SAP HANA-based systems, you may encounter issues where OData metadata does not populate when the API is invoked.

Cause

This error occurs when the backend system compresses metadata responses using the Accept-Encoding header. Some versions of HANA do not handle decompression properly, causing the metadata fetch to fail.

Resolution

Use the Assign Message policy in the API Proxy to override the Accept-Encoding header.
  1. Select API proxy and click Policies.
  2. Click Edit.
  3. Select ProxyEndpoint.
  4. Select PreFlow.
  5. Under Mediation Policies, choose Assign Message.
  6. Click on the + button to add the policy.
  7. Enter the Policy Name, set the Stream as Incoming Request and click Add.
  8. Replace the existing default content in the Body section with the following policy XML, and click Update.
  9. Policy Message:
    <!-- This policy can be used to create or modify the standard HTTP request and response messages -->
    <AssignMessage async="false" continueOnError="false" enabled="true" xmlns='http://www.sap.com/apimgmt'>
     
    	<!-- Sets a new value to the existing parameter -->
    	<Set>
    		<Headers>
    		     <Header name="Accept-Encoding">gzip,deflate</Header>
    	     </Headers> 
    	</Set>
    	<IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
    	<AssignTo createNew="false" type="request"></AssignTo>
    </AssignMessage>
    
  10. Click Save.
  11. Now, the policies have been successfully defined. Proceed to deploy the API proxy to apply the changes.