ABAP CDS View Data Definition Templates


Dear SAPLearners, in this blog post you will learn about ABAP CDS view Data Definition Templates.

ABAP Core Data Service(CDS) view plays a very important role in S/4 HANA Projects. Developers needs to create ABAP CDS view for different purposes like reporting, SAP Fiori Smart Templates, OData services, BEx queries in Embedded Analytics.

During the ABAP CDS View development, we spent many hours writing same DDL source code.

CDS View Data Definition Templates

Eclipse based ADT provides Data Definition Templates, to address the above problem and reduce the time spent on ABAP CDS view development.

When you create an ABAP CDS view in ADT and follow the Data Definition creation wizard, when you reach the step Templates, where you will find the predefined code templates available for selection.

Also Read: How to create ABAP CDS View.

Eclipse ADT IDE provides 12 predefined ABAP CDS view templates. You can view all data definition templates available in Window -> Preference section.

You can view the preview of Data Definition Template by selecting any of the template.

Okay this is cool! 😎 Can I create additional Data Definition templates for my own use? Yes, we can create, edit and remove templates. Lets see how we can do it.

Create a New Template

1. Under Templates section, click on New.

2. On New Template dialog window. Specify the Name and the Description, and select Data Definition (creation) as the Context.

3. Choose the Insert Variable button to add variables in the Pattern field.

Add annotations and other fields as per need to prepare your template. Here I created the template with all annotations I need for SAP Fiori Elements application.

4. Click on OK.

5. Click on Apply and Close button to save the template.

6. Finally our new template is ready for use. Lets create a ABAP CDS view based on newly created template. Select the custom template

7. Boooom!!! DDL source code is pre-populated based on the template, all you have to do is to replace the table and field names.


Congrats!! you have learned about ABAP CDS view Data Definition Template and also how to create new re-usable template. In your next S/4 HANA project try creating these templates and speed up the development

Please feel free to comment and let us know your feedback. Subscribe for more updates.

If you liked it ❤️, please share it! Thanks!