C_ChmCmInCmplRqRsltSftyDataSht

DDL: C_CHMCMINCMPLRQRSLTSFTYDATASHT SQL: CCCCRRSDS Type: view CONSUMPTION

SDS Compliance Requirement Results for UP

C_ChmCmInCmplRqRsltSftyDataSht is a Consumption CDS View that provides data about "SDS Compliance Requirement Results for UP" in SAP S/4HANA. It reads from 1 data source (I_CmplRqRslt) and exposes 21 fields with key fields ChmlCmplncInfoUUID, CmplRqVersUUID, CmplRqRsltUUID. It has 8 associations to related views.

Data Sources (1)

SourceAliasJoin Type
I_CmplRqRslt CmplRqRslt from

Associations (8)

CardinalityTargetAliasCondition
[0..1] I_CmplRqVersEnhanced _CmplRqVers $projection.CmplRqVersUUID = _CmplRqVers.CmplRqVersUUID -- Applicability areas to show the country (used in virtual elements coding for filtering) "remove it after changing virtual element from CRV to CRR !!!!!
[0..*] I_CmplRqVersAppltyArea _CmplRqVersAppltyArea $projection.CmplRqVersUUID = _CmplRqVersAppltyArea.CmplRqVersUUID -- Document information to show the language (used in virtual elements coding for filtering)
[0..*] I_CmplRqRsltSftyDataShtDoc _CmplRqRsltSftyDataShtDoc $projection.CmplRqRsltUUID = _CmplRqRsltSftyDataShtDoc.CmplRqRsltUUID -- SDS countries (used in virtual elements coding for filtering)
[0..*] I_CmplRqRsltSftyDataShtCntry _CmplRqRsltSftyDataShtCntry $projection.CmplRqRsltUUID = _CmplRqRsltSftyDataShtCntry.CmplRqRsltUUID --
[1..1] I_ChmlCmplncInfo _ChmlCmplncInfo $projection.ChmlCmplncInfoUUID = _ChmlCmplncInfo.ChmlCmplncInfoUUID --required to show a draft-indicator
[1..1] C_CmplRqRsltDraftAdminvData _DraftAdministrativeData $projection.CmplRqRsltUUID = _DraftAdministrativeData.CmplRqRsltUUID
[1..1] P_CChmlCmplConstants _Constants _Constants.Constant1 = _Constants.Constant1
[0..1] I_CmplRqRsltSftyDataShtStsTxt _CmplRqRsltSftyDataShtStsTxt _CmplRqRsltSftyDataShtStsTxt.CmplRqRsltCmplncSts = $projection.CmplRqRsltCalculatedStatus and _CmplRqRsltSftyDataShtStsTxt.SAPDataDictionaryDomain = 'EHSDS_CRR_STATUS' and _CmplRqRsltSftyDataShtStsTxt.Language = $session.system_language

Annotations (16)

NameValueLevelField
AbapCatalog.sqlViewName CCCCRRSDS view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
EndUserText.label SDS Compliance Requirement Results for UP view
AccessControl.authorizationCheck #MANDATORY view
AccessControl.personalData.blocking #NOT_REQUIRED view
ClientHandling.algorithm #SESSION_VARIABLE view
Metadata.allowExtensions true view
VDM.viewType #CONSUMPTION view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.serviceQuality #C view
UI.headerInfo.typeName Safety Data Sheet Assessment view
UI.headerInfo.typeNamePlural Safety Data Sheet Assessments view
UI.headerInfo.title.value CmplRqVersName view
Search.searchable true view

Fields (21)

KeyFieldSource TableSource FieldDescription
KEY ChmlCmplncInfoUUID ChmlCmplncInfoUUID
KEY CmplRqVersUUID CmplRqVersUUID
KEY CmplRqRsltUUID CmplRqRsltUUID
CmplRqVersName
CmplRqVersNameInCurLang
CmplRqVersEnglishName _CmplRqVers CmplRqVersEnglishName
ComplianceRequirement _CmplRqVers ComplianceRequirement
CmplRqPattern _CmplRqVers CmplRqPattern
CmplRqRsltNavgnLink CmplRqRsltUUID
CmplRqRsltCalculatedStatus CmplRqRsltCalculatedStatus
CmplRqRsltCmplncStsTxt
CmplRqRsltProcessingStatus CmplRqRsltProcessingStatus
CountryName
LanguageName
IsActiveEntity
_CmplRqVers _CmplRqVers
_ChmlCmplncInfo _ChmlCmplncInfo
_CmplRqVersAppltyArea _CmplRqVersAppltyArea
_CmplRqRsltSftyDataShtDoc _CmplRqRsltSftyDataShtDoc
_CmplRqRsltSftyDataShtCntry _CmplRqRsltSftyDataShtCntry
_DraftAdministrativeData _DraftAdministrativeData
@AbapCatalog.sqlViewName: 'CCCCRRSDS'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey:true
@EndUserText.label: 'SDS Compliance Requirement Results for UP'

@AccessControl:
{
  authorizationCheck: #MANDATORY,
  // blocking of personal data not required (no personal data fields exposed for material; user can not be blocked)

  personalData.blocking: #NOT_REQUIRED
}

@ClientHandling.algorithm: #SESSION_VARIABLE

@Metadata.allowExtensions: true
@VDM.viewType: #CONSUMPTION

@ObjectModel:
{
  semanticKey:  [ 'CmplRqVersName' ],
  usageType:
  {
    dataClass: #MIXED,
    sizeCategory: #XL,
    // Too many underlying tables, about half of them for reading CRRs of UP and PP.

    // The current requirements would allow to only read the released data and if there is a CRR in progress at all,

    // but we should wait with this adaptation until we are sure that the requirements are stable here.

    // Additionally reading the sample product info should not be needed for the PP (primary material view), but this would only reduce the number by 1.

    serviceQuality: #C
  }
}

@UI:
{
  headerInfo : {
    typeName : 'Safety Data Sheet Assessment',
    typeNamePlural : 'Safety Data Sheet Assessments',
    title.value : 'CmplRqVersName' // Needed to enable CoPilot

  },
  presentationVariant: {
    sortOrder: [ {by: 'CmplRqRsltCmplncStsForSorting', direction: #DESC },
                {by: 'CmplRqVersName', direction: #ASC }],
    requestAtLeast :
    [
      'CmplRqPattern',
      'CmplRqRsltNavgnLink',
      'CmplRqVersName', // Used for draft indicator in UI

      'HasDraftEntity', // Used for draft indicator in UI

      'IsActiveEntity' // Used for draft indicator in UI

    ]
  }
}

--Search
@Search.searchable : true

// JV: brauchen wir diese Erklärungen?

// other CRR views in master data apps:

// C_ChmlCmplncCmplRqRsltInPrgrs - CRRs for UPs and PPs - in progress view

// C_ChmlCmplncMktCmplRqRslt - CRRs for UPs and PPs - all view per country (used in marketability app)

// C_RawChmlCmplncCmplRqRslt - CRRs for raw materials - in progress view

// C_ChmlSuplrMatlCmplRqRslt - CRRs for supplier materials


// All View (In Progress and Released Versions) for SDS Compliance Requirement Results for UPs

define view C_ChmCmInCmplRqRsltSftyDataSht
  as select from I_CmplRqRslt as CmplRqRslt

  -- association to Compliance Requirement Version
  association [0..1] to I_CmplRqVersEnhanced          as _CmplRqVers                  on  $projection.CmplRqVersUUID = _CmplRqVers.CmplRqVersUUID

  -- Applicability areas to show the country (used in virtual elements coding for filtering)      "remove it after changing virtual element from CRV to CRR !!!!!
  association [0..*] to I_CmplRqVersAppltyArea        as _CmplRqVersAppltyArea        on  $projection.CmplRqVersUUID = _CmplRqVersAppltyArea.CmplRqVersUUID

  -- Document information to show the language (used in virtual elements coding for filtering)
  association [0..*] to I_CmplRqRsltSftyDataShtDoc    as _CmplRqRsltSftyDataShtDoc    on  $projection.CmplRqRsltUUID = _CmplRqRsltSftyDataShtDoc.CmplRqRsltUUID

  -- SDS countries (used in virtual elements coding for filtering)
  association [0..*] to I_CmplRqRsltSftyDataShtCntry  as _CmplRqRsltSftyDataShtCntry  on  $projection.CmplRqRsltUUID = _CmplRqRsltSftyDataShtCntry.CmplRqRsltUUID

  -- Association used in DCL to determine responsible unit
  association [1..1] to I_ChmlCmplncInfo              as _ChmlCmplncInfo              on  $projection.ChmlCmplncInfoUUID = _ChmlCmplncInfo.ChmlCmplncInfoUUID

  --required to show a draft-indicator
  association [1..1] to C_CmplRqRsltDraftAdminvData   as _DraftAdministrativeData     on  $projection.CmplRqRsltUUID = _DraftAdministrativeData.CmplRqRsltUUID

  association [1..1] to P_CChmlCmplConstants          as _Constants                   on  _Constants.Constant1 = _Constants.Constant1

  // Recently added

  // Is the calculatedStatus correct as join-condition?

  association [0..1] to I_CmplRqRsltSftyDataShtStsTxt as _CmplRqRsltSftyDataShtStsTxt on  _CmplRqRsltSftyDataShtStsTxt.CmplRqRsltCmplncSts     = $projection.CmplRqRsltCalculatedStatus
                                                                                      and _CmplRqRsltSftyDataShtStsTxt.SAPDataDictionaryDomain = 'EHSDS_CRR_STATUS'
                                                                                      and _CmplRqRsltSftyDataShtStsTxt.Language                = $session.system_language

{
      // UUID of packaged or unpackaged product

      @ObjectModel.readOnly: true
  key ChmlCmplncInfoUUID,

      // UUID of compliance requirement version

      @ObjectModel.readOnly: true
  key CmplRqVersUUID,

      @ObjectModel.readOnly: true
  key CmplRqRsltUUID,

      @Semantics.text: true
      @ObjectModel.readOnly: true
      cast( _CmplRqVers.CmplRqVersName as ehfnd_crr_crv_name preserving type )                  as CmplRqVersName,

      @ObjectModel.readOnly: true
      @Search: { defaultSearchElement: true, fuzzinessThreshold: 0.8 }
      _CmplRqVers._CmplRqVersTextInCurrentLang.CmplRqVersName                                   as CmplRqVersNameInCurLang,

      @ObjectModel.readOnly: true
      @Search: { defaultSearchElement: true, fuzzinessThreshold: 0.8 }
      _CmplRqVers.CmplRqVersEnglishName                                                         as CmplRqVersEnglishName,

      _CmplRqVers.ComplianceRequirement,


      @ObjectModel.readOnly: true
      _CmplRqVers.CmplRqPattern,

      @ObjectModel.readOnly: true
      CmplRqRsltUUID                                                                            as CmplRqRsltNavgnLink,

      @ObjectModel.readOnly: true
      CmplRqRsltCalculatedStatus                                                                as CmplRqRsltCalculatedStatus,

      @ObjectModel.readOnly: true
      @Search: { defaultSearchElement: true, fuzzinessThreshold: 0.8 }
      cast (_CmplRqRsltSftyDataShtStsTxt.CmplRqRsltCmplncStsTxt as ehsds_crr_doc_status_text  ) as CmplRqRsltCmplncStsTxt,

      --Sort sequence of status
      @ObjectModel.readOnly: true
      //      case _CmplRqRsltTransFields.CmplRqRsltCalculatedStatus

      case CmplRqRsltCalculatedStatus
        when '01' then _Constants[inner].Constant3 // available -> green

        when '04' then _Constants[inner].Constant1 // missing -> red

        else _Constants[inner].Constant1           // preserve NULL values

      end                                                                                       as CmplRqRsltCmplncStsCriticality,

      -- The else-case is left out because this might cause performance issues, see https://wiki.wdf.sap.corp/wiki/x/oFNPc

      -- define sort order (unknown, not compliant, compliant, not applicable)
      //      case _CmplRqRsltTransFields.CmplRqRsltCalculatedStatus

      case CmplRqRsltCalculatedStatus
            when '01' then _Constants[inner].Constant3 // available

            when '04' then _Constants[inner].Constant2 // missing

            when ''   then _Constants[inner].Constant0 // Empty value

            else _Constants[inner].Constant0           // preserve NULL values

      end                                                                                       as CmplRqRsltCmplncStsForSorting,


      // todo wieder raus nach Test

      CmplRqRsltProcessingStatus,

      ---- concatenated list of countries ----
      @ObjectModel: {
        virtualElement: true,
        virtualElementCalculatedBy: 'ABAP:CL_EHSDS_CRR_COUNTRIES_LR_EXIT',
        filter.transformedBy: 'ABAP:CL_EHSDS_CRR_COUNTRIES_LR_EXIT'
      }
      // search scope can not contain virtual element fields

      cast( '' as ehfnd_countries_id)                                                           as Country,

      @ObjectModel: {
      virtualElement: true,
      virtualElementCalculatedBy: 'ABAP:CL_EHSDS_CRR_COUNTRIES_LR_EXIT',
      filter.transformedBy: 'ABAP:CL_EHSDS_CRR_COUNTRIES_LR_EXIT'
      }
      @Semantics.address.country: true
      // search scope can not contain virtual element fields

      cast( '' as ehfnd_countries_desc)                                                         as CountryName,

      ---- concatenated list of languages ----
      @ObjectModel: {
        virtualElement: true,
        virtualElementCalculatedBy: 'ABAP:CL_EHSDS_CRR_LANGUAGES_EXIT',
        filter.transformedBy: 'ABAP:CL_EHSDS_CRR_LANGUAGES_EXIT'
      }
      @ObjectModel.readOnly: true
      cast( '' as ehsds_crr_langu_code )                                                        as Language,

      @ObjectModel: {
        virtualElement: true,
        virtualElementCalculatedBy: 'ABAP:CL_EHSDS_CRR_LANGUAGES_EXIT',
        filter.transformedBy: 'ABAP:CL_EHSDS_CRR_LANGUAGES_EXIT'
      }
      @ObjectModel.readOnly: true
      cast( '' as ehsds_crr_langu_text )                                                        as LanguageName,

      ---- draft data ----
      @ObjectModel: {
        virtualElement: true,
        virtualElementCalculatedBy: 'ABAP:CL_EHFND_CRR_DRAFT_IND_EXIT'
      }
      @ObjectModel.readOnly: true
      cast( '' as boole_d )                                                                     as HasDraftEntity,


      @ObjectModel: {
        virtualElement: true,
        virtualElementCalculatedBy: 'ABAP:CL_EHFND_CRR_DRAFT_IND_EXIT'
      }
      @ObjectModel.readOnly: true
      cast( '' as boole_d )                                                                     as IsActiveEntity,

      /* Associations */
      _CmplRqVers,
      _ChmlCmplncInfo,
      _CmplRqVersAppltyArea,
      _CmplRqRsltSftyDataShtDoc,
      _CmplRqRsltSftyDataShtCntry,
      _DraftAdministrativeData
}
where
       CmplRqRslt.CmplRqVersUUID              is not null
  and  _CmplRqVers.CmplRqApplicationComponent = 'SDS'
  and  _CmplRqVers.CmplRqPattern              = 'CompliancePatternSDSManagement'
  and(
       CmplRqRslt.CmplRqRsltProcessingStatus  = 'IP'
    or CmplRqRslt.CmplRqRsltProcessingStatus  = 'RE'
  )
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_CMPLRQRSLT",
"I_CMPLRQRSLTSFTYDATASHTSTSTXT",
"I_CMPLRQVERSENHANCED",
"I_CMPLRQVERSTEXT",
"P_CCHMLCMPLCONSTANTS"
],
"ASSOCIATED":
[
"C_CMPLRQRSLTDRAFTADMINVDATA",
"I_CHMLCMPLNCINFO",
"I_CMPLRQRSLTSFTYDATASHTCNTRY",
"I_CMPLRQRSLTSFTYDATASHTDOC",
"I_CMPLRQRSLTSFTYDATASHTSTSTXT",
"I_CMPLRQVERSAPPLTYAREA",
"I_CMPLRQVERSENHANCED",
"P_CCHMLCMPLCONSTANTS"
],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/