SAP

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
⤢ Open full site

Using Virtual Elements in CDS Projection Views

Create and expose virtual elements in CDS Projection Views

Overview

You will learn

  • How to create virtual elements in CDS projection view for fields which are not part of the data model
  • Calculate the values of virtual elements using ABAP resources during runtime
Sheena M K S Sheena M K September 21, 2026
Created on August 31, 2026
Contributors

Prerequisites

Prerequisites

Steps

Intro

For some business use cases, it may be necessary to add new elements to the data model of an application whose values cannot be fetched from the database. Virtual elements are used if these elements are not provided as part of the original persistence data model but can be calculated using ABAP resources during runtime. For more details refer to Using Virtual Elements in CDS Projection Views


Step 1 Create package

  1. Create a new package for this tutorial, by right clicking on Favourtite Packages from Project Explorer. Now choose New > ABAP Package.

  2. In the wizard enter the following then follow the wizard, choosing a new transport request:

    • Name: ZABAP_VIRT_ELEM_###
    • Description: Package for Virtual Elements

    New Package
    New Package

Step 2 Create database table
+
Step 3 Generate the transactional UI service
+
Step 4 Enhance the Data Model of the Base and Projected Business Object (BO)
+
Step 5 Define the virtual elements
+
Step 6 Calculate the Virtual Elements of the Travel BO Entity
+
Step 7 Preview and Test the enhanced Travel App
+
Step 8 Test yourself
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 9
1. Create package 2. Create database table 3. Generate the transactional UI service 4. Enhance the Data Model of the Base and Projected Business Object (BO) 5. Define the virtual elements 6. Calculate the Virtual Elements of the Travel BO Entity 7. Preview and Test the enhanced Travel App 8. Test yourself 9. More information