0% found this document useful (0 votes)
20 views2 pages

CDS View Day01

Uploaded by

sanjay_abapcrm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views2 pages

CDS View Day01

Uploaded by

sanjay_abapcrm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

Basic CDS with an expression in it

@AbapCatalog.sqlViewName: 'ZNOV_BASIC'
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'First CDS View'
define view ZNOV_BASIC_CDS as select from snwd_bpa {
node_key,
bp_role,
bp_id,
company_name
}

2. Consume The CDS in Program

*&---------------------------------------------------------------------*
*& Report znov_consume_cds_abap
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT znov_consume_cds_abap.

select * from ZNOV_BASIC_CDS into TABLE @data(itab).

cl_demo_output=>display_data(
EXPORTING
value = itab
* name = " Name
).

3. extension of a view which is pre-available

@AbapCatalog.sqlViewAppendName: 'ZNOV_EXTENDSQL'
@EndUserText.label: 'Extension of an CDS'
extend view ZNOV_BASIC_CDS with ZNOV_EXTEND {
email_address
}

4. using aggregation with cds and group by

@AbapCatalog.sqlViewName: 'ZNOV_CDS_INV'
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Invoice header'
define view ZNOV_CDS_INV_DATA as select from snwd_so_inv_head as inv
inner join snwd_bpa as bpa on inv.buyer_guid = bpa.node_key
{
//snwd_so_inv_head
bpa.company_name,
sum(gross_amount) as total_inv_amount,
inv.currency_code

} where inv.payment_status = ''


group by bpa.company_name, inv.currency_code

5. Association Concept in CDS

@AbapCatalog.sqlViewName: 'ZNOV_INV_ASSOC'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Association Example'
define view ZNOV_CDS_ASSOCIATION_INVOICE as select from snwd_so_inv_head as inv
association[1..1] to snwd_bpa as _Supplier
on inv.buyer_guid = _Supplier.node_key
{
key node_key,
buyer_guid,
gross_amount,
net_amount,
tax_amount,
--exposed association: when we directly assign the association name as column
in view
_Supplier,
--Adhoc association: Behaves like actual inner join
_Supplier.company_name
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy