2024 Jun 13 9:58 PM - edited 2024 Jun 13 9:59 PM
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.
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.
Request clarification before answering.
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:
@objectModel.virtualElement
@ObjectModel.virtualElementCalculatedBy: "ABAP:class_name"
cast( '' as <type> ) as colnameHave to be careful these days when reading SAP documents, to make sure it's the right version, with so many versions and frameworks around.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
it is not first time you didn't respect my answer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Your answer would confuse more than clarify. You use the wrong cds view example, and you pasted the code without using the code tag, and not even include the column line. That's the difference between RAP and non-RAP syntax. You didn't even include that part in your answer, and didn't bother clarifying it. Answers have to be clear and not crypted. It would have taken 2 minutes to edit and correct your answer when I asked you to, why wouldn't you?
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,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
| User | Count |
|---|---|
| 8 | |
| 7 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.