Skip to Content

CDS Key is GENERATED_ID instead of key specified

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?



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,                                

$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">

<PropertyRef Name="bukrs"/>
<PropertyRef Name="belnr"/>
<PropertyRef Name="gjahr"/>
<PropertyRef Name="buzei"/>
-<EntityType sap:content-version="1" sap:label="Opex Cost Center Consumption" Name="ZDDL_FI_C_OPEXType" sap:semantics="aggregate">
<PropertyRef Name="ID"/>
<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"/>
Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Posted on May 01, 2018 at 02:30 AM

    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)

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 01, 2018 at 04:28 PM

    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?


    remove-sum.png (36.4 kB)
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 28, 2019 at 06:34 PM

    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?



    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.