Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

The Data Model

Compounding characteristics can be used in a CDS model. 'Compound' means a CDS dimension view with more than one key fields (except time fields for time dependency). 

A correct compounding CDS model should look like this (Field C is compounded with field P, that is, P/C):


The arrow with title “master data” corresponds to the annotation “ObjectModel.foreingKey.assocation”. If you follow the direct arrows from field_P in the blue Cube CDS view, and the indirect arrow ( from field_C in the blue Cube CDS view to the green Child CDS view) and follow further (from field_P in the green Child CDS view to the orange Parent CDS view) , both path have to end at the same view.

That is, the two orange field_P should be associated with the same master data in the blue Cube CDS view and the green Child CDS view (by using annotation @ObjectModel.foreignKey.association). If not, error RSODP056 is triggered because of data model inconsistency.

The Steps

To define an InfoObject C compounded with P (P is the compounding parent of C, C is the compounding child of P, that is, P/C):

  1. In the CDS view CDS_for_P that defins master data of P:
    Define P as key field
    Add header annotation: @ObjectModel.representativeKey: 'P'
  2. In CDS view CDS_for_C that defines master data of C:
    Define both P and C as key fields
    Add header annotation: @ObjectModel.representativeKey: 'C'
    Define master data association for field P as:
    Associatiion to CDS_for_P as _P on $projection.P=_P.P
    Add annotation for field P:
    @ObjectModel.foreignKey.association: '_P' 
     key P,
    key C,

  3. In the CDS views that uses InfoObject P and C (for example, the cube CDS):
    Define associations to map both P and C:
    Associatiion to CDS_for_P as _P on $projection.P=_P.P
    Association to CDS_for_C as _C on  $projection.P = _C.P
                                                          and $projection.C = _C.C
    Add annotation for field P and C:
    @ObjectModel.foreignKey.association: '_P'
    key P,
    @ObjectModel.foreignKey.association: '_C' 
      key C,

Attention:

 

  • In a dimension CDS view ( with annotation @Analytics.dataCategory: #DIMENSION), no key figure fields can be defined as key fields. Only characteristic fields can be key figures.
  • It is very important to make sure field P in cube view (point 3) have exactly the same master data association in the master data CDS view for P (point 2). Otherwise system will raise error "Cannot derive InfoObject name for field xxx (RSODP 056)" for feild P.

 

 Example

Compounding parent InfoObject carrid is defined as below:

If compounding child InfoObject connid is defined as compounded with carrid as below:

In the cube CDS, both connid and carrid are mapped to the InfoObject view and define foreign key association for connid:

When activate the cube CDS, system will raise error: "Cannot derive InfoObject name for field xxx (RSODP 056)"

This is because in CDS view ZGL_CONNID, field carrid has no master data association. But in cube view ZGL_FLIGHTCMP, field carrid is associated to master data view ZGL_CARRID. This means the field carrid in ZGL_CONNID is a different characteristic from the field carrid in ZGL_FIGHTCMP. This is not allowed for compounding characteristic carrid/connid.

To correct this error, change CDS view ZGL_CONNID like this:

Then cube view ZGL_FLIGHTCMP can be activated without issue.

In RSRT, run the default query of the cube: 2CZGLFIGHTCMPV/!2CZGLFIGHTCMPV, connid is compounded with carrid:

 

  • No labels