cancel
Showing results for 
Search instead for 
Did you mean: 

BOPF generated from a CDS view

afediuc
Explorer

Dear members,

I've wanted to create a small BOPF and CDS view application to use with UI5. I've read some of the topics and started a tutorial but with my own input. The idea behind the app is ticket system, nothing fancy.

I've created my CDS view and added the annotations. The CDS and the SQL view is created, but i don't get a BOPF as well at activation. I tried various solution on the Community but with no luck.

I have a questions though, is it mandatory to have an association?

My code snippet:

Do you see anything that might prevent the BOPF creation?

Thank you,

Alex

Accepted Solutions (0)

Answers (3)

Answers (3)

cwolter90
Participant

You could try:

semanticKey:        [ 'TICKET_ID' ],
representativeKey:  'TICKET_ID',
afediuc
Explorer
0 Kudos

Thanks for the info but it still doesn't solved my problem.

0 Kudos

Hi Alex, You seem to have deep knowledge about Annotations. Could you kindly reply to my question posted here please ?

https://answers.sap.com/questions/402937/object-model-annotations-in-cds-views-without-corr.html

Regards

0 Kudos

Hi Alexandru, I generated a BOPF for EKKO, EKPO and EKET tables and it seems to be working fine. You could check the code, which I am attaching. However, my question is how can we delete a BOPF Object, which is there in the system, if required. Regards Prateek

@AbapCatalog.sqlViewName:'ZPUREKKO1'

@ObjectModel.modelCategory:#BUSINESS_OBJECT

@ObjectModel.compositionRoot:true

@ObjectModel.writeActivePersistence:'EKKO'

@AbapCatalog.compiler.compareFilter:true

@AccessControl.authorizationCheck:#NOT_REQUIRED

@EndUserText.label:'ZPURKEKKO'

@ObjectModel.semanticKey:'EBELN'

@ObjectModel.representativeKey:'EBELN'

@ObjectModel.transactionalProcessingEnabled:true

@ObjectModel.createEnabled:true

@ObjectModel.updateEnabled:true

@ObjectModel.deleteEnabled:true

@OData.publish:true

defineview ZPURKEKKO asselectfrom ekko

association[0..*]to ZPUREKPO as _Item1 on$projection.ebeln = _Item1.ebeln

association[0..*]to ZPUREKET as _Item2 on$projection.ebeln = _Item2.ebeln

{

key ekko.ebeln,

ekko.bukrs,

ekko.bstyp,

ekko.bsart,

@ObjectModel.association.type:[#TO_COMPOSITION_CHILD]

_Item1,

_Item2

}

@AbapCatalog.sqlViewName:'ZPUREKPO1'

@ObjectModel.modelCategory:#BUSINESS_OBJECT

@ObjectModel.writeActivePersistence:'ekpo'

@AbapCatalog.compiler.compareFilter:true

@AccessControl.authorizationCheck:#NOT_REQUIRED

@EndUserText.label:'ZPURKEKPO'

@ObjectModel.semanticKey:['Ebeln','Ebelp']

@ObjectModel.representativeKey:'Ebelp'

//@ObjectModel.transactionalProcessingDelegated: true

@ObjectModel.createEnabled:true

@ObjectModel.updateEnabled:true

@ObjectModel.deleteEnabled:true

@OData.publish:true

defineview ZPUREKPO asselectfrom ekpo

association[1..1]to ZPURKEKKO as _Header on$projection.ebeln = _Header.ebeln

association[1..*]to ZPUREKET as _Item2 on$projection.ebeln = _Item2.ebeln and$projection.ebelp = _Item2.ebelp

{

key ekpo.ebeln,

key ekpo.ebelp,

ekpo.loekz,

ekpo.statu,

ekpo.aedat,

ekpo.txz01,

ekpo.matnr,

ekpo.ematn,

@ObjectModel.association.type:[#TO_COMPOSITION_ROOT]

_Header,

@ObjectModel.association.type:[#TO_COMPOSITION_CHILD]

_Item2

}

@AbapCatalog.sqlViewName:'ZPUREKET1'

@VDM.viewType:#BASIC

@ObjectModel.writeActivePersistence:'eket'

@AbapCatalog.compiler.compareFilter:true

@AccessControl.authorizationCheck:#NOT_REQUIRED

@EndUserText.label:'ZPURKEKET'

@ObjectModel.semanticKey:['Ebeln','Ebelp','etenr']

@ObjectModel.representativeKey:'Etenr'

//@ObjectModel.transactionalProcessingDelegated: true

@ObjectModel.createEnabled:true

@ObjectModel.updateEnabled:true

@ObjectModel.deleteEnabled:true

@OData.publish:true

defineview ZPUREKET asselectfrom eket

association[1..1]to ZPURKEKKO as _Header on$projection.ebeln = _Header.ebeln

association[1..1]to ZPUREKPO as _Item1 on$projection.ebeln = _Item1.ebeln and$projection.ebelp = _Item1.ebelp

{

key eket.ebeln,

key eket.ebelp,

key eket.etenr,

eket.eindt,

eket.slfdt,

eket.lpein,

eket.menge,

eket.ameng,

eket.wemng,

eket.wamng,

_Header,

@ObjectModel.association.type:[#TO_COMPOSITION_PARENT]

_Item1

}