I_SUBSTANCEACTIVEDRAFT

CDS View

Active and draft substances

I_SUBSTANCEACTIVEDRAFT is a CDS View in S/4HANA. Active and draft substances. It contains 4 fields. 2 CDS views read from this table.

CDS Views using this table (2)

ViewTypeJoinVDMDescription
C_SubstanceListedSubstanceTxt view from CONSUMPTION Listed substance names for a substance
I_SubstActiveDraftLstdSubst view from COMPOSITE Company Substance and related listed sub

Fields (4)

KeyField CDS FieldsUsed in Views
KEY ActiveSubstanceUUID ActiveSubstanceUUID 1
KEY SubstanceUUID SubstanceUUID 2
ListedSubstanceUUID ListedSubstanceUUID 1
ResponsibleUnit ResponsibleUnit 2
--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":""
}
}*/