此为最简单的在HANA STUDIO上创建ABAP CDS的例子，只说明简单创建过程序，前提是已安装好了HANA STUDIO ,并创建了ABAP的工程项目，连接到了你SAP ABAP系统，如你还没有成功到这个步骤，请先查看，
Hello everyone in this ABAP on HANA tutorial you will learn how to create ABAP CDS Views on HANA. The abbreviation for CDS is Core Data Services. To know about ABAP CDS click here.
You have installed Eclipse IDE( Kepler/Juno version )on your local machine.Click here to know more about.
You have installed ABAP Development Tools in Eclipse IDE.
You have access to ABAP Netweaver 7.4 on HANA.
You have created ABAP Project in eclipse to connect to ABAP Netweaver 7.4 system.Click here to know how to create ABAP Project.
1. Choose the package in which you want to create CDS Views. Right-click on the package → New → Other ABAP Repository Object.
2. In the New ABAP Repository Object window, search for DDL source object by typing in search field.Select the DDL Source and hit Next.
3. In the New DDL Source window, enter Name and Description of the CDS View and hit Finish.
4. A new CDS view editor opens up like below.
5. Here we are going to retrieve the data from the table SNWD_PD using ABAP CDS View.Look at the DDL source we need to replace few values
Replace data_source_name with table name “SNWD_PD” from which you want to get the data.
Provide new value for @AbapCatalog.sqlViewName as “ZV_DEMO_01” .
6. Now the DDL source looks like below.
7. Lets look at the syntax for the CDS View.
12345678 [su_note note_color=”#e5e5e5″]@AbapCatalog.sqlViewName: ‘CDS_DB_VIEW’[@view_annot1][@view_annot2] …[DEFINE] VIEW cds_entity [name_list] [parameter_list] AS select_statement [;][/su_note]
In the first part of the syntax we declare annotations.Annotation “@AbapCatalog.sqlViewName” is mandatory when creating CDS views, by which it creates a View in the Data Dictionary.
cds_entity – is the name of the view.
name_list – list of field names displayed in the output when we run the CDS view.
parameter_list – list of input parameters to the CDS view.
select_statement – is the select statement to be provided from table.
Full syntax documentation is available
10. Now a new ABAP DDL Source object will created and available under ABAP DDL Sources folder and also new dictionary view will be created along with it under Views folder.
11. Right click on the newly created DDL source object and choose Open Data Preview to view the data.
12. You will see the output like below with data retrieving from the CDS view.
You have successfully created a ABAP CDS View.In our next tutorial we will know how to use these ABAP CDS view in ABAP programs/reports and also will have deep dive into full features of ABAP CDS views.
Please stay tuned to us for more ABAP on HANA and ABAP in Eclipse tutorials.Please feel free to comment and let us know your feedback. You feedback will keep us alive.