ABAP CDS Views:
A CDS is defined for existing database tables and any other views or CDS Views in ABAP Dictionary using the statement DEFINE VIEW in the DDL in ABAP Core Data Services(CDS) . This is done in CDS Source code in the ABAP Development tools(ADT). Every CDS view has its own CDS Source code.
Two objects are created in ABAP Dictionary of Every CDS View:
A CDS View has two types of keys:
ABAP CDS- DEFINE VIEW parameter list
Syntax:
.....WITH PARAMETERS pname1:parameter type,pname2...
Effect: Defines Input parameters pname1,pname2 in a CDS View in ABAP CDS in a comma separated list. Each input parameter must be typed with a data type parameter type.
.
Example:
The following CDS View has a list of two input parameters in the WHERE Clause of the SELECT statement.
@AbapCatalog.sqlViewName:'DEMO_INPUT_CDS'
Define view demo_parameters_cds
With parameters p_country:LAND1_GP,
p_region:REGIO
as Select from KNA1
{ key kunnr,
land1 as Country key,
name1,
ort01 as City,
region as Region
} where land1 = : p_country and regio = : p_region;
Steps to be shown in this document:
1.Define input parameters in a CDS View.
2.Use input parameters in a CDS View.
@AbapCatalog.sqlViewName:'ZCDS_DDL_IP1'
@EnduserTextLabel :'ABAP CDS View with input parameters'
Define view ZCDS_DD1_IP_TEST
With parameters matnr:abap.numc(18),
Lang:abap.char(1)
As select from mara as a
inner join makt as b
on a.matnr = b.matnr
{
key a.matnr as material,
b.maktx as description,
$parameters.Lang as language
} where a.matnr = $parameters.matnr and b.spras = $parameters.Lang;
3.Define a Parameterized view.
Shown the material description as per the language specified on input parameter.
4.Call a parameterized view with open SQL.
Define view ZCDS_DD1_IP_CALLCDS
With parameters matnr:abap.numc(18),
Lang:abap.char(1)
As select * from ZCDS_DD1_IP_TEST(matnr:$parameters.matnr,lang:$parameters.Lang)
Reference Links:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
3 | |
3 | |
2 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 |