cancel
Showing results for 
Search instead for 
Did you mean: 

CDS Key is GENERATED_ID instead of key specified

former_member209088
Participant

I am using Fiori List Report Template. Many views involved, but the issue is with the top level TOTALS View ZDDL_FI_C_OPEX.

I have defined the KEY to that view as: KEY: GJAHR + MONAT + KOSTL + HKONT

This view has an association to drill down into the docs that make up that Total (KEY: GJAHR+BUKRS+BELNR+BUZEI)

However CDS View below is creating a GENERATED_ID as the KEY to the Totals view, which breaks the drill down into _items.

Anyone have an idea on how to handle this?

Thanks,

Tim

CDS Top View

@AbapCatalog.sqlViewName: 'ZSQL_FI_C_OPEX'
@AbapCatalog.compiler.compareFilter: false
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Opex Cost Center Consumption'
@AbapCatalog.preserveKey: true
@Metadata.ignorePropagatedAnnotations: true
@ClientDependent: true

@OData.publish: true

define view ZDDL_FI_C_OPEX
                              
as select from ZDDL_FI_B_OPEX_T                      
          association[0..*] to ZDDL_FI_B_PER    as _line
            on  $projection.gjahr = _line.gjahr
            and $projection.monat = _line.monat
            and $projection.kostl = _line.kostl                           
            and $projection.hkont = _line.hkont       
{
   @UI.selectionField.position: 10  
  @Semantics.fiscal.year: true  
  key gjahr as gjahr,                        
  @UI.selectionField.position: 20  
  key monat as monat,                         
  @UI.lineItem.position: 30  
  key kostl as kostl,   
  @UI.lineItem.position: 40                          
  key hkont as hkont,                         

  @UI.lineItem.position: 50 
  @Semantics.currencyCode: true
  hwae2 as hwae2,                             
  
  @UI.lineItem.position: 60 
  @DefaultAggregation: #SUM
  @Semantics.amount.currencyCode: 'hwae2'  
  tot   as tot,                                
  
  @UI.lineItem.position: 70
  @DefaultAggregation: #SUM
  @Semantics.amount.currencyCode: 'hwae2'   
  ytd   as ytd,                                
  
  _line
  
}

$Metadata (Generated_ID as the key to ZDDL_FI_C_OPEXTypeis the problem

...

-<EntityType sap:content-version="1" sap:label="Period Totals" Name="ZDDL_FI_B_PERType">

-<Key>
<PropertyRef Name="bukrs"/>
<PropertyRef Name="belnr"/>
<PropertyRef Name="gjahr"/>
<PropertyRef Name="buzei"/>
</Key>
...
-<EntityType sap:content-version="1" sap:label="Opex Cost Center Consumption" Name="ZDDL_FI_C_OPEXType" sap:semantics="aggregate">
-<Key>
<PropertyRef Name="ID"/>
</Key>
<Property Name="ID" Nullable="false" Type="Edm.String"/>
<Property sap:label="Fiscal Year" Name="gjahr" sap:display-format="NonNegative" MaxLength="4" Type="Edm.String" sap:aggregation-role="dimension"/>
<Property sap:label="Posting period" Name="monat" sap:display-format="NonNegative" MaxLength="2" Type="Edm.String" sap:aggregation-role="dimension"/>
<Property sap:label="Cost Center" Name="kostl" sap:display-format="UpperCase" MaxLength="10" Type="Edm.String" sap:aggregation-role="dimension"/>
<Property sap:label="G/L Account" Name="hkont" sap:display-format="UpperCase" MaxLength="10" Type="Edm.String" sap:aggregation-role="dimension"/>
<Property sap:label="Local currency 2" Name="hwae2" MaxLength="5" Type="Edm.String" sap:semantics="currency-code" sap:aggregation-role="dimension"/>
<Property Name="tot" Type="Edm.Decimal" sap:unit="hwae2" Scale="3" Precision="22" sap:aggregation-role="measure" sap:filterable="false"/>
<Property Name="ytd" Type="Edm.Decimal" sap:unit="hwae2" Scale="3" Precision="19" sap:aggregation-role="measure" sap:filterable="false"/>
<NavigationProperty Name="to_line" ToRole="ToRole_assoc_3F7CDE5901750F45D612B21666430E21" FromRole="FromRole_assoc_3F7CDE5901750F45D612B21666430E21" Relationship="ZDDL_FI_C_OPEX_CDS.assoc_3F7CDE5901750F45D612B21666430E21"/>
</EntityType>
....

Accepted Solutions (0)

Answers (3)

Answers (3)

karlboutin
Explorer
0 Kudos

Hello Timothy,

I have the exact same issue. I need the annotations @DefaultAggregation: #SUM in my view, but then a generated ID replace my key fields.

Have you successfully removed the Generated ID while keeping the annotation @DefaultAggregation: #SUM?

Bests,

Karl

former_member209088
Participant
0 Kudos

Partially solved my problem. When I remove @DefaultAggregation: #SUM, the GENERATED_ID is replaced by my specified KEY, and the Association to _line works! -- but why? Now I have modify something in WebIDE to make it a Grid report again....

Anyone? Bueller?

-Tim

former_member209088
Participant
0 Kudos

Why I know it is the generated_id

Front-End; called OPEX2..because I recreated it to see if cache was a problem

Back-End (doesn't expect generated_ID)