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

13 CDS View Session 01

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)
26 views2 pages

13 CDS View Session 01

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

@AbapCatalog.

sqlViewName: 'ZCDSOCTFIRST'
@[Link]: true
@[Link]: #NOT_REQUIRED
@[Link]: 'My First CDS View - How much i missed you'
define view ZCDS_OCT_FIRST as select from snwd_bpa {
key node_key,
case bp_role
when '01' then 'Supplier'
when '02' then 'Customer'
else 'I donn know'
end as bp_role,
bp_id,
company_name
}

@[Link]: 'ZCDSOCTAGG'
@[Link]: true
@[Link]: #CHECK
@[Link]: 'Aggregation Demo'
define view ZCDS_OCT_AGG as select from snwd_so inner join
snwd_bpa on snwd_so.buyer_guid = snwd_bpa.node_key{

company_name,
sum( gross_amount ) as gross_amount,
snwd_so.currency_code
} group by company_name, snwd_so.currency_code

@[Link]: 'ZCDSOCTASSO'
@[Link]: true
@[Link]: #CHECK
@[Link]: 'Association Example'
define view ZCDS_OCT_ASSOCIATION as select from snwd_so as so
association[1] to snwd_bpa as _BusinessPartners on
so.buyer_guid = _BusinessPartners.node_key
{
--Ad Hoc Association --> SYSTEM WILL PERFORM THE JOIN
_BusinessPartners.company_name,
sum( gross_amount ) as gross_amount
} group by _BusinessPartners.company_name

@[Link]: 'ZCDSOCTASSOEXP'
@[Link]: true
@[Link]: #CHECK
@[Link]: 'Association Example'
@[Link]: true
define view ZCDS_OCT_ASSOCIATION_EXP as select from snwd_so as so
association[1] to snwd_bpa as _BusinessPartners on
$projection.buyer_guid = _BusinessPartners.node_key
{
key so_id,
sum( gross_amount ) as gross_amount,
buyer_guid,
--Exposed Association --> now system will not perform any join
--join will be perform when user/developer request data
--from associated table
_BusinessPartners
} group by so_id, buyer_guid

@[Link]: 'ZCDSOCTPARA'
@[Link]: true
@[Link]: #CHECK
@[Link]: 'Parameterized CDS'
define view ZCDS_OCT_PARAMS
with parameters
p_anubhav : snwd_curr_code
as select from snwd_so {
key node_key,
gross_amount,
currency_code
} where currency_code = $parameters.p_anubhav

@[Link]: 'ZCDSVOV'
@[Link]: true
@[Link]: #CHECK
@[Link]: 'View on View concept'
define view ZCDS_OCT_VOV as select from ZCDS_OCT_PARAMS(p_anubhav:'EUR')
association[1] to snwd_so_i as _Items
on _Items.parent_key = $projection.node_key
{
key node_key,
gross_amount,
_Items

You might also like