首页 > SAP > HANA > How to call ABAP CDS Views in ABAP report on HANA-验证成功
2019
08-27

How to call ABAP CDS Views in ABAP report on HANA-验证成功

Hello everyone, In this ABAP on HANA/ABAP In Eclipse tutorial we will learn how to call ABAP CDS Views in ABAP report on HANA. The abbreviation for CDS is Core Data Services.To know about ABAP CDS click here.

1.注意:

在HANA STUDIO创建ABAP 程序时,有两个可选的创建 “ABAP Program”,不能选择错了图中,必须要选择Source Code Library 下的 ABAP Program ,才是正确的,而选择Others下的 ABAP Program ,是错误的,选择错误时,会发现创建的程序在SE38中找不到。也就修改不了源代码,具体这个错误的内容是做什么用不不太了解。

How to call ABAP CDS Views in ABAP report on HANA-验证成功 - 第1张  | 优通SAP

1.1.1.Prerequisites

You have installed Eclipse IDE( Kepler/Juno version )on your local machine.
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.
You have already created ABAP CDS View.

在开发ABAP程序时,可以使用 Eclipse ,也可以使用HANA STUDIO,我在操作时,使用的是HANA STUDIO,据说, Eclipse 的SAP扩展插件,以后SAP公司不要进行升级更新了,所以建议大家还是使用HANA STUDIO,进行例子中的CDS,及ABAP程序开发。

例子中需要使用到,前面创建的CDS,如你不知如何创建CDS,请参看:

1.ABAP CDS 学习汇总 

2.HANA STUDIO如何创建ABAP CDS 

1.1.2.Step-by-Step Procedure

1. Create an ABAP program/report.

How to call ABAP CDS Views in ABAP report on HANA-验证成功 - 第2张  | 优通SAP

2. In the New ABAP Program window, enter Name and Description and hit Next.

How to call ABAP CDS Views in ABAP report on HANA-验证成功 - 第3张  | 优通SAP

3. In the Selection of Transport Request window, choose the transport request. As we are saving the program in $TMP package in our case no transport request is required.Click on Finish.

How to call ABAP CDS Views in ABAP report on HANA-验证成功 - 第4张  | 优通SAP

4. To call an ABAP CDS view you can use Open SQL statements to get the data.Sample ABAP code snippet to call a CDS will look like below.

1.1.2.1.1.Syntax: SELECT * FROM <cds_view_name>.

But in this demo example we will use the CDS View to create an ABAP ALV report.Copy and paste the below code in the ABAP program.

5. Lets look at the code, we have used CDS view name created in our previous tutorial to the ALV with IDA class CL_SALV_GUI_TABLE_IDA as a data source to the ALV. Save and activate the ABAP program.

6. Execute the ABAP report and you should see the ALV output like below

How to call ABAP CDS Views in ABAP report on HANA-验证成功 - 第5张  | 优通SAP

You successfully learned how to call ABAP CDS Views in ABAP report on HANA. Please stay tuned to us for ABAP on HANA/ABAP in Eclipse tutorials.Please feel free to comment and let us know your feedback. You feedback will keep us alive.

在这个程序中,是最简单的直接以CDS的内容为数据源,直接ALV显示出来,

事实上也是可以对CDS数据源进行WHERE查询的,并对ALV输入的格式做处理,细节后面文章再做研究。

1.How to create ABAP CDS Views with Parameters,及程序中带参数的CDS.

最后编辑:
作者:yangsen
本站为个人博客网站,全由我个人维护,我从事SAP开发13年,其它ERP开发7年,基本都是零售行业。本站记录工作学习的过程, 有SAP相关询问专、兼职工作可随时联系我。 有网站相关的问题可直接在文章下方留言,或者联系我。 邮件:yan252@163.com给我。 QQ:415402519

留下一个回复

你的email不会被公开。