Joins in cds views
Take two tables
1) zajay_stu
2) zajay_stu1
Apply inner join
@AbapCatalog.sqlViewName: 'ZST_INNER'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'student innerjoin'
define view zast_inner as select from zajay_stu as a
inner join zajay_stu1 as b
on a.zst_id = b.zst_id
{
key a.zst_id as ZstId,
a.zst_name as ZstName,
a.zst_dept as ZstDept,
a.zst_fee as ZstFee,
b.zst_fn as ZstFn,
b.zst_ln as ZstLn
}
output
Apply Left outer join
@AbapCatalog.sqlViewName: 'ZST_INNER'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'student innerjoin'
define view zast_inner as select from zajay_stu as a
left outer join zajay_stu1 as b
on a.zst_id = b.zst_id
{
key a.zst_id as ZstId,
a.zst_name as ZstName,
a.zst_dept as ZstDept,
a.zst_fee as ZstFee,
b.zst_fn as ZstFn,
b.zst_ln as ZstLn
}
output:
Right outer join
@AbapCatalog.sqlViewName: 'ZST_INNER'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'student innerjoin'
define view zast_inner as select from zajay_stu as a
right outer join zajay_stu1 as b
on a.zst_id = b.zst_id
{
key a.zst_id as ZstId,
a.zst_name as ZstName,
a.zst_dept as ZstDept,
a.zst_fee as ZstFee,
b.zst_fn as ZstFn,
b.zst_ln as ZstLn
}
output:
Comments
Post a Comment