Skip to Content
0
Dec 29, 2018 at 12:12 PM

What is representative key on CDS view?

1464 Views

Hi all

I would like to know, what is the representative key on CDS view? For what it is good for? I read about it on https://help.sap.com/viewer/9a281eac983f4f688d0deedc96b3c61c/1709%20001/en-US/f1fc5425e0094c5baf49548beb0cbc44.html but can not figure out, what does it exactly do.

I made an example:

@AbapCatalog.sqlViewName: 'ZAMIBOPFCHILD'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'ZAM: Testing BOPF Child'
@ObjectModel: {
    modelCategory: #BUSINESS_OBJECT,
    writeActivePersistence: 'ZAM_T_BOPF_CHILD',
    semanticKey: ['MATERIAL', 'PLANT'],
    representativeKey: 'PLANT',
    createEnabled: true,
    deleteEnabled: true
}
define view ZAM_I_BOPF_CHILD
  as select from zam_t_bopf_child
  association [0..1] to ZAM_I_BOPF_ROOT as _Root on $projection.material = _Root.material
{
  key material,
  key plant,
      proc_type,
      @ObjectModel.association.type:  [#TO_COMPOSITION_PARENT,#TO_COMPOSITION_ROOT]
      _Root
}

Why is the MATERIAL not the representative key?

Thanks