I_SubstanceActiveDraft

DDL: I_SUBSTANCEACTIVEDRAFT Type: view BASIC

Active and draft substances

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.

Data Sources (1)

SourceAliasJoin Type
ehfndv_sub Substance from

Annotations (9)

NameValueLevelField
EndUserText.label Active and draft substances view
AbapCatalog.sqlViewName ISUBADR view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #CHECK view
ClientHandling.algorithm #SESSION_VARIABLE view
VDM.viewType #BASIC view
ObjectModel.usageType.dataClass #TRANSACTIONAL view
ObjectModel.usageType.sizeCategory #M view
ObjectModel.usageType.serviceQuality #C view

Fields (3)

KeyFieldSource TableSource FieldDescription
substanceuuidasActiveSubstanceUUID
substanceuuidendasSubstanceUUID
ResponsibleUnit ehfndv_sub responsibleunit
--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
  }
}

define view I_SubstanceActiveDraft


  -- Select data from basic view of substance
  as select from           ehfndv_sub       as Substance

  
  -- Join data from draft table of substance => select with session user to determine the draft of the own user
    left outer 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 left outer join 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
      case
        when SubstanceDraft.substanceuuid is not null then SubstanceDraft.substanceuuid
        else Substance.substanceuuid
      end                                                                                            as SubstanceUUID,

      -- Listed substance UUID of active or draft substance
      case
        when SubstanceDraft.substanceuuid is not null then SubstanceDraft.listedsubstanceuuid
        else Substance.listedsubstanceuuid
        end
                                                                                                     as 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":""
}
}*/