Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

What is representative key on CDS view?

former_member267947
Participant
0 Kudos

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/f1fc5425e0094c5baf4954... 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

2 REPLIES 2

natiele_bohn
Advisor
Advisor
0 Kudos

Not sure if I understand your question correctly, but to be able to achieve the requirements, the MATERIAL field should be defined as a KEY field in the dictionary table from where the data is coming from.

ravi_rajput
Participant
0 Kudos

Its not very comprehensible in sap help the use of represntative key. I also have the same queries.