Skip to Content

Error when creating Fiori transactional App based on annotations - 3 layers

Hi experts,

I`m trying to create a Fiori transactional app using only annotations with a 3 level navigation: OData Collection, OData Collection Navigation and Odata Sub item navigation.

For this I`m using 3 interface views and 3 consumption views based on them.

Header - YFIORI_FB_I_500 --> YFIORI_FB_C_500

Item - YFIORI_FB_I_510 --> YFIORI_FB_C_510

Text Table - YFIORI_FB_I_510T --> YFIORI_FB_C_510T

When activating I`m receiving this error:

YFIORI_FB_I_500

@AbapCatalog.sqlViewName: 'YFIORI_FB_VI500'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Handle Type Header - Interface View'
@VDM.viewType: #TRANSACTIONAL


@ObjectModel: {
    transactionalProcessingEnabled: true,
    compositionRoot: true,
    createEnabled: true,
    updateEnabled: true,
    deleteEnabled: true,
    writeActivePersistence: 'YFIORI_FB_TC500',
    semanticKey: [ 'handletype' ]
}


define view YFIORI_FB_I_500
  as select from YFIORI_FB_B_500 as Header
  association [0..*] to YFIORI_FB_I_510  as _Item  on $projection.handletype = _Item.handletype
{
  key Header.handletype,
      Header.handlecutout,

      @ObjectModel.readOnly: true
      Header.changedat,

      @ObjectModel.readOnly: true
      Header.createdat,

      @ObjectModel.readOnly: true
      Header.changedby,

      @ObjectModel.readOnly: true
      Header.createdby,

      @ObjectModel.association.type: #TO_COMPOSITION_CHILD
      _Item
}

YFIORI_FB_C_500

@AbapCatalog.sqlViewName: 'YFIORI_FB_VC500'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Handle Type Header - Consumption View'
@Metadata.allowExtensions: true
@VDM.viewType: #CONSUMPTION

@ObjectModel: {
    transactionalProcessingDelegated: true,
    compositionRoot: true,
    createEnabled: true,
    updateEnabled: true,
    deleteEnabled: true,
    semanticKey: 'handletype' 
}

@OData.publish: true

define view YFIORI_FB_C_500
  as select from YFIORI_FB_I_500 as Header
  association [0..*] to YFIORI_FB_C_510  as _Item  on $projection.handletype = _Item.handletype
{
  key Header.handletype,
      Header.handlecutout,
      Header.createdat,
      Header.createdby,
      Header.changedat,
      Header.changedby,

      @ObjectModel.association.type: [#TO_COMPOSITION_CHILD]
     _Item
}

YFIORI_FB_I_510

@AbapCatalog.sqlViewName: 'YFIORI_FB_VI510'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Handle Part Item - Interface View'
@VDM.viewType: #TRANSACTIONAL


@ObjectModel:{
    createEnabled: true,
    updateEnabled: true,
    deleteEnabled: true,
    writeActivePersistence: 'YFIORI_FB_TC510',
    semanticKey: ['handletype', 'hparttype']
}

define view YFIORI_FB_I_510
  as select from YFIORI_FB_B_510 as Item
  association [1..1] to YFIORI_FB_I_500  as _Header on $projection.handletype = _Header.handletype
  association [0..*] to YFIORI_FB_I_510T as _HPText  on $projection.hparttype = _HPText.hparttype
{
  key Item.handletype, 
  key Item.hparttype,
      Item.custelement,

      @ObjectModel.association.type: [#TO_COMPOSITION_ROOT, #TO_COMPOSITION_PARENT]
      _Header,

     @ObjectModel.association.type: [#TO_COMPOSITION_CHILD]
     _HPText
}

YFIORI_FB_C_510

@AbapCatalog.sqlViewName: 'YFIORI_FB_VC510'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Handle Part Item - Consumption View'
@Metadata.allowExtensions: true
@VDM.viewType: #CONSUMPTION

@ObjectModel:{
    createEnabled: true,
    updateEnabled: true,
    deleteEnabled: true,
    semanticKey:['handletype', 'hparttype']
}

define view YFIORI_FB_C_510
  as select from YFIORI_FB_I_510 as Item
  association [1..1] to YFIORI_FB_C_500 as _Header on $projection.handletype = _Header.handletype
  association [0..*] to YFIORI_FB_C_510T as _HPText on $projection.hparttype = _HPText.hparttype
{
  key Item.handletype,
  key Item.hparttype,
      Item.custelement,

      @ObjectModel.association.type: [#TO_COMPOSITION_ROOT, #TO_COMPOSITION_PARENT]
      _Header,

      @ObjectModel.association.type: [#TO_COMPOSITION_CHILD]
     _HPText
}

YFIORI_FB_I_510T

@AbapCatalog.sqlViewName: 'YFIORI_F_VI510T'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Handle Part - Texts'
@VDM.viewType: #TRANSACTIONAL

@ObjectModel:{
    createEnabled: true,
    updateEnabled: true,
    deleteEnabled: true,
    writeActivePersistence: 'YFIORI_FB_TC510T',
    semanticKey: ['hparttype', 'langu']
}

define view YFIORI_FB_I_510T
  as select from YFIORI_FB_B_510T as Text
  association [1..1] to YFIORI_FB_I_510 as _Head on $projection.hparttype = _Head.hparttype
{
  key Text.hparttype,
  key Text.langu,
      Text.description,

      @ObjectModel.association.type: [#TO_COMPOSITION_PARENT, #TO_COMPOSITION_ROOT]
      _Head
}

YFIORI_FB_C_510T

@AbapCatalog.sqlViewName: 'YFIORI_F_VC510T'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Handle Part - Texts'
@VDM.viewType: #CONSUMPTION

@ObjectModel:{
    createEnabled: true,
    updateEnabled: true,
    deleteEnabled: true,
    semanticKey: ['hparttype', 'langu']
}

define view YFIORI_FB_C_510T
  as select from YFIORI_FB_I_510T as Text
  association [1..1] to YFIORI_FB_C_510 as _Head on $projection.hparttype = _Head.hparttype
{ 
  key Text.hparttype,

      @UI: { lineItem      : [{position: 10, label: 'Language'}],
             identification: [{position: 10, importance: #HIGH, label: 'Language' }]}
  key Text.langu,

      @UI: { lineItem      : [{position: 20, label: 'Description'}],
             identification: [{position: 20, importance: #HIGH, label: 'Description' }]}
      Text.description,

      @ObjectModel.association.type: [#TO_COMPOSITION_PARENT, #TO_COMPOSITION_ROOT]
      _Head
}

So in YFIORI_FB_C_510 although the target of the composition association _HPTEXT --> YFIORI_FB_C_510T is a consumption view ... I receive the error above.

Any hints will be appreciated.

Regards

Alex

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Mar 20 at 02:19 AM

    Ideally you will be creating a consumption view (main) and inside you can call multiple association for Interface views. At the end you use annotation for odata publish and consume the odata service in your UI5 app.

    Not sure on the error but above is the recommended way.

    - Tejas

    Add comment
    10|10000 characters needed characters exceeded