cancel
Showing results for 
Search instead for 
Did you mean: 

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

RaminS
Active Participant
390

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
junwu
Active Contributor

just take a look at the C_SalesOrderWl_F1873 regarding how the virtual element is implemented.

the one you are trying to use is for RAP.

 

@ui.hidden: true

@Semantics.text:true

@ObjectModel.virtualElement: true

@ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_SD_SLSORD_UI_PARTNER_UTIL'

cast('' as ad_namtext ) as SalesEmployeeName,

RaminS
Active Participant
0 Kudos

Thanks. I'm not sure what you mean by "just take a look at the C_SalesOrderWl_F1873 regarding how the virtual element is implemented".

Our version of that CDS view does not have a virtual element. And we don't have CL_SD_SLSORD_UI_PARTNER_UTIL in our system.

Where can I see that example?

Thanks

RaminS
Active Participant
0 Kudos

I found a CDS view that does use Virtual Elements, C_Customer360_F2187. And used that example to build my extension.

 

RaminS_0-1718375484594.png

 

Thanks for the hint JunWu. 😊

junwu
Active Contributor
0 Kudos
if your issue is solved, please select the correct answer to close the thread.
RaminS
Active Participant
0 Kudos

If you want to edit your answer and correct the cds view you are referring to, I will mark it as correct answer. But right now the CDS view you mention, C_SalesOrderWl_F1873, does not have a virtual element. So it is not correct.

junwu
Active Contributor
0 Kudos
my bad, i was looking at s4 2022, that cds does have virtual element, but anyway, my answer already contains the correct the syntax for the virtual element, don't u see it?