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.
$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 !!!!!
$projection.CmplRqVersUUID = _CmplRqVersAppltyArea.CmplRqVersUUID -- Document information to show the language (used in virtual elements coding for filtering)
@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 - allview per country (used in marketability app)
// C_RawChmlCmplncCmplRqRslt - CRRs for raw materials - in progress view// C_ChmlSuplrMatlCmplRqRslt - CRRs for supplier materials
// AllView (In Progress and Released Versions) for SDS Compliance Requirement Results for UPs
defineview C_ChmCmInCmplRqRsltSftyDataSht
asselectfrom 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 asjoin-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: truekey ChmlCmplncInfoUUID,
// UUID of compliance requirement version
@ObjectModel.readOnly: truekey CmplRqVersUUID,
@ObjectModel.readOnly: truekey CmplRqRsltUUID,
@Semantics.text: true@ObjectModel.readOnly: truecast( _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
endas CmplRqRsltCmplncStsCriticality,
-- The else-caseisleft 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
endas 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: truecast( '' 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: truecast( '' as ehsds_crr_langu_text ) as LanguageName,
---- draft data ----
@ObjectModel: {
virtualElement: true,
virtualElementCalculatedBy: 'ABAP:CL_EHFND_CRR_DRAFT_IND_EXIT'
}@ObjectModel.readOnly: truecast( '' as boole_d ) as HasDraftEntity,
@ObjectModel: {
virtualElement: true,
virtualElementCalculatedBy: 'ABAP:CL_EHFND_CRR_DRAFT_IND_EXIT'
}@ObjectModel.readOnly: truecast( '' as boole_d ) as IsActiveEntity,
/* Associations */
_CmplRqVers,
_ChmlCmplncInfo,
_CmplRqVersAppltyArea,
_CmplRqRsltSftyDataShtDoc,
_CmplRqRsltSftyDataShtCntry,
_DraftAdministrativeData
}
where
CmplRqRslt.CmplRqVersUUID isnotnulland _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":""
}
}*/