Академический Документы
Профессиональный Документы
Культура Документы
Products
Products Industries
Industries Support
Support Training
Training Community
Community
Group /
Developer
Developer Partner
Partner About
About
Tutorial
0% 1 2 3 4 5 6 7 8
Create a CDS
view (ABAP)
Julie
12/02/2018
Plummer
Beginner 15 ABAP
min. Development,
Tutorial, Beginner
Provide Feedback
SELECT
statement
CASE statement
WHERE clause
1
Step 1:
Create a
CDS view
1. In the context menu of your
package choose New and then
choose Other ABAP Repository
Object.
Object
Name =
Z_INVOICE_ITEMS
https://developers.sap.com/india/tutorials/abap-dev-adt-create-cds-view.html 2/11
12/21/2018 Create a CDS view (ABAP)
Description = Invoice
Items
2
Step 2:
Enter the
data source
The new view appears in an editor. In
this editor, enter the following values:
3
Step 3: Edit
the SELECT
statement
You will now insert the elds
currency_code and gross_amount
into the SELECT list as follows:
https://developers.sap.com/india/tutorials/abap-dev-adt-create-cds-view.html 4/11
12/21/2018 Create a CDS view (ABAP)
4
Step 4: Use
an existing
CDS
association
You will now model the relationships
between data sources by using some
existing CDS associations. You can
use associations in path expressions
to access elements ( elds and
associations) in related data sources
without specifying JOIN conditions.
You can now display the element info
by positioning the cursor on the data
source name
sepm_sddl_so_invoice_item and
choosing F2
F2.
https://developers.sap.com/india/tutorials/abap-dev-adt-create-cds-view.html 5/11
12/21/2018 Create a CDS view (ABAP)
5
Step 5: Add
elds from
existing
associations
You will now add elds of related data
sources to the SELECT list of
Z_Invoice_Items, using the
associations in path expressions. Each
element in the path expression must
be separated by a period.
https://developers.sap.com/india/tutorials/abap-dev-adt-create-cds-view.html 6/11
12/21/2018 Create a CDS view (ABAP)
6
Step 6: Add
a CASE
statement
If the invoice has been paid, you want
to set the payment_status to X (true).
Do this by implementing a CASE
statement
ABAP Copy
1 case header.payment_status
2 when 'P' then 'X'
3 else ' '
4 end as payment_status
7
Step 7: Add
a WHERE
clause
You will now lter the results so that
only invoice items with
https://developers.sap.com/india/tutorials/abap-dev-adt-create-cds-view.html 7/11
12/21/2018 Create a CDS view (ABAP)
ABAP Copy
8
Step 8:
Check your
code and
view your
changes
Your CDS view should look like this:
ABAP Copy
1 @AbapCatalog.sqlViewName: 'ZI
2 @AbapCatalog.compiler.compare
3 @AccessControl.authorizationC
@EndUserText.label: 'CDS View
https://developers.sap.com/india/tutorials/abap-dev-adt-create-cds-view.html 8/11
12/21/2018 Create a CDS view (ABAP)
Next Steps
https://developers.sap.com/india/tutorials/abap-dev-adt-create-cds-view.html 9/11
12/21/2018 Create a CDS view (ABAP)
Beginner
30 min.
4 tutorials
NEW
ABAP Development: Work
with Core Data Services…
These tutorials show you how to
retrieve data from the database and
display it in a SAP List Viewer (AL…
ABAP Development
Developer Products
ABAP Platform
SAP HANA
All Products
https://developers.sap.com/india/tutorials/abap-dev-adt-create-cds-view.html 10/11
12/21/2018 Create a CDS view (ABAP)
SAP HANA
Site Information
Privacy
Terms of Use
Legal Disclosure
Copyright
Trademark
Cookie Preference
Sitemap
Text View
Newsletter
https://developers.sap.com/india/tutorials/abap-dev-adt-create-cds-view.html 11/11