I_DEFECTCODE

CDS View

Defect Code

I_DEFECTCODE is a CDS View in S/4HANA. Defect Code. It contains 2 fields. 2 CDS views read from this table.

CDS Views using this table (2)

ViewTypeJoinVDMDescription
A_DefectCode view from BASIC Defect Codes
I_DefectCodeStdVH view from COMPOSITE Defect Code

Fields (2)

KeyField CDS FieldsUsed in Views
KEY DefectCode DefectCode 1
KEY DefectCodeGroup DefectCodeGroup 1
@AbapCatalog.sqlViewName: 'IDEFECTCODE'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@ClientHandling.algorithm: #SESSION_VARIABLE
@EndUserText.label: 'Defect Code'
@AccessControl.authorizationCheck: #CHECK
@VDM: {
    viewType:#BASIC,
    lifecycle.contract.type: #PUBLIC_LOCAL_API
}
@ObjectModel.supportedCapabilities:
    [ #SQL_DATA_SOURCE, #CDS_MODELING_DATA_SOURCE, #CDS_MODELING_ASSOCIATION_TARGET ]
@ObjectModel: {
    representativeKey: 'DefectCode',
    usageType: { serviceQuality: #A, sizeCategory: #M, dataClass: #CUSTOMIZING }
}
@Metadata.ignorePropagatedAnnotations: true
define view I_DefectCode as select from qpcd 

   association [1..1] to I_DefectCodeGroup as _DefectCodeGroup on  $projection.DefectCodeGroup = _DefectCodeGroup.DefectCodeGroup
   
   association [0..*] to I_DefectCodeText  as _Text on  $projection.DefectCodeGroup = _Text.DefectCodeGroup
                                                    and $projection.DefectCode      = _Text.DefectCode
                                                    
   association [0..1] to I_DefectClass     as _DefectClass on $projection.DefectClass = _DefectClass.DefectClass
                                                     
{
   @Consumption.valueHelpDefinition: [ 
     { entity:  { name:    'I_DefectCodeGroupStdVH',
                  element: 'DefectCodeGroup' }
     }]
   @ObjectModel.foreignKey.association: '_DefectCodeGroup'
   key cast( qpcd.codegruppe as vdm_qfegrp preserving type )  as DefectCodeGroup,
   @ObjectModel.text.association: '_Text'
   key cast( qpcd.code       as vdm_qfecod preserving type )  as DefectCode,
// key qpcd.version --> is always 1 so we could leave out

   
   // DB field has three values, but field shall be indicator

   @Semantics.booleanIndicator: true
   case qpcd.inaktiv
     when ' ' then cast( ' ' as vdm_qm_codeisinactive preserving type )
     else cast( 'X' as vdm_qm_codeisinactive preserving type )
   end                                                        as CodeIsInactive,
   
   @ObjectModel.foreignKey.association: '_DefectClass'
   qpcd.fehlklasse                                            as DefectClass,
   
   // Associations

   _DefectCodeGroup,
   _Text,
   _DefectClass
    
} where qpcd.katalogart = '9' // Defects

    and qpcd.version    = '000001'
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"QPCD"
],
"ASSOCIATED":
[
"I_DEFECTCLASS",
"I_DEFECTCODEGROUP",
"I_DEFECTCODETEXT"
],
"BASE":
[],
"ANNO_REF":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/