- Design / Prototype
- Create Dictionary Objects
- Create Interface View (CDS)
- Business Object Generation (CDS – Object Model Annotations )
- Generated Business Object
- BOPF – Development
- Test BOPF Object using BOBT
- Access Control (CDS)
- Consumption View (CDS)
- OData Service Generation and Registration
- Test OData Service using SAP Gateway Client
- UI development
In order to consume CDS in OData Services and User Interface development, we have to create a consumption-based CDS view on top or Basic or Interface view.
Note: You can create the Header and Item Node with then implement the association with each other in each node. Later you can code all the annotation as required.
Header Node
Highlights
- VDM.viewType is Consumption
- Mark the CDS view as consumption based
- ObjectModel.transactionalProcessingDelegated is true
- Specifies that Transactional Processing is delegated to the associated transactional view
- UI.presentationVariant
- Set the features for List Page
- UI.headerInfo
- Update the info for entity
- Like Plural Description will be displayed on the list
- Title and Type will be displayed on the navigation to Object page
- UI.facet
- Collection of different UI elements, help to design Object Page Header and Detail view
- UI.lineitem
- Set the entity attribute feature and behaviour in Line Item
- Search
- Helps to mark default search and another search to displayed as part of Standard Layout on List Page
For more detail refer the link at the bottom of this page
@AbapCatalog.sqlViewName : 'Z2812CHEADND'
@AbapCatalog.compiler.compareFilter : true
@AbapCatalog.preserveKey : true
@AccessControl.authorizationCheck : #CHECK
@AccessControl.personalData.blocking: #REQUIRED
@EndUserText.label : 'Phone Book Header Consumption - Node View'
@VDM.viewType : #CONSUMPTION
@Search.searchable : true
@Metadata.allowExtensions : true
@ClientHandling: {
algorithm : #SESSION_VARIABLE,
type : #CLIENT_DEPENDENT
}
-- Business Object Model
@ObjectModel:{
compositionRoot : true,
transactionalProcessingDelegated : true,
createEnabled : true,
updateEnabled : true,
deleteEnabled : true,
draftEnabled : true,
semanticKey : ['pb_head_uuid'],
usageType: {
serviceQuality : #D,
sizeCategory : #L,
dataClass : #TRANSACTIONAL
}
}
-- Presentation Variant for UI
@UI.presentationVariant: [{
sortOrder: [{
by : 'pb_id',
direction : #DESC
}],
groupBy : ['pb_id'],
requestAtLeast : ['pb_id', 'pb_owner',
'pb_first_name', 'pb_last_name', 'pb_full_name',
'pb_email_id', 'pb_created_at','pb_changed_at']
}]
-- Header Info
@UI.headerInfo: {
typeName : 'Contact',
typeNamePlural : 'Contacts',
title.value : 'pb_id',
description.value : 'pb_full_name'
}
define view Z2812_C_PB_HEAD_ND as select from Z2812_I_PB_HEAD_ND as headData
-- Associtaion to Item Data
association[0..*] to Z2812_C_PB_ITEM_ND as _itemData on $projection.pb_head_uuid = _itemData.pb_head_uuid
{
-- Header & Item Facets
@UI.facet: [
-- Header Presentation on Object Page
{
purpose: #HEADER,
position: 10,
importance: #HIGH ,
type: #FIELDGROUP_REFERENCE,
targetQualifier: 'nameInfo'
},
{
purpose: #HEADER,
position: 20,
importance: #HIGH ,
type: #DATAPOINT_REFERENCE,
targetQualifier: 'pb_email_id'
},
-- Detail Presentation of Object Page
{
purpose: #STANDARD,
id: 'DetailInformation',
importance: #HIGH,
type: #COLLECTION,
position: 10
},
{
purpose: #STANDARD,
label:'i18n>generalInfo',
importance: #HIGH,
type: #IDENTIFICATION_REFERENCE,
parentId: 'DetailInformation',
position: 10,
targetQualifier: 'generalInfo'
},
{
purpose: #STANDARD,
label:'i18n>contactInfo',
importance: #HIGH,
type: #FIELDGROUP_REFERENCE,
parentId: 'DetailInformation',
position: 20,
targetQualifier: 'contactInfo'
},
{
purpose: #STANDARD,
label:'i18n>adminInfo',
importance: #HIGH,
type: #FIELDGROUP_REFERENCE,
parentId: 'DetailInformation',
position: 30,
targetQualifier: 'adminInfo'
}
]
//headData
@UI.hidden: true
key pb_head_uuid,
-- Phone Book ID
@Search: {
defaultSearchElement: true,
ranking: #HIGH,
fuzzinessThreshold: 0.8
}
@UI.lineItem: [{position: 10}]
@UI.identification: [{position: 10}]
pb_id,
-- Owner
@UI.hidden: true
pb_owner,
-- First Name
@Search: {
ranking: #HIGH,
fuzzinessThreshold: 0.6
}
@UI.fieldGroup:[{
qualifier: 'nameInfo',
position: 10,
importance: #HIGH
},
{
qualifier: 'contactInfo',
groupLabel: 'i18n>contactInfo',
position: 10,
importance: #HIGH
}]
pb_first_name,
-- Last Name
@Search: {
ranking: #HIGH,
fuzzinessThreshold: 0.6
}
@UI.fieldGroup:[{
qualifier: 'nameInfo',
position: 20,
importance: #HIGH
},
{
qualifier: 'contactInfo',
position: 20,
importance: #HIGH
}]
pb_last_name,
-- Full Name
@UI.lineItem: [{label: '{i18n>fullName}',
position: 20}]
@ObjectModel.readOnly: true
pb_full_name,
-- E-Mail ID
@UI.fieldGroup:[
{
qualifier: 'contactInfo',
position: 30,
importance: #HIGH
}]
@UI.dataPoint.targetValueElement: 'pb_email_id'
@UI.lineItem: [{position: 30}]
pb_email_id,
-- Creation Timestamp
@ObjectModel.readOnly: true
@Semantics.systemDateTime.createdAt: true
@UI.lineItem: [{position: 40}]
@UI.fieldGroup:[{
qualifier: 'adminInfo',
groupLabel: 'i18n>adminInfo',
position: 10,
importance: #HIGH
}]
pb_created_at,
-- Change Timestamp
@ObjectModel.readOnly: true
@Semantics.systemDateTime.lastChangedAt: true
@UI.lineItem: [{position: 50}]
@UI.fieldGroup:[{
qualifier: 'adminInfo',
position: 20,
importance: #HIGH
}]
pb_changed_at,
/* Associations */
//Item Data
@ObjectModel.association.type: #TO_COMPOSITION_CHILD
_itemData
}
Item Node
@AbapCatalog.sqlViewName : 'Z2812CITEMND'
@AbapCatalog.compiler.compareFilter : true
@AbapCatalog.preserveKey : true
@AccessControl.authorizationCheck : #CHECK
@AccessControl.personalData.blocking: #REQUIRED
@VDM.viewType : #CONSUMPTION
@Metadata.allowExtensions : true
@EndUserText.label : 'Phone Book Item Consumption - Node View'
@ClientHandling:{
algorithm : #SESSION_VARIABLE,
type : #CLIENT_DEPENDENT
}
@ObjectModel:{
createEnabled : true,
deleteEnabled : true,
updateEnabled : true,
transactionalProcessingDelegated : true,
usageType:{
sizeCategory : #L,
serviceQuality : #D,
dataClass : #TRANSACTIONAL
}
}
define view Z2812_C_PB_ITEM_ND as select from Z2812_I_PB_ITEM_ND as itemData
-- Category Description
association[0..1] to Z2812_I_PB_CATG_TXT as _categoryText on $projection.pb_category = _categoryText.pb_category
and $projection.pb_category_desc = _categoryText.pb_category_desc
-- Association to Header
association [1..1] to Z2812_C_PB_HEAD_ND as _headData on $projection.pb_head_uuid = _headData.pb_head_uuid
{
//item
@UI.hidden: true
key pb_item_uuid,
@UI.hidden: true
pb_head_uuid,
@UI.lineItem.position: 10
@UI.textArrangement: #TEXT_FIRST
@Consumption.valueHelp: '_categoryText'
@ObjectModel.text.element: ['pb_category_desc']
@Semantics.text: true
pb_category,
@UI.hidden: true
pb_category_desc,
@UI.lineItem.position: 20
@Semantics.telephone.type: [#CELL]
pb_telephone,
@UI.lineItem.position: 30
@Semantics.systemDateTime.createdAt: true
@ObjectModel.readOnly: true
pb_created_at,
@UI.lineItem.position: 40
@Semantics.systemDate.lastChangedAt: true
@ObjectModel.readOnly: true
pb_changed_at,
/* Associations */
//header
@ObjectModel.association.type: [#TO_COMPOSITION_ROOT, #TO_COMPOSITION_PARENT]
_headData,
@Consumption.filter.hidden: true
_categoryText
}