Show TOC

Data Model with Metadata Locate this document in the navigation structure

The resulting source code that includes the metadata for the CDS view looks like this:

		@AbapCatalog.sqlViewName: 'ZSQL_SOIL_ADV'
		@AbapCatalog.compiler.compareFilter: true
		@AccessControl.authorizationCheck: #CHECK
		@EndUserText.label: 'Advanced List Reporting SO Items'
			
		@OData.publish: true
			
		@Search.searchable: true
			
		@UI.headerInfo: { typeName: 'Sales Order Item', typeNamePlural: 'Sales Order Items' }
			
			
		define view ZDEMO_SALES_ORDER_ITEM_ADV 	as 
		select from sepm_cds_sales_order_item       as Item 
   		{
		@UI.selectionField.position: 10
  		@UI.lineItem: { label: 'Sales Order', position: 10 }
		key Item.sales_order.sales_order_id 	   as SalesOrderID,
		key Item.so_item_pos                	   as ItemPosition, 
			
		@UI.lineItem.position: 40
		Item.sales_order.lifecycle_status 	as LifecycleStatus,
			
		@UI.lineItem.position: 90
		@UI.selectionField.position: 20
		@Search.defaultSearchElement: true
		@Search.fuzzinessThreshold: 0.7
		Item.sales_order.customer.company_name 	as CustomerName,
			
		@UI.lineItem.position: 100
		@UI.selectionField.position: 30
		@Search.defaultSearchElement: true
		Item.product.category as ProductCategory,
			
		@UI.lineItem.position: 50
		@Semantics.currencyCode: true
		@UI.hidden: true
		Item.currency_code    				as CurrencyCode, 
			
		@UI.lineItem.position: 60
		@DefaultAggregation: #SUM
		@Semantics.amount.currencyCode: 'CurrencyCode'
		Item.gross_amount     				as GrossAmount, 
			
		@UI.lineItem.position: 70
		@DefaultAggregation: #SUM
		@Semantics.amount.currencyCode: 'CurrencyCode'
		Item.net_amount       				as NetAmount 
		}
			
		

To make the CDS view ready for consumption, you have to activate the resulting OData service in the SAP Gateway hub.

The activated service is part of the Service Catalog in the SAP Gateway.
Figure 1: The activated service is part of the Service Catalog in the SAP Gateway.

More on this: Expose CDS View as an OData Service

If you finally run the new app in the SAP Fiori Launchpad, the list reporting app provides you with various search filters, followed by the result list:

Resulting UI screen of the list reporting app
Figure 2: Resulting UI screen of the list reporting app

More on this:Consume Business Data Using Fiori Smart Templates