cancel
Showing results for 
Search instead for 
Did you mean: 

Adding a Calculated field from Item-level to Sales Order Fiori app

RaminS
Participant
358

We need to add a column to the Sales Order table in F1873, which is the total of amounts of a specific item type.

The CDS view for this table is: C_SalesOrderWl_F1873

which selects from the header of Sales Orders, with association to Items. I created an extension for this CDS view to do the calculations, but realized Virtual Elements don't work for anything but project views.

RaminS_0-1718311834119.png

How else can I extend an SAP cds view to display an item-level field that needs calculations, in the Sales Order table without the use of Virtual Elements? Do Table Functions work in a CDS extension?

We are on S/4HANA 2020.

Thanks in advance.

 

 

View Entire Topic
RaminS
Participant

The issue was that the syntax is only valid for RAP, with projection views. For non-RAP versions, the syntax is the same but you don't use "virtual" in front of the column.

An example can be found in C_Customer360_F2187:

RaminS_0-1718396919266.png

 

@objectModel.virtualElement
@ObjectModel.virtualElementCalculatedBy: "ABAP:class_name"
cast( '' as <type> ) as colname

Have to be careful these days when reading SAP documents, to make sure it's the right version, with so many versions and frameworks around.