Create Interface Views (CDS)
April 3, 2019

  1. Design / Prototype
  2. Create Dictionary Objects
  3. Create Interface View (CDS)
  4. Business Object Generation (CDS – Object Model Annotations )
  5. Generated Business Object
  6. BOPF – Development
  7. Test BOPF Object using BOBT
  8. Access Control (CDS)
  9. Consumption View (CDS)
  10. OData Service Generation and Registration
  11. Test OData Service using SAP Gateway Client
  12. UI development

In this step, we will create basic views for our DB table. These views can later be used by other CDS views or any DB fetch.

Note: This blog will not get into basic steps of installing ADT and connecting backend system to ADT or How to create CDS views. You can refer to below links for the same, in case this is your first-hand experience with ADT & CDS

Header Interface View

@AbapCatalog.sqlViewName: 'Z2812IPBHEAD'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@ObjectModel:{
  usageType:{ 
    sizeCategory: #L,
    serviceQuality: #X,
    dataClass: #TRANSACTIONAL
  }
}
@VDM.viewType: #BASIC
@Metadata.ignorePropagatedAnnotations: true
@EndUserText.label: 'Phone Book Header Inerface View'
define view Z2812_I_PB_HEAD 
  as select from z2812_pb_d_head as headData {
  //z2812_pb_header 
  key pb_head_uuid, 
  pb_id,
  pb_owner, 
  pb_first_name, 
  pb_last_name, 
  pb_email_id, 
  pb_created_at, 
  pb_changed_at
}

Item Interface View

@AbapCatalog.sqlViewName: 'Z2812IPBITEM'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@ObjectModel:{
  usageType:{
    sizeCategory: #L,
    serviceQuality: #X,
    dataClass: #TRANSACTIONAL
  }
}
@VDM.viewType: #BASIC
@Metadata.ignorePropagatedAnnotations: true
@EndUserText.label: 'Phone Book Item Inerface View'
define view Z2812_I_PB_ITEM 
  as select from z2812_pb_d_item as itemData{
  //z2812_pb_item 
  key pb_item_uuid, 
  pb_head_uuid, 
  pb_category, 
  pb_telephone,
  pb_created_at,
  pb_changed_at
}

Category Interface View

Basic View

@AbapCatalog.sqlViewName: 'Z2812IPBCATG'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@ObjectModel:{
  usageType: {
    serviceQuality: #B,
    sizeCategory: #S,
    dataClass: #MASTER
  }
}
@VDM.viewType: #BASIC
@Metadata.ignorePropagatedAnnotations: true
@EndUserText.label: 'Phone Book Category Interface View'
define view Z2812_I_PB_CATG as select from z2812_pb_d_catg{
  //z2812_pb_d_catg 
  key pb_category,
  key pb_spras, 
  pb_category_desc
}

Value Help View

@AbapCatalog.sqlViewName: 'Z2812IPBCATVH'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel:{
  dataCategory: #VALUE_HELP,
  representativeKey: 'PB_CATEGORY',
  usageType: {
    sizeCategory: #S,
    serviceQuality: #B,
    dataClass: #MASTER
  }
}
@VDM.viewType: #BASIC
@Metadata.ignorePropagatedAnnotations: true
@EndUserText.label: 'Phone Book Category Value Help View'
define view Z2812_I_PB_CATG_VH as select from Z2812_I_PB_CATG {
  //Z2812_I_PB_CATG 
  key pb_category, 
  pb_category_desc
} where pb_spras = $session.system_language

Text View

@AbapCatalog.sqlViewName: 'Z2812IPBCTGTXT'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@ObjectModel:{
  dataCategory: #TEXT,
  representativeKey: 'PB_CATEGORY',
  usageType: {
    sizeCategory: #S,
    serviceQuality: #B,
    dataClass: #MASTER
  }
}
@VDM.viewType: #BASIC
@Metadata.ignorePropagatedAnnotations: true
@EndUserText.label: 'Phone Book CategoryText View'
define view Z2812_I_PB_CATG_TXT as select from Z2812_I_PB_CATG {
  //Z2812_I_PB_CATG 
  key pb_category, 
  pb_category_desc
} where pb_spras = $session.system_language

Note: Value Help and Text view are not categories of views. These are just typed and used for better understanding. Different types of views are Basic, Composite, Consumption, Extension, Structure, Transactional

<< Top