C_PCTrdScrtSubstVH

DDL: C_PCTRDSCRTSUBSTVH SQL: CPCTRDSCRTSUBVH Type: view CONSUMPTION Package: EHFND_CNS_TS

Substance Indicated as CBI

C_PCTrdScrtSubstVH is a Consumption CDS View that provides data about "Substance Indicated as CBI" in SAP S/4HANA. It reads from 3 data sources (I_ChmlComponent, I_ChmlComposition, I_ChmlCompositionDraft) and exposes 19 fields with key fields ChmlCompositionUUID, SubstanceUUID. It has 4 associations to related views. Part of development package EHFND_CNS_TS.

Data Sources (3)

SourceAliasJoin Type
I_ChmlComponent _ChmlComponent from
I_ChmlComposition _ChmlComposition inner
I_ChmlCompositionDraft _PCTrdScrtDraft inner

Parameters (1)

NameTypeDefault
P_ChmlCompositionUUID sysuuid_x

Associations (4)

CardinalityTargetAliasCondition
[0..1] I_SubstanceTP _Substance _ChmlComponent.SubstanceUUID = _Substance.SubstanceUUID -- Unit Of Measure Value Help
[0..*] I_UnitOfMeasureText _UnitOfMeasureText $projection.ChmlCompReldQtyUnit = _UnitOfMeasureText.UnitOfMeasure --Link to 'Chemcial Compliance Info' as root
[1..1] I_ChmlCmplncInfo _ChmlCmplncInfo $projection.ChmlCmplncInfoUUID = _ChmlCmplncInfo.ChmlCmplncInfoUUID -- Trade Secret Name
[0..1] C_SubstanceTradeSecretTextTP _TradeSecretName $projection.SubstanceUUID = _TradeSecretName.SubstanceUUID

Annotations (14)

NameValueLevelField
EndUserText.label Substance Indicated as CBI view
AbapCatalog.sqlViewName CPCTRDSCRTSUBVH view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #CHECK view
ClientHandling.algorithm #SESSION_VARIABLE view
VDM.viewType #CONSUMPTION view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.sizeCategory #L view
ObjectModel.representativeKey SubstanceUUID view
ObjectModel.dataCategory #VALUE_HELP view
Metadata.ignorePropagatedAnnotations true view
Search.searchable true view

Fields (19)

KeyFieldSource TableSource FieldDescription
KEY ChmlCompositionUUID
KEY SubstanceUUID I_ChmlComponent SubstanceUUID
SubstanceName _Substance SubstanceName
SubstanceInternalName _Substance SubstanceInternalName
CompanySubstanceName _Substance CompanySubstanceName
ECNumberasECNumber
CASNumber
SubstanceTradeSecretName
ResponsibleUnit _Substance ResponsibleUnit
ChmlCompTypeasChmlCompType
ChmlCompTypeNameasChmlCompTypeName
ChmlCompQtyAsTextasChmlCompReldQtyAsText
ChmlCompReldLowrLimitQtyAsText I_ChmlComponent ChmlCompQtyLowerLimitAsText
ChmlCompReldUprLimitQtyOptr I_ChmlComponent ChmlCompOperatorUpperLimit
ChmlCompReldUprLimitQtyAsText I_ChmlComponent ChmlCompQtyUpperLimitAsText
ChmlCompQtyUnitasChmlCompReldQtyUnit
ChmlCmplncInfoUUID I_ChmlComposition ChmlCmplncInfoUUID
_Substance _Substance
_ChmlCmplncInfo _ChmlCmplncInfo
@EndUserText.label: 'Substance Indicated as CBI'
@AbapCatalog.sqlViewName: 'CPCTRDSCRTSUBVH'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@ClientHandling.algorithm: #SESSION_VARIABLE
@VDM.viewType: #CONSUMPTION
@ObjectModel.usageType: {
     serviceQuality:  #C,
     dataClass:       #MIXED,
     sizeCategory:    #L
   }
@ObjectModel.representativeKey: 'SubstanceUUID'
@ObjectModel.semanticKey:  [ 'SubstanceName' ]
@ObjectModel.dataCategory: #VALUE_HELP
@Metadata.ignorePropagatedAnnotations: true

@UI:
{
  presentationVariant:
  {
   requestAtLeast: [ 'SubstanceUUID', 'SubstanceName', 'SubstanceTradeSecretName', 'ChmlCompReldQtyAsText', 'ChmlCompReldLowrLimitQtyOptr', 'ChmlCompReldLowrLimitQtyAsText', 'ChmlCompReldUprLimitQtyOptr', 'ChmlCompReldUprLimitQtyAsText', 'ChmlCompReldQtyUnitText' ]
  }
}

@Search.searchable: true

/*----------------------------------------------------------------------------------------------------------------------
    Value Help view to find and assign produced substances that are not already used in the (draft) composition
------------------------------------------------------------------------------------------------------------------------*/

define view C_PCTrdScrtSubstVH
  with parameters
    P_ChmlCompositionUUID : sysuuid_x

  as select from           I_ChmlComponent                as _ChmlComponent

    inner join             I_ChmlCompositionDraft         as _PCTrdScrtDraft      on _PCTrdScrtDraft.ChmlCompositionUUID = $parameters.P_ChmlCompositionUUID

    inner join             I_ChmlComposition              as _ChmlComposition     on  _ChmlComposition.ChmlCompositionType   = _PCTrdScrtDraft.ProdCmplncLegalAreaRef
                                                                                  and _ChmlComposition.ChmlCompositionUUID   = _ChmlComponent.ChmlCompositionUUID
                                                                                  and _ChmlComposition.ChmlCompositionStatus = 'RE'
                                                                                  and _PCTrdScrtDraft.ChmlCmplncInfoUUID     = _ChmlComposition.ChmlCmplncInfoUUID

  --Join data of draft components of substance-based composition that are already assigned
    left outer to one join I_SubstBsdCmpstnComponentDraft as _PCTrdScrtSubstDraft on  _PCTrdScrtSubstDraft.SubstanceUUID       = _ChmlComponent.SubstanceUUID
                                                                                  and _PCTrdScrtSubstDraft.ChmlCompositionUUID = _PCTrdScrtDraft.ChmlCompositionUUID

  association [0..1] to I_SubstanceTP       as _Substance         on _ChmlComponent.SubstanceUUID = _Substance.SubstanceUUID

  -- Unit Of Measure Value Help
  association [0..*] to I_UnitOfMeasureText as _UnitOfMeasureText on $projection.ChmlCompReldQtyUnit = _UnitOfMeasureText.UnitOfMeasure

  --Link to 'Chemcial Compliance Info' as root
  association [1..1] to I_ChmlCmplncInfo    as _ChmlCmplncInfo    on $projection.ChmlCmplncInfoUUID = _ChmlCmplncInfo.ChmlCmplncInfoUUID
  
  -- Trade Secret Name
  association [0..1] to C_SubstanceTradeSecretTextTP as _TradeSecretName      on $projection.SubstanceUUID = _TradeSecretName.SubstanceUUID

{
      @UI.hidden: true
  key $parameters.P_ChmlCompositionUUID                                                             as ChmlCompositionUUID,

      @UI.hidden: true
      @UI.selectionField.exclude: true
      @Consumption.semanticObject: 'SubstanceUUID'
  key _ChmlComponent.SubstanceUUID                                                                  as SubstanceUUID,

      @UI: {
        lineItem : [{
           position:   10,
           importance: #HIGH
        }]
      }
      _Substance.SubstanceName                                                                      as SubstanceName,

      @Search: {
        defaultSearchElement: true,
        fuzzinessThreshold:   0.8,
        ranking: #LOW
      }
      _Substance.SubstanceInternalName                                                              as SubstanceInternalName,

      //used to search within company substance names

      @UI.hidden:true
      @Search:
      {
        defaultSearchElement: true,
        fuzzinessThreshold:   0.8,
        ranking: #HIGH
      }
      _Substance.CompanySubstanceName                                                               as CompanySubstanceName,

      -- ECNumber
      _Substance._ListedSubstance.ECNumber                                                          as ECNumber,

      @UI: {
        lineItem: [{
          position:   20,
          importance: #MEDIUM
        }]
      }
      _Substance._ListedSubstance.CASNumber                                                         as CASNumber,
      
      @UI: {
        lineItem: [{
          position:   30,
          importance: #MEDIUM,
          label: 'Generic Name'
        }]
      }
      @ObjectModel.readOnly: true
      _TradeSecretName[1:Language = $session.system_language].SubstanceTradeSecretName as SubstanceTradeSecretName,

      @UI.hidden: true
      _Substance.ResponsibleUnit                                                                    as ResponsibleUnit,

      --Role of Ingredient
      @ObjectModel.text.element: [ 'ChmlCompTypeName' ]
      @UI.lineItem: [{ position: 40, importance: #MEDIUM }]
      @UI.textArrangement: #TEXT_ONLY
      _ChmlComponent.ChmlCompType                                                                   as ChmlCompType,

      --Description of Component Type
      @Semantics.text: true
      _ChmlComponent._ComponentType._Text[1: Language = $session.system_language ].ChmlCompTypeName as ChmlCompTypeName,

      --Concentration
      _ChmlComponent.ChmlCompQtyAsText                                                              as ChmlCompReldQtyAsText,

      --Concentration Range
      _ChmlComponent.ChmlCompOperatorLowerLimit                                                     as ChmlCompReldLowrLimitQtyOptr,
      _ChmlComponent.ChmlCompQtyLowerLimitAsText                                                    as ChmlCompReldLowrLimitQtyAsText,
      _ChmlComponent.ChmlCompOperatorUpperLimit                                                     as ChmlCompReldUprLimitQtyOptr,
      _ChmlComponent.ChmlCompQtyUpperLimitAsText                                                    as ChmlCompReldUprLimitQtyAsText,

      -- UoM Code (e.g. PPM)
      @ObjectModel.text.element: ['ChmlCompReldQtyUnitText']
      @ObjectModel.mandatory: true
      _ChmlComponent.ChmlCompQtyUnit                                                                as ChmlCompReldQtyUnit,

      -- UoM Short Text (e.g. ppm)
      @Semantics.text: true
      @ObjectModel.readOnly: true
      _UnitOfMeasureText[1: Language = $session.system_language ].UnitOfMeasureName                 as ChmlCompReldQtyUnitText,

      @UI.hidden: true
      _ChmlComposition.ChmlCmplncInfoUUID,

      _Substance,
      _ChmlCmplncInfo

}
where --Select components which are not already assigned
  _PCTrdScrtSubstDraft.ChmlCompositionUUID is null