@AbapCatalog: {
sqlViewName: 'CCRRRMMONITOR',
compiler.compareFilter: true,
preserveKey:true
}
@EndUserText.label: 'Assess Marketability Requirements for Raw Materials'
@AccessControl:
{
authorizationCheck: #MANDATORY,
personalData.blocking: #NOT_REQUIRED
}
@ClientHandling.algorithm: #SESSION_VARIABLE
@VDM.viewType: #CONSUMPTION
@ObjectModel:
{
usageType:
{
dataClass: #MIXED,
sizeCategory: #XL,
serviceQuality: #C
}
}
@Metadata.allowExtensions: true
/*----------------------------------------------------------------------------------------------------------------------
* This view serves as data source for the "Assess CRs for Raw Materials" app, see https://projectportal.int.sap.hana.ondemand.com/projects/ehs.pma.rawmatl.crr.mons1
* This view filters "in process" CRRs and always returns one record for each CRV-CCI combination.
* Multiple countries of the CRV's applicabality area are returned as concatenated list
* See I_CmplRqRsltCombined for further details
*----------------------------------------------------------------------------------------------------------------------*/
/*+[hideWarning] { "IDS" : [ "CARDINALITY_CHECK" ] } */
define view C_CmplRqRsltRawMatlMonitor
as select from I_CmplRqRslt as CmplRqRslt
--CCI data to show the product name and number and to filter by processing level
inner join I_ChmlCmplncInfo as ChmlCmplncInfo on ChmlCmplncInfo.ChmlCmplncInfoUUID = CmplRqRslt.ChmlCmplncInfoUUID
--CRV data to get the name of the given CRV
association [1..1] to I_CmplRqVersEnhanced as _CmplRqVers on $projection.CmplRqVersUUID = _CmplRqVers.CmplRqVersUUID
-- Applicability areas to show the country
association [0..*] to I_CmplRqVersAppltyArea as _CmplRqVersAppltyArea on $projection.CmplRqVersUUID = _CmplRqVersAppltyArea.CmplRqVersUUID
-- These associations are used to get descriptive texts for the corrseponding CCI and CRV
association [1..1] to C_ChmlCmplncPrimMatl as _MaterialDataPrimary on $projection.ChmlCmplncInfoUUID = _MaterialDataPrimary.ChmlCmplncInfoUUID
--Value helps to show translatable, human-readable texts instead of technical codes
association [1..1] to I_ChmlCmplncInfoVH as _ChmlCmplncInfoVH on $projection.ChmlCmplncInfoCombinedName = _ChmlCmplncInfoVH.ChmlCmplncInfoCombinedName
association [0..1] to I_ProductVH as _ProductVH on $projection.Material = _ProductVH.Product
association [0..1] to I_CmplRqRsltMntrMktbltySts as _PreliminaryStsVH on $projection.CmplRqRsltPrelimCmplncSts = _PreliminaryStsVH.CmplRqRsltCmplncSts
-- These assosiations are used to show text for the Marketability Status
association [0..1] to I_CmplncRqmtRsltCmplncStsTxt as _CmplncRqmtRsltCmplncStsTxt on $projection.CmplRqRsltPrelimCmplncSts = _CmplncRqmtRsltCmplncStsTxt.CmplRqRsltCmplncSts
association [0..1] to I_CmplRqRsltRskAssmtStsTxt as _CmplRqRsltRskAssmtStsTxt on $projection.CmplRqRsltPrelimCmplncSts = _CmplRqRsltRskAssmtStsTxt.CmplRqRsltCmplncSts
--required to show a draft-indicator
association [1..1] to C_CmplRqRsltDraftAdminvData as _DraftAdministrativeData on $projection.CmplRqRsltUUID = _DraftAdministrativeData.CmplRqRsltUUID
{
/**** Keys ****/
key CmplRqRslt.CmplRqRsltUUID,
CmplRqRslt.ChmlCmplncInfoUUID,
CmplRqRslt.CmplRqVersUUID,
/**** Content ****/
//====================================================================================================
// Compliance Requirement Version
//====================================================================================================
@ObjectModel.text.element: [ 'CmplRqVersName' ]
cast(_CmplRqVers.CmplRqVers
as ehpma_crv_mkt_id preserving type ) as CmplRqVers,
// TODO: Clarify, whether we should be able to filter by field "CmplRqVersName"
@Semantics.text: true
@ObjectModel: {
readOnly: true,
virtualElement: true,
virtualElementCalculatedBy: 'ABAP:CL_EHFND_CRV_NAME_EXIT',
sort.enabled: true,
sort.transformedBy: 'ABAP:CL_EHFND_CRV_NAME_EXIT'
}
cast ( ''
as ehpma_crr_crv_mkt_name ) as CmplRqVersName,
@ObjectModel.readOnly: true
_CmplRqVers.CmplRqVersEnglishName as CmplRqVersEnglishName,
_CmplRqVers._CmplRqVersTextInCurrentLang.CmplRqVersName as CmplRqVersNameInCurLang,
//====================================================================================================
// Compliance Requirement
//====================================================================================================
@Consumption.valueHelpDefinition: [{
entity: {
name: 'C_CmplRqForProdMarketabilityVH',
element: 'ComplianceRequirement'
}
}]
@Semantics.text: true
CmplRqRslt.ComplianceRequirement as ComplianceRequirement,
//====================================================================================================
// Chemical Compliance Information (CCI)
//====================================================================================================
---- CCI Combined Name (either material or internal name ----
-- Combined Name doesn't support search since coalesced, as an alternative search by internal name and product/material name
@Consumption.valueHelpDefinition.association: '_ChmlCmplncInfoVH'
@Semantics.text: true
@ObjectModel: {
readOnly: true,
virtualElement,
virtualElementCalculatedBy: 'ABAP:CL_EHFND_CCI_PRIMMATL_EXIT'
}
cast( ''
as ehfnd_cci_raw_material_name ) as ChmlCmplncInfoCombinedName,
---- CCI Internal Name ----
-- this field is needed as workaround to search for the product's name(s)
-- in addition, it shall be usable as an optional column and filter
ChmlCmplncInfo.ChmlCmplncInternalName as ChmlCmplncInternalName,
---- CCI "Product" Name ----
-- this field is only needed as workaround to search for the product's name(s)
_MaterialDataPrimary.MaterialName as ProductName,
---- Product/Material Number ----
-- Combined Material doesn't support search since calculated, therefore we search for the material only
@Semantics.text: true
@Consumption.valueHelpDefinition.association: '_ProductVH'
_MaterialDataPrimary.Material as Material,
// Just defined because it is a mandatory input parameter for VDE ABAP:CL_EHFND_CCI_PRIMMATL_EXIT
cast( ''
as ehfnd_cci_is_researched ) as ChmlCmplncProdIsResearched,
//====================================================================================================
// Preliminary Compliance Status
//====================================================================================================
@Consumption.valueHelpDefinition.association: '_PreliminaryStsVH'
cast(CmplRqRslt.CmplRqRsltPrelimCmplncSts
as ehpma_crr_mkt_status preserving type ) as CmplRqRsltPrelimCmplncSts,
// Resolving dynamic compliance/marketability status texts via a "case" expression like
// this constitutes a pragmatic, intermediate solution to a general issue regarding the
// extensibility of the compliance/marketability status, as described in backlog item
// PSSTEAM1-3544. For the long-term refactoring aiming to solve this issue please refer to
// backlog item PSSTEAM1-3639.
case
// "Customer Compliance Check"-related risk assessments of products
when _CmplRqVers.CmplRqPattern = 'CompliancePatternCustCmplncChk' and CmplRqRslt.ChmlCmplncInfoUUID is not null
then _CmplRqRsltRskAssmtStsTxt[1: Language = $session.system_language ].CmplRqRsltCmplncStsTxt
// Other compliance requirement results
else
_CmplncRqmtRsltCmplncStsTxt[1: Language = $session.system_language ].CmplRqRsltCmplncStsTxt
end as CmplRqRsltPrelimCmplncStsTxt,
//====================================================================================================
// Country/Region
//====================================================================================================
@ObjectModel: {
virtualElement: true,
virtualElementCalculatedBy: 'ABAP:CL_EHFND_CRR_COUNTRY_CALC_EXIT',
filter.transformedBy: 'ABAP:CL_EHFND_CRR_COUNTRY_CALC_EXIT'
}
@Semantics.address.country: true
cast( ''
as ehfnd_countries_id ) as ChmlCmplncMktCnctntdCntry,
@ObjectModel: {
virtualElement: true,
virtualElementCalculatedBy: 'ABAP:CL_EHFND_CRR_COUNTRY_CALC_EXIT',
filter.transformedBy: 'ABAP:CL_EHFND_CRR_COUNTRY_CALC_EXIT'
}
@Semantics.address.country: true
cast( ''
as ehfnd_countries_desc ) as ChmlCmplncMktCnctntdCntryTxt,
//====================================================================================================
// Draft Indicator
//====================================================================================================
@ObjectModel: {
virtualElement: true,
virtualElementCalculatedBy: 'ABAP:CL_EHFND_CRR_DRAFT_IND_EXIT'
}
cast( ''
as boole_d ) as HasDraftEntity,
@ObjectModel: {
virtualElement: true,
virtualElementCalculatedBy: 'ABAP:CL_EHFND_CRR_DRAFT_IND_EXIT'
}
cast( ''
as boole_d ) as IsActiveEntity,
//====================================================================================================
// Processor
//====================================================================================================
// This Value help defintion is necessary, that the Service contains the entityset for the Change Processor Breakout Action
@Consumption.valueHelpDefinition: [
{ entity: { name: 'C_CmplRqRsltProcessorVH',
element: 'Processor' }
}]
@ObjectModel.text.element: [ 'CmplRqRsltProcessorName' ]
CmplRqRslt.Processor as Processor,
@Semantics.text: true
@ObjectModel: {
readOnly: true,
virtualElement,
virtualElementCalculatedBy: 'ABAP:CL_EHFND_CRR_PROCESSOR_EXIT'
}
cast( ''
as ad_namtext ) as CmplRqRsltProcessorName,
//====================================================================================================
// Compliance Requirement Pattern
//====================================================================================================
_CmplRqVers.CmplRqPattern as CmplRqPattern,
/**** Associations ****/
_PreliminaryStsVH,
_CmplRqVersAppltyArea,
_ChmlCmplncInfoVH,
_ProductVH,
_DraftAdministrativeData,
_CmplRqVers,
---- needed for authorization checks ----
CmplRqRslt._ChmlCmplncInfo
}
---- restrict on 'In Process' CRRs
where
CmplRqRslt.CmplRqRsltProcessingStatus = 'IP'
and ChmlCmplncInfo.MaterialIsSourced = 'X'
and _CmplRqVers.CmplRqApplicationComponent = 'PMA'
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"C_CHMLCMPLNCPRIMMATL",
"I_CHMLCMPLNCINFO",
"I_CMPLNCRQMTRSLTCMPLNCSTSTXT",
"I_CMPLRQRSLT",
"I_CMPLRQRSLTRSKASSMTSTSTXT",
"I_CMPLRQVERSENHANCED",
"I_CMPLRQVERSTEXT"
],
"ASSOCIATED":
[
"C_CHMLCMPLNCPRIMMATL",
"C_CMPLRQRSLTDRAFTADMINVDATA",
"I_CHMLCMPLNCINFO",
"I_CHMLCMPLNCINFOVH",
"I_CMPLNCRQMTRSLTCMPLNCSTSTXT",
"I_CMPLRQRSLTMNTRMKTBLTYSTS",
"I_CMPLRQRSLTRSKASSMTSTSTXT",
"I_CMPLRQVERSAPPLTYAREA",
"I_CMPLRQVERSENHANCED",
"I_PRODUCTVH"
],
"BASE":
[
"I_CMPLRQRSLT"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/