P_AssociatedSubstLglCmpstn

DDL: P_ASSOCIATEDSUBSTLGLCMPSTN Type: view CONSUMPTION Package: EHFND_CNS_CCI

Assoc. Legal Compositon In Process and Released

P_AssociatedSubstLglCmpstn is a Consumption CDS View that provides data about "Assoc. Legal Compositon In Process and Released" in SAP S/4HANA. It reads from 1 data source (I_ChmlComposition) and exposes 8 fields with key field ProdCmplncLegalArea. It has 1 association to related views. Part of development package EHFND_CNS_CCI.

Data Sources (1)

SourceAliasJoin Type
I_ChmlComposition Composition from

Associations (1)

CardinalityTargetAliasCondition
[1..1] P_CChmlCmplConstants _Constants _Constants.Constant1 = _Constants.Constant1

Annotations (7)

NameValueLevelField
EndUserText.label Assoc. Legal Compositon In Process and Released view
AbapCatalog.sqlViewName PAASLCMPS view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #NOT_REQUIRED view
ClientHandling.algorithm #SESSION_VARIABLE view
VDM.viewType #CONSUMPTION view
VDM.private true view

Fields (8)

KeyFieldSource TableSource FieldDescription
ChmlCmplncInfoUUID
ChmlCompositionType
KEY ProdCmplncLegalArea I_ChmlComposition ProdCmplncLegalArea
ChmlCompositionInProcessUUID
ChmlCmpstnInProcIsActiveEntity
ChmlCompositionReleasedUUID
ReleasedByUser
ChmlCmpstnReldIsActiveEntity
@EndUserText.label: 'Assoc. Legal Compositon In Process and Released'
@AbapCatalog:
{
  -- SQL view name (16 characters)
  sqlViewName: 'PAASLCMPS',

  --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: #NOT_REQUIRED
}

--Client Handling of the view
@ClientHandling.algorithm: #SESSION_VARIABLE

--VDM view type
@VDM.viewType: #CONSUMPTION
@VDM.private: true

define view P_AssociatedSubstLglCmpstn
  --Select data from basic view 'Composition'
  as select from           I_ChmlComposition              as Composition

  --Join data from composition with status In Process => Active or draft composition
    left outer to one join P_AssociatedSubstLglProcCmpstn as CompositionInProcess on  Composition.ChmlCmplncInfoUUID  = CompositionInProcess.ChmlCmplncInfoUUID
                                                                                  and Composition.ChmlCompositionType = CompositionInProcess.ChmlCompositionType

  --Join data from composition with status Released => only active chemical composition, because released composition is not editable
    left outer to one join P_AssociatedSubstLglReldCmpstn as CompositionReleased  on  Composition.ChmlCmplncInfoUUID  = CompositionReleased.ChmlCmplncInfoUUID
                                                                                  and Composition.ChmlCompositionType = CompositionReleased.ChmlCompositionType

  /*+[hideWarning] { "IDS" : [ "CARDINALITY_CHECK" ] }*/
  association [1..1] to P_CChmlCmplConstants as _Constants on _Constants.Constant1 = _Constants.Constant1
{
      --UUID of chemical compliance information
  key Composition.ChmlCmplncInfoUUID,

      --Composition Type
  key Composition.ChmlCompositionType,

  key Composition.ProdCmplncLegalArea,

      --UUID of chemical composition in process
      CompositionInProcess.ChmlCompositionInProcessUUID,

      --Status In Process
      case
        when CompositionInProcess.ChmlCmpstnInProcStatus = 'IP'
          then CompositionInProcess.ChmlCmpstnInProcStatus
        when CompositionInProcess.ChmlCmpstnInProcStatus = ''
             or CompositionInProcess.ChmlCmpstnInProcStatus is null
      --Set NE if the In Process Version is not existing
          then _Constants[inner].ConstantNotExisting
      end as ChmlCmpstnInProcStatus,

      --Indicator: Is active entity of chemical composition with status In Process
      CompositionInProcess.ChmlCmpstnInProcIsActiveEntity,

      --UUID of chemical composition released
      CompositionReleased.ChmlCompositionReleasedUUID,

      --Status Released
      case
        when CompositionReleased.ChmlCmpstnReldStatus = 'RE'
          then CompositionReleased.ChmlCmpstnReldStatus
        when CompositionReleased.ChmlCmpstnReldStatus = ''
             or CompositionReleased.ChmlCmpstnReldStatus is null
      --Set NE if the Released Version is not existing
          then _Constants[inner].ConstantNotExisting
      end as ChmlCmpstnReldStatus,

      --Released by User
      CompositionReleased.ReleasedByUser,

      --Indicator: Is active entity of chemical composition with status In Process
      CompositionReleased.ChmlCmpstnReldIsActiveEntity
}
where
  --Only for Released and In Process Compositions
  // Check for ChmlCompositionCategory = 'A' leads to temporary materialization of this view

  // Condition: ChmlCompositionType <> 'ANALYTIC1' and ChmlCompositionType <> 'MATLBSD1' does not lead to materialization.

  //       Composition._CompositionType.ChmlCompositionCategory =  'A'

  //  and  Composition.ChmlCompositionType                      <> 'ANALYTIC1'

  (
        Composition.ChmlCompositionType   <> 'ANALYTIC1'
    and Composition.ChmlCompositionType   <> 'MATLBSD1'
    and Composition.ChmlCompositionType   <> 'MATLBSD2'
    and Composition.ChmlCompositionType   <> 'MCPC'
    and Composition.ChmlCompositionType   <> 'TS'
    and Composition.ChmlCompositionType   <> 'POLYMER'
  )
  and(
        Composition.ChmlCompositionStatus =  'IP'
    or  Composition.ChmlCompositionStatus =  'RE'
  )

group by
  Composition.ChmlCmplncInfoUUID,
  Composition.ChmlCompositionType,
  Composition.ProdCmplncLegalArea,
  CompositionInProcess.ChmlCompositionInProcessUUID,
  CompositionInProcess.ChmlCmpstnInProcStatus,
  CompositionInProcess.ChmlCmpstnInProcIsActiveEntity,
  CompositionReleased.ChmlCompositionReleasedUUID,
  CompositionReleased.ChmlCmpstnReldStatus,
  CompositionReleased.ReleasedByUser,
  CompositionReleased.ChmlCmpstnReldIsActiveEntity,
  _Constants[inner].ConstantNotExisting