cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Error while applying Aggregation to a table

NilakshiS
Newcomer
0 Likes
601

SAP Fiori Elements SAPUI5 SAP Cloud Application Programming Model 

I'm trying to make a full stack application on the SAP Business Application Studio using Fiori Object Page Floorplan, and oData v4 service built using Cloud Application Programming. I'm trying to display a table on the object page and show the sum totals of a column in the bottom row. 

To display sum totals at the bottom row I'm using Analytical Table with Aggregation annotations. It is working for one table (WorkOrderItems) but not for the other (RaBillAbstractItems). My guess is that there's probably some problem with expanding the related workOrderItem element in the RaBillAbstractItems. But I have no idea how to solve this.

Here's some screenshots and code snippets of what I've done:

First, here's the working aggregation code (for the workOrderItems Table):

NilakshiS_0-1744807908407.jpeg

@Aggregation.CustomAggregate#amount : 'Edm.Decimal'
@Aggregation.CustomAggregate#quantity : 'Edm.Decimal'
entity WorkOrderItems as projection on my.WorkOrderItems
{
  *,
  @analytics.Measure
  @Aggregation.default: #SUM
  amount,
  @analytics.Measure
  @Aggregation.default: #SUM
  quantity,
};
//////////////////////////////////////////
annotate RABillsService.WorkOrderItems with @Aggregation.ApplySupported: {
  Transformations       : [
    'aggregate',
    // 'groupby',
    // 'filter',
    // 'search'
  ],
  Rollup                : #None,
  PropertyRestrictions  : true,
  // GroupableProperties   : [rate,  ],
  AggregatableProperties: [
    {Property: amount, },
    {Property: quantity, },
    // {Property: rate, }
  ],
};

Next, here's the code that's giving me error:

Screenshot from 2025-04-08 13-02-18.png

@Aggregation.CustomAggregate #raAmount: 'Edm.Integer'
@Aggregation.CustomAggregate #raQuantity: 'Edm.Integer'
@Aggregation.ApplySupported                 : {
 // GroupableProperties   : [to_workOrderItem.rate, ],
 AggregatableProperties: [{Property: raAmount}]
}
entity raBillAbstractItems as projection on my.raBillAbstractItems{
  *,
  @analytics.Measure
  @Aggregation.default: #SUM
  raAmount,
  @analytics.Measure
  @Aggregation.default: #SUM
  raQuantity,
};

Here's my db schema for reference:

entity WorkOrder : cuid, managed
{
    key workOrderNumber : String(100);
    currency : Currency;
    date : Date;
    Items : Composition of many WorkOrderItems on Items.workOrderParent = $self;
    project : Association to one Project;
    raBills : Composition of many raBillAbstract on raBills.parentWorkOrder = $self;
}

entity WorkOrderItems : cuid, managed
{
    activityCode : String(20);
    activityDescription : String(30);
    amount : Integer;
    percentCompleted : UInt8;
    quantity : Integer;
    rate : Integer;
    serialNumber : String(15);
    stage : String(30);
    subPackageName : String(20);
    unitOfMeasurement : String(5);
    workOrderParent : Association to one WorkOrder;
}

entity raBillAbstract : cuid, managed
{
    key billNumber : Integer;
    billDate : Date;
    complianceCompleted : Boolean;
    endDate : Date;
    invoiceNumber : String;
    receiptDate : Date;
    startDate : Date;
    status : BillStatus;
    typeOfBill : BillType;
    Items : Composition of many raBillAbstractItems on Items.raBillParent = $self;
    parentWorkOrder : Association to one WorkOrder;
}

entity raBillAbstractItems : cuid, managed
{
    raAmount : Integer;
    raQuantity : Integer;
    key raBillParent : Association to one raBillAbstract;
    to_workOrderItem : Association to one WorkOrderItems;
}

I've not made any custom pages or controllers yet. I have been using just the annotations to manipulate the front-end. Instead of the analytical table, if you have any documentation for showing sum of columns on responsive table that would work too, as the the "Analytical table" documentation on Fiori mentions this:

Do not use the analytical table (ALV) if:
You need a table. The responsive table is the default table in SAP Fiori. Additional use cases where you might need the responsive table include:
You need to provide a total sum for one column. You can also add totals to the responsive table.

However, I did not find any annotations for how to enable this.

Accepted Solutions (0)

Answers (0)