Skip to Content

Could not generate BO from CDS View with Annotations

Oct 20, 2016 at 11:24 AM


avatar image

Hi experts,

i tried to generate a BO from CDS View with Annotations. The entities i tried to model are Monster and Monster Items. So in particular i have done the steps in this blog to accomplish the task:

  • Create two database tables to hold BO data
  • Create two CDS views
  • Add @ObjectModel Annotations to both CDS Views
  • Save and Activate both CDS Views

As i think how these @ObjectModel Annotations should work, the BOPF runtime should have generated the BO with a ROOT Node and an ITEM Node. But unfortunately nothing was generated.

I dont know why the BO is not generated at activation of the CDS views as all needed Annotations are set for this task. We are working on a SAP System with following patch levels:

Could these Annotations for creating BO from CDS View maybe are not recognized by our System due to patch level?

Here is the source code of the two CDS views:

CDS View Znl_Monster

@AbapCatalog.sqlViewName: 'ZDDL_NL_I_MNSTR'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'ZNL_MONSTER'

@Search.searchable: true
@Search.ranking: 'HIGH'

@ObjectModel.semanticKey: 'MonsterId'
@ObjectModel.representativeKey: 'MonsterId'
@ObjectModel.modelCategory: #BUSINESS_OBJECT
@ObjectModel.compositionRoot: true
@ObjectModel.transactionalProcessingEnabled: true
@ObjectModel.writeActivePersistence: 'ZNL_D_ROOT'
@ObjectModel.createEnabled: true
@ObjectModel.deleteEnabled: true
@ObjectModel.updateEnabled: true

define view Znl_Monster 
    as select from znl_d_root as Monster
    // Association to Item
    association [0..*] to Znl_Monsteritem as _MonsterItem on Monster.monsterid = _MonsterItem.MonsterId {
    // Monster
    @Search.defaultSearchElement: true
    @ObjectModel.readOnly: true
    key Monster.monsterid as MonsterId,

    // Name as Name,

    // Make association public
    @ObjectModel.association.type:  [#TO_COMPOSITION_CHILD]
    _MonsterItem // Make association public

CDS View Znl_Monsteritem

@AbapCatalog.sqlViewName: 'ZDDL_NL_I_MNSTRI'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'ZNL_MONSTERITEM'

@Search.searchable: true
@ObjectModel.semanticKey:  [ 'MonsterId', 'MonsterItemId' ]
@ObjectModel.representativeKey: 'MonsterItemId'
@ObjectModel.writeActivePersistence: 'ZNL_D_ITEM'
@ObjectModel.createEnabled: true
@ObjectModel.deleteEnabled: true
@ObjectModel.updateEnabled: true

define view Znl_Monsteritem
    as select from znl_d_item as Item
    // Association to Header
    association [*] to Znl_Monster as _Monster on Item.monsterid = _Monster.MonsterId {
    // Monster
    @Search.defaultSearchElement: true
    @ObjectModel.readOnly: true
    key Item.monsterid                  as MonsterId,
    // Monster Item
    @Search.defaultSearchElement: true
    key Item.itemid                     as MonsterItemId,
    // Name                           as Name,
    // Measure fields
    Item.price                          as Price,
    Item.quantity                       as Quantity,
    Item.power                          as Power,
    // Make association public
    @ObjectModel.association.type:  [#TO_COMPOSITION_PARENT,#TO_COMPOSITION_ROOT]

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Marcio Furuzawa Sep 10, 2017 at 11:37 PM

Hi Nils Lutz,

Did you find a sollution for your problem, I'm faciong the same.

Do you know if the annotation @ObjectModel.transactionalProcessingEnabledalso does NOT work in the SAP NetWeaver 750 ?

I saw in the Eclipse that the font color of this annotation is different from anothers, and the BOF is not created in the SAP NetWeaver.



first-screen.png (22.6 kB)
second-screen.png (44.4 kB)
Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Yoko,

i am sorry to say that we do not found a solution for this issue. Since then we did not further dive into the BOPF topic.



Santosh Kumar J Nov 24, 2017 at 01:07 PM

Hi Nils / Marcio,

Were you guys able to create child nodes in BOPF from CDS annotations? Any suggestions for child node creation? Or have you raised the ticket to SAP for further assistance?

Since, I followed few posts and created exactly as advised with the required annotations. I was able to create only Root node in BOPF, but child nodes are not getting created. Could you please let me know what could be the issue of child node creation? since I don't have any authorization issue nor the error.


Santosh Kumar J

10 |10000 characters needed characters left characters exceeded