P_BasicDescForReldRglnScore

DDL: P_BASICDESCFORRELDRGLNSCORE Type: view COMPOSITE

P_BasicDescForReldRglnScore is a Composite CDS View in SAP S/4HANA. It reads from 7 data sources and exposes 10 fields with key fields ChmlCmplncInfoUUID, CmplRqRsltUUID, CmplRqRsltUUID, FallbackScore.

Data Sources (7)

SourceAliasJoin Type
I_CmplRqRslt I_CmplRqRslt inner
I_CmplRqRslt I_CmplRqRslt inner
I_CmplRqRsltDngrsGdsBscDescT I_CmplRqRsltDngrsGdsBscDescT inner
I_CmplRqRsltDngrsGdsBscDescT I_CmplRqRsltDngrsGdsBscDescT union
I_CmplRqVers I_CmplRqVers from
I_CmplRqVers I_CmplRqVers inner
P_BasicDescForReldRglnMaxCRR P_BasicDescForReldRglnMaxCRR inner

Annotations (10)

NameValueLevelField
AbapCatalog.sqlViewName PDGBDSCFRRS view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #NOT_REQUIRED view
ClientHandling.algorithm #SESSION_VARIABLE view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.usageType.sizeCategory #L view
ObjectModel.usageType.dataClass #MIXED view
VDM.private true view
VDM.viewType #COMPOSITE view

Fields (10)

KeyFieldSource TableSource FieldDescription
KEY ChmlCmplncInfoUUID I_CmplRqRslt ChmlCmplncInfoUUID
KEY CmplRqRsltUUID I_CmplRqRslt CmplRqRsltUUID
CmplRqVersUUID I_CmplRqRslt CmplRqVersUUID
Language I_CmplRqRsltDngrsGdsBscDescT Language
ChmlCmplncInfoUUID
KEY CmplRqRsltUUID I_CmplRqRslt CmplRqRsltUUID
KEY FallbackScore 10
CmplRqVersUUID I_CmplRqRslt CmplRqVersUUID
Language I_CmplRqRsltDngrsGdsBscDescT Language
DangerousGoodBasicDescription I_CmplRqRsltDngrsGdsBscDescT DangerousGoodBasicDescription
@AbapCatalog:{
  sqlViewName: 'PDGBDSCFRRS',
  compiler.compareFilter: true,
  preserveKey: true
}
@AccessControl.authorizationCheck: #NOT_REQUIRED

@ClientHandling.algorithm: #SESSION_VARIABLE

@ObjectModel: {
  usageType: {
    serviceQuality: #C,
    sizeCategory: #L,
    dataClass: #MIXED
  }
}

@VDM: {
  private: true,
  viewType: #COMPOSITE
}

define view P_BasicDescForReldRglnScore

  as select from I_CmplRqVers
    inner join   I_CmplRqRslt                 on  I_CmplRqVers.CmplRqVersUUID          = I_CmplRqRslt.CmplRqVersUUID
                                              and I_CmplRqRslt.CmplRqRsltProcessingStatus = 'RE'
    inner join   I_CmplRqRsltDngrsGdsBscDescT on I_CmplRqRsltDngrsGdsBscDescT.CmplRqRsltUUID = I_CmplRqRslt.CmplRqRsltUUID

{

  key I_CmplRqRslt.ChmlCmplncInfoUUID,
  key I_CmplRqRslt.CmplRqRsltUUID,

  key case
      // Look for CRID UNRTDG in the logon language

    when I_CmplRqRslt.ComplianceRequirement = 'UNRTDG' and Language = $session.system_language
      then 51
      // Fallback same CRID but in English

    when I_CmplRqRslt.ComplianceRequirement = 'UNRTDG' and Language = 'E'
      then 50
      // Fallback same CRID but in English

    when I_CmplRqRslt.ComplianceRequirement = 'IMDG-Code' and Language = 'E'
      then 40
      // Fallback CRID ADR in the logon language

    when I_CmplRqRslt.ComplianceRequirement = 'ADR' and Language = $session.system_language
      then 31
      // Fallback same CRID but in English

    when I_CmplRqRslt.ComplianceRequirement = 'ADR' and Language = 'E'
      then 30
      // Fallback CRID 49 CFR in the logon language

    when I_CmplRqRslt.ComplianceRequirement = '49 CFR' and Language = $session.system_language
      then 21
      // all others

    else 0
  end as FallbackScore,

      I_CmplRqRslt.CmplRqVersUUID,
      I_CmplRqRsltDngrsGdsBscDescT.Language,
      I_CmplRqRsltDngrsGdsBscDescT.DangerousGoodBasicDescription

}
where
      I_CmplRqVers.CmplRqApplicationComponent =  'DG'
  and DangerousGoodBasicDescription              <> ''

// and Look for DG Basic Description on a released CRR for any (the first available) CRID in EN

union select from I_CmplRqRsltDngrsGdsBscDescT
  inner join      I_CmplRqRslt                 on I_CmplRqRsltDngrsGdsBscDescT.CmplRqRsltUUID = I_CmplRqRslt.CmplRqRsltUUID

  inner join      I_CmplRqVers                 on I_CmplRqRslt.CmplRqVersUUID = I_CmplRqVers.CmplRqVersUUID

  inner join      P_BasicDescForReldRglnMaxCRR on  I_CmplRqRsltDngrsGdsBscDescT.CmplRqRsltUUID = P_BasicDescForReldRglnMaxCRR.CmplRqRsltUUID
                                               and I_CmplRqRslt.ChmlCmplncInfoUUID             = P_BasicDescForReldRglnMaxCRR.ChmlCmplncInfoUUID

{
  key I_CmplRqRslt.ChmlCmplncInfoUUID,
  key I_CmplRqRslt.CmplRqRsltUUID,

  key 10 as FallbackScore,

      I_CmplRqRslt.CmplRqVersUUID,
      I_CmplRqRsltDngrsGdsBscDescT.Language,
      I_CmplRqRsltDngrsGdsBscDescT.DangerousGoodBasicDescription

}
where
  Language = 'E'