Code: Alles auswählen.
@AbapCatalog.sqlViewName: 'Z_CDS01S'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Test für CDS-View'
define view Z_CDS01
as select from Z_abgtv as abgtv
association [1] to Z_artabgt as _artabgt on _artabgt.abgart = abgtv.abgart
and _artabgt.spras = $session.system_language
association [*] to tfk033d as p000 on p000.buber = 'P000'
and p000.applk = abgtv.applk
and (
p000.key03 = abgtv.hvorg
or p000.key03 = '*'
)
and (
p000.key04 = abgtv.tvorg
or p000.key04 = '*'
)
association [*] to tfk033d as p001 on p001.buber = 'P001'
and p001.applk = abgtv.applk
and p001.key03 = abgtv.hvorg
and p001.key04 = abgtv.tvorg
{
key abgtv.applk as appl,
key abgtv.abgart as abgart,
key abgtv.vavorg as vavorg,
key abgtv.hvorg as hvorg,
key abgtv.tvorg as tvorg,
_artabgt.abgartt as abgartt,
case
when not p000.ktopl is initial then p000.ktopl
when not p001.ktopl is initial then p001.ktopl
else ''
end as ktopl,
case
when not p000.key01 is initial then p000.key01
when not p001.key01 is initial then p001.key01
else ''
end as bukrs,
case
when not p000.key02 is initial then p000.key02
when not p001.key02 is initial then p001.key02
else ''
end as kofi,
p000.fun01 as Saknr_ford,
p001.fun01 as Saknr_ert,
p001.fun04 as co_kontierung
}