12-20-2017 12:39 PM
Hi,
I am trying to build a BOPF Business Object representing tables KNA1, KNVK and ADR2 in sweet harmony. The aim is to be able to hopefully change names, addresses and contact info for the customer contact persons in a Fiori Elements App.
My CDS's are as below
@AbapCatalog.sqlViewName: 'ZV_I_CUST'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Basic view for cust search for Sales contact app 1'
@ObjectModel.semanticKey: 'kunnr'
@ObjectModel.modelCategory: #BUSINESS_OBJECT
@ObjectModel.compositionRoot: true
@ObjectModel.transactionalProcessingEnabled: true
@ObjectModel.writeActivePersistence: 'kna1'
@ObjectModel.representativeKey: 'kunnr'
@ObjectModel.updateEnabled: true
define view ZCDS_CAPP1_I_CUST as select from kna1 as _customers
association[1..*] to ZCDS_CAPP1_I_CONTPERS
as _contpers on $projection.kunnr = _contpers.kunnr
{
key kunnr,
name1,
ort01,
-- exposing the association to contacts
@ObjectModel.association.type: [#TO_COMPOSITION_CHILD ]
_contpers
}
@AbapCatalog.sqlViewName: 'ZV_I_CONTPERS'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Basic view for contact persons for Sales contact app 1'
@ObjectModel.semanticKey: [ 'kunnr', 'parnr' ]
@ObjectModel.writeActivePersistence: 'knvk'
@ObjectModel.representativeKey: [ 'parnr', 'kunnr']
@ObjectModel.updateEnabled: true
define view ZCDS_CAPP1_I_CONTPERS as select from knvk as _contpers
association [1..1] to ZCDS_CAPP1_I_PHONE
as _phone on $projection.prsnr = _phone.persnumber
association [1..1] to ZCDS_CAPP1_I_CUST
as _customers on $projection.kunnr = _customers.kunnr
{
key parnr,
key kunnr,
namev,
name1,
abtnr,
_contpers.prsnr,
// exposing the association to contacts
@ObjectModel.association.type:
[#TO_COMPOSITION_PARENT, #TO_COMPOSITION_ROOT ]
_customers,
@ObjectModel.association.type: [#TO_COMPOSITION_CHILD]
_phone
}
@AbapCatalog.sqlViewName: 'ZV_I_CONTPERS_P'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Basic view for contact person phone'
@ObjectModel.semanticKey: 'PERSNUMBER'
@ObjectModel.writeActivePersistence: 'adr2'
@ObjectModel.representativeKey: 'persnumber'
@ObjectModel.updateEnabled: true
define view ZCDS_CAPP1_I_PHONE as select from adr2 as _phone
association [1..1] to ZCDS_CAPP1_I_CONTPERS
as _contpers on $projection.persnumber = _contpers.prsnr
{
key persnumber,
telnr_long,
// exposing the association to contacts
@ObjectModel.association.type: [#TO_COMPOSITION_PARENT ]
_contpers
// @ObjectModel.association.type: [#TO_COMPOSITION_ROOT]
// _contpers._customers
}
As far as I understand I must declare a navigation back to the root element even for my last CDS. I have tried a couple of different options, but none seems to work. Any advice?
Also, I get a error message in Eclipse when activating saying
[BO Sync] Cannot find source attribute PARNR in association _PHONE (view ZCDS_CAPP1_I_CONTPERS)
What does that mean, and more importantly, how to I resolve it?
kind regards,
Glenn
01-16-2018 7:30 PM
08-09-2019 7:46 AM
08-26-2019 12:33 PM
glenn.karlsson2 timm12 hey guys, by any chance did you find a solution?
08-26-2019 12:38 PM
08-04-2022 2:13 PM