I_ChmlCmplncMktKeyFig

DDL: I_CHMLCMPLNCMKTKEYFIG Type: view COMPOSITE Package: EHFND_BO_CCI

Key Figures for Marketability of Product

I_ChmlCmplncMktKeyFig is a Composite CDS View that provides data about "Key Figures for Marketability of Product" in SAP S/4HANA. It reads from 1 data source (I_ChmlCmplncInfo) and exposes 15 fields with key field ChmlCmplncInfoUUID. It has 7 associations to related views. Part of development package EHFND_BO_CCI.

Data Sources (1)

SourceAliasJoin Type
I_ChmlCmplncInfo _ChmlCmplncInfo from

Associations (7)

CardinalityTargetAliasCondition
[0..1] P_ChmlCmplMktReqAndCovGrpSum _SumReqAndCov $projection.ChmlCmplncInfoUUID = _SumReqAndCov.chemicalcomplianceuuid
[0..1] P_ChmlCmplncInfoRelPPCt _RelatedPPCount $projection.ChmlCmplncInfoUUID = _RelatedPPCount.chemicalcomplianceproduuid
[0..1] P_ChmlCmplMktCovCt _CoverageCt $projection.ChmlCmplncInfoUUID = _CoverageCt.chemicalcomplianceuuid
[0..1] P_ChmlCmplRqRsltInProcCt _ComplReqIpCt $projection.ChmlCmplncInfoUUID = _ComplReqIpCt.ChmlCmplncInfoUUID
[0..1] P_ChmlCmplRqRsltReldCt _ComplReqReCt $projection.ChmlCmplncInfoUUID = _ComplReqReCt.ChmlCmplncInfoUUID
[0..1] P_ChmlCmplRqRsltCt _ComplReqCt $projection.ChmlCmplncInfoUUID = _ComplReqCt.ChmlCmplncInfoUUID
[0..*] I_OTRText _OTRText _OTRText.Language = $session.system_language

Annotations (11)

NameValueLevelField
EndUserText.label Key Figures for Marketability of Product view
AbapCatalog.sqlViewName ICCMKTKEYFIG view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #CHECK view
ClientHandling.algorithm #SESSION_VARIABLE view
VDM.viewType #COMPOSITE view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.sizeCategory #L view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.representativeKey ChmlCmplncInfoUUID view

Fields (15)

KeyFieldSource TableSource FieldDescription
KEY ChmlCmplncInfoUUID I_ChmlCmplncInfo ChmlCmplncInfoUUID
NmbrOfChmlCmplncPckgdProducts
NmbrOfChmlCmplncMktCountries
NmbrOfCmplRqRslts
NmbrOfInProcessCmplRqRslts
NmbrOfReleasedCmplRqRslts
5endasReleasedCmplRqRsltsPct
5endasInProcessCmplRqRsltsPct
ProdStewardshipRespUnit ProdStewardshipRespUnit
MaterialIsSold MaterialIsSold
MaterialIsTransported MaterialIsTransported
MaterialIsSourced MaterialIsSourced
MaterialIsProduced MaterialIsProduced
MaterialIsDisposed MaterialIsDisposed
MaterialIsEmissionRelevant MaterialIsEmissionRelevant
@EndUserText.label: 'Key Figures for Marketability of Product'

@AbapCatalog:
{
  sqlViewName: 'ICCMKTKEYFIG',
  compiler.compareFilter: true,
  preserveKey: true
}

@AccessControl.authorizationCheck: #CHECK

@ClientHandling.algorithm: #SESSION_VARIABLE

@VDM.viewType: #COMPOSITE

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

define view I_ChmlCmplncMktKeyFig
  as select from I_ChmlCmplncInfo as _ChmlCmplncInfo
  association [0..1] to P_ChmlCmplMktReqAndCovGrpSum as _SumReqAndCov   on $projection.ChmlCmplncInfoUUID = _SumReqAndCov.chemicalcomplianceuuid
  association [0..1] to P_ChmlCmplncInfoRelPPCt      as _RelatedPPCount on $projection.ChmlCmplncInfoUUID = _RelatedPPCount.chemicalcomplianceproduuid
  association [0..1] to P_ChmlCmplMktCovCt           as _CoverageCt     on $projection.ChmlCmplncInfoUUID = _CoverageCt.chemicalcomplianceuuid
  association [0..1] to P_ChmlCmplRqRsltInProcCt     as _ComplReqIpCt   on $projection.ChmlCmplncInfoUUID = _ComplReqIpCt.ChmlCmplncInfoUUID
  association [0..1] to P_ChmlCmplRqRsltReldCt       as _ComplReqReCt   on $projection.ChmlCmplncInfoUUID = _ComplReqReCt.ChmlCmplncInfoUUID
  association [0..1] to P_ChmlCmplRqRsltCt           as _ComplReqCt     on $projection.ChmlCmplncInfoUUID = _ComplReqCt.ChmlCmplncInfoUUID
  association [0..*] to I_OTRText                    as _OTRText        on _OTRText.Language = $session.system_language   

{
  key _ChmlCmplncInfo.ChmlCmplncInfoUUID,

      cast(_RelatedPPCount.CountRelPP as ehpma_number_of_pp preserving type )                                                           as NmbrOfChmlCmplncPckgdProducts,

      cast( coalesce(
                concat_with_space( concat_with_space( cast(_SumReqAndCov.SumUnprocessedGroupTotal as abap.char( 20 )),
                         _OTRText[1: OnlnTxtRpstryConceptID = '42F2E9AFC4EF1EE886E15535408E05E2'].Text ,1),
                         cast(_SumReqAndCov.SumRequestedGroupTotal as abap.char(20) ),1 ) ,
                '0') as ehpma_number_of_open_req )                                                                                      as NmbrOfChmlCmplncReqOpnWithTot,

      // Number of all marketability coverages (number of countries)

      cast(_CoverageCt.recordCount as ehpma_number_of_countries preserving type )                                                       as NmbrOfChmlCmplncMktCountries,

      // Number of processed (allowed/not allowed) marketability coverages

      case
        // Is null when no market reuquest exists for the CCI

        when _SumReqAndCov.SumProcessedGroupTotal is null
          then 0
        when _SumReqAndCov.SumProcessedGroupTotal is not null
          then _SumReqAndCov.SumProcessedGroupTotal 
        end 
      as NmbrOfChmlCmplncProcdMktCvrgs,

      // Number of requested coverages

      case
        // Is null when no market reuquest exists for the CCI

        when _SumReqAndCov.SumRequestedGroupTotal is null
          then 0
        when _SumReqAndCov.SumRequestedGroupTotal is not null
          then _SumReqAndCov.SumRequestedGroupTotal
        end
      as NmbrOfChmlCmplncReqReqd,

      // All open (unknown) coverages

      case
        // Is null when no market reuquest exists for the CCI

        when _SumReqAndCov.SumUnprocessedGroupTotal is null
          then 0
        when _SumReqAndCov.SumUnprocessedGroupTotal is not null
          then _SumReqAndCov.SumUnprocessedGroupTotal
        end
      as NmbrOfChmlCmplncReqOpn,

      // Number of compliance requirements processed

      case 
        when _SumReqAndCov.SumRequestedGroupTotal is null or _SumReqAndCov.SumUnprocessedGroupTotal is null
          then 0
        when _SumReqAndCov.SumRequestedGroupTotal is not null and _SumReqAndCov.SumUnprocessedGroupTotal is not null
          then cast((_SumReqAndCov.SumRequestedGroupTotal - _SumReqAndCov.SumUnprocessedGroupTotal) as ehpma_number_of_cov_req preserving type ) 
        end
      as NmbrOfChmlCmplncReqProcd,
      
      cast(_ComplReqCt.recordCount as ehfnd_cci_number_of_crr preserving type )                                                         as NmbrOfCmplRqRslts,

      // Number of compliance requirement results in process

      cast(_ComplReqIpCt.recordCount as ehfnd_cci_number_of_crr_ip preserving type )                                                    as NmbrOfInProcessCmplRqRslts,

      // Number of compliance requirement results released

      cast(_ComplReqReCt.recordCount as ehfnd_cci_number_of_crr_re preserving type )                                                    as NmbrOfReleasedCmplRqRslts,
      
      // - 0.5 as ceil always rounds up

      case 
        when _ComplReqReCt.recordCount = 0 or _ComplReqReCt.recordCount is null
          then 0
        when _ComplReqCt.recordCount = 0 or _ComplReqCt.recordCount is null
          then 0
        else
          ceil( cast( _ComplReqReCt.recordCount as float ) / cast( _ComplReqCt.recordCount as float ) * 100.0 - 0.5 ) 
      end 
      as ReleasedCmplRqRsltsPct,
      
      case 
        when _ComplReqIpCt.recordCount = 0 or _ComplReqIpCt.recordCount is null
          then 0
        when _ComplReqCt.recordCount = 0 or _ComplReqCt.recordCount is null
          then 0
        else
          ceil( cast( _ComplReqIpCt.recordCount as float ) / cast( _ComplReqCt.recordCount as float ) * 100.0 - 0.5 )
      end
      as InProcessCmplRqRsltsPct,
      
      case 
        when _ComplReqReCt.recordCount = 0 or _ComplReqReCt.recordCount is null
          then cast ( concat_with_space( '0', '%', 1 ) as ehfnd_cci_crr_re )
        when _ComplReqCt.recordCount = 0 or _ComplReqCt.recordCount is null
          then cast ( concat_with_space( '0', '%', 1 ) as ehfnd_cci_crr_re )
        else
          cast(
            concat_with_space(
              cast( ceil( cast( _ComplReqReCt.recordCount as float ) / cast( _ComplReqCt.recordCount as float ) * 100.0 - 0.5 ) as abap.char( 12 ) ),
              '%',
              1
            )
          as ehfnd_cci_crr_re )
        end
        as ReleasedCmplRqRsltsPctName,
      
      case 
        when _ComplReqIpCt.recordCount = 0 or _ComplReqIpCt.recordCount is null
          then cast ( concat_with_space( '0', '%', 1 ) as ehfnd_cci_crr_ip )
        when _ComplReqCt.recordCount = 0 or _ComplReqCt.recordCount is null
          then cast ( concat_with_space( '0', '%', 1 ) as ehfnd_cci_crr_ip )
        else
          cast(
            concat_with_space(
              cast( ceil( cast( _ComplReqIpCt.recordCount as float ) / cast( _ComplReqCt.recordCount as float ) * 100.0 - 0.5 ) as abap.char( 12 ) ),
              '%',
              1
            )
          as ehfnd_cci_crr_ip)
      end 
      as InProcessCmplRqRsltsPctName,
      
      
      //Repsonsible Unit & roles - used by the DCL

      ProdStewardshipRespUnit,
      MaterialIsSold,
      MaterialIsTransported,
      MaterialIsSourced,
      MaterialIsProduced,
      MaterialIsDisposed,
      MaterialIsEmissionRelevant
}
where
  //limit key figure calculation only for UPs and PPs

  MaterialIsSold        = 'X'
  or MaterialIsTransported = 'X'
  or MaterialIsProduced    = 'X'