Show TOC

Field HidingLocate this document in the navigation structure

Get information about what UI annotations to use hide fields from SAP Fiori UIs.

Generally, all fields that are exposed by the OData service are available to the client, regardless if the fields are exposed explicitly using UI annotations. To enable end-user personalization, the client may offer the possibility to add fields that are hidden by default, for example to a list report.

You can use the following annotation to prevent fields from being displayed on a UI and in the personalization dialog, but leaving the field available for client:
  • @UI.hidden

    You can use this annotation if, for example, a CDS view contains technical keys, for example GUIDs, that have to be exposed to the OData service to work. These keys are usually not supposed to be displayed on the UI. You can also use this annotation if fields are required in calculations, but are not supposed to be displayed on a UI.

    Example In the following example, the annotation @UI.dataPoint with pre-calculated criticality and trend is exposed. The hidden fields AmountCriticality and AmountTrend are required by the client to calculate the corresponding values, but are not supposed to be displayed on the UI.
    Sample Code
    ...
    define view ZExample_SalesOrdersByCustomer as select from ... as so {  
      @UI.hidden
      key so.buyer_guid as BuyerGuid,
      ...
      
      @UI.dataPoint: {
        criticality: 'AmountCriticality',  	-- Reference to element
        trend: 'AmountTrend',        		-- Reference to element
      }
      so.actual_amount as ActualAmount,
    
      @UI.hidden
      so.criticality as AmountCriticality,   
    
      @UI.hidden
      so.trend as AmountTrend
    }
    
You can use the following annotation to prevent fields from being available to a client:
  • @Consumption.hidden

    Preventing fields from being available to a client is necessary for system parameters. These parameters are filled by the runtime engine, but must not be available to the client.

    Sample Code
    ...
    define view OverdueSalesOrder with parameters 
      @Consumption.hidden : true
      @Environment.systemField : #SYSTEM_DATE
      P_Date : sydate,
    as select from ...
    {
      ...
    }
    

    For more information about consumption annotations, see section Consumption Annotations linked below.

Example In the following example, the field buyer_guid is required by the association to _BusinessPartner only. This means, the field must be included in the element list of the CDS view, but must not be transferred to the client.
Sample Code
...
define view ZExample_SalesOrder as select from sepm_cds_sales_order as so
  association [0..1] to sepm_cds_business_partner as _BusinessPartner 
  on $projection.buyer_guid = _BusinessPartner.business_partner_key
{
  key so.sales_order_id as SalesOrder,

  @Consumption.hidden: true
  so.buyer_guid,

  ...
  _BusinessPartner  
}

There may be cases, where a field is needed in the client, for example for calculations, but should not be displayed directly in a list or table, or on an object-page floorplan. In this case the annotation @Consumption.hidden is not suitable.