I_SubstanceActiveDraft is a Basic CDS View that provides data about "Active and draft substances" in SAP S/4HANA. It reads from 1 data source (ehfndv_sub) and exposes 3 fields.
--Label of view@EndUserText.label: 'Active and draft substances'
@AbapCatalog:
{
-- SQL view name (16 characters)
sqlViewName: 'ISUBADR',
--If it's true, the filter conditions are compared and, if they match, the associated join expression is evaluated only once
compiler.compareFilter: true
}
--Access Control: Authorizations Checks
@AccessControl:
{
authorizationCheck: #CHECK
}
--Client Handling of the view@ClientHandling.algorithm: #SESSION_VARIABLE
--VDM view type
@VDM.viewType: #BASIC@ObjectModel:
{
--Performance Annotations
usageType:
{
dataClass: #TRANSACTIONAL,
sizeCategory: #M,
serviceQuality: #C
}
}
defineview I_SubstanceActiveDraft
-- Select data from basic view of substance
asselectfrom ehfndv_sub as Substance
-- Join data from draft table of substance => selectwith session user to determine the draft of the own user
leftouter to one join ehfndw_sub as SubstanceDraft on SubstanceDraft.activesubstanceuuid = Substance.substanceuuid
and SubstanceDraft.draftentityoperationcode <> 'D' // IF_DRAFT_CONSTANTS=>co_operation_code-deleted
and SubstanceDraft.draftentityoperationcode <> 'L' // IF_DRAFT_CONSTANTS=>co_operation_code-redeleted
// and SubstanceDraft.lastchangedbyuser = $session.user Todo: Do we need this?
// Todo: Clarify and comment why we need this leftouterjoin at all. Is it because of refreshing listed substance related information after change of listed substance?
{
-- UUID of active substance
key Substance.substanceuuid as ActiveSubstanceUUID,
-- UUID of active or draft substance
casewhen SubstanceDraft.substanceuuid isnotnullthen SubstanceDraft.substanceuuid
else Substance.substanceuuid
endas SubstanceUUID,
-- Listed substance UUID of active or draft substance
casewhen SubstanceDraft.substanceuuid isnotnullthen SubstanceDraft.listedsubstanceuuid
else Substance.listedsubstanceuuid
endas ListedSubstanceUUID,
// needed for DCL
Substance.responsibleunit as ResponsibleUnit
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"EHFNDW_SUB",
"EHFNDV_SUB"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/