首页 > SAP > HANA > How to create ABAP CDS Views with Parameters
2019
08-27

How to create ABAP CDS Views with Parameters

1.此步重点:

1.在创建带参数CDS时,with parameters后面的参数 格式为:

参数名:参数数据类型

所就是说,下面例子中,p_billing_status为传入的参数 名,SNWD_SO_CF_STATUS_CODE是表snwd_so,字段billing_status的数据类型。

2.在ABAP程序中,WHERE 把CDS中定义的参数 作为一个视图字段,做为条件直接填入。

2.操作步骤

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.

How to create ABAP CDS Views with Parameters - 第1张  | 优通SAP

3. In the New DDL Source window, enter Name and Description of the CDS View and hit Finish.

4. A new ABAP CDS view editor opens up like below and paste the below code.

5. Lets observe the code

Line 8-9: We can provide the parameters to the ABAP CDS Views by adding the syntax WITH PARAMETERS p1, p2… Data Dictionary ABAP data types can be used while defining the parameters to the ABAP CDS Views.

Line 19-20: We can use the parameters p1, p2.. in CDS Views using the syntax :p1 or $parameters:p1

6. Now we will see how to call the ABAP CDS views with input parameters in an ABAP program using Open SQL statement. Create an ABAP program in eclipse ADT or SE38-ABAP编辑器 transaction. Below is the code snippet to call the ABAP CDS Views with input parameters.

*程序中的内表LT_RESULT不用先定义,直接使用就行。

最后编辑:
作者:yangsen
有需要可在文章留言或者邮件yan252@163.com给我。

留下一个回复

你的email不会被公开。

five + seventeen =