C_DefectsByCode

DDL: C_DEFECTSBYCODE SQL: CDEFECTSBYCODE Type: view CONSUMPTION

Defects by Defect Code

C_DefectsByCode is a Consumption CDS View that provides data about "Defects by Defect Code" in SAP S/4HANA. It reads from 1 data source (I_DefectUnion) and exposes 46 fields with key field DefectInternalID. It has 3 associations to related views.

Data Sources (1)

SourceAliasJoin Type
I_DefectUnion I_DefectUnion from

Associations (3)

CardinalityTargetAliasCondition
[1..1] I_WorkCenterBySemanticKey _WorkCenter $projection.MainWorkCenterInternalID = _WorkCenter.WorkCenterInternalID and $projection.MainWorkCenterPlant = _WorkCenter.Plant
[1..1] I_CalendarDate _DefectsWeek $projection.CreationDate = _DefectsWeek.CalendarDate
[0..1] I_Notification _Notification $projection.Notification = _Notification.Notification

Annotations (9)

NameValueLevelField
AbapCatalog.sqlViewName CDEFECTSBYCODE view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #CHECK view
EndUserText.label Defects by Defect Code view
VDM.viewType #CONSUMPTION view
ClientHandling.algorithm #SESSION_VARIABLE view
ObjectModel.usageType.dataClass #TRANSACTIONAL view
ObjectModel.usageType.sizeCategory #L view
ObjectModel.usageType.serviceQuality #C view

Fields (46)

KeyFieldSource TableSource FieldDescription
KEY DefectInternalID I_DefectUnion DefectInternalID
Notification I_DefectUnion Notification
NotificationItem I_DefectUnion NotificationItem
Defect I_DefectUnion Defect
DefectCodeText
DefectCode I_DefectUnion DefectCode Defect Code
DefectCodeGroupText
DefectCodeGroup I_DefectUnion DefectCodeGroup
DefectCodeGroupAndCode
NumberOfDefects I_DefectUnion NumberOfDefects Defects
Material I_DefectUnion Material
Plant I_DefectUnion Plant
InspectionLotOrigin
CreationDate I_DefectUnion CreationDate
Supplier
Customer
DefectCategory I_DefectUnion DefectCategory
DefectClass I_DefectUnion DefectClass
MainWorkCenterInternalID I_DefectUnion MainWorkCenterInternalID
MainWorkCenterPlant I_DefectUnion MainWorkCenterPlant
WorkCenter _WorkCenter WorkCenter
InspectionLotType
Batch
BatchStorageLocation
CalendarWeek _DefectsWeek CalendarWeek
CalendarYear _DefectsWeek CalendarYear
Manufacturer
ManufacturerPartNmbr
PurchasingOrganization
PurchasingDocument
ManufacturingOrder
SalesOrder
DeliveryDocument
SalesOrganization
MaterialByCustomer
InspectionLotHasUsageDecision
InspectionLot InspectionLot
IsBusinessPurposeCompleted _InspectionLot IsBusinessPurposeCompleted
WorkCenterTypeCode I_DefectUnion WorkCenterTypeCode
MainWorkCenter I_DefectUnion MainWorkCenter
_WorkCenter _WorkCenter
_DefectsWeek _DefectsWeek
_Notification _Notification
_InspectionLot _InspectionLot
_DefectCode _DefectCode
_DefectCodeGroup _DefectCodeGroup
@AbapCatalog.sqlViewName: 'CDEFECTSBYCODE'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Defects by Defect Code'
@VDM.viewType: #CONSUMPTION
@ClientHandling.algorithm: #SESSION_VARIABLE

@ObjectModel.usageType: {
    dataClass: #TRANSACTIONAL,
    sizeCategory: #L,
    serviceQuality: #C
}

-- DEPRECATED - This view is deprecated and is no longer used.

define view C_DefectsByCode
  as select from I_DefectUnion
  association [1..1] to I_WorkCenterBySemanticKey as _WorkCenter  on  $projection.MainWorkCenterInternalID = _WorkCenter.WorkCenterInternalID
                                                                  and $projection.MainWorkCenterPlant     = _WorkCenter.Plant
  //Week & Year format

  association [1..1] to I_CalendarDate            as _DefectsWeek on  $projection.CreationDate = _DefectsWeek.CalendarDate
  
  association [0..1] to I_Notification            as _Notification on $projection.Notification = _Notification.Notification
{

      @DefaultAggregation: #NONE
      @ObjectModel.readOnly: true
  key I_DefectUnion.DefectInternalID,
    
      I_DefectUnion.Notification,
      I_DefectUnion.NotificationItem,

      @DefaultAggregation: #NONE
      @ObjectModel.readOnly: true
      I_DefectUnion.Defect,

      @ObjectModel.readOnly: true
      I_DefectUnion._DefectCode._Text[1:Language=$session.system_language].DefectCodeText,

      @ObjectModel: { readOnly: true, text.element:  [ 'DefectCodeText' ], foreignKey.association: '_DefectCode' }
      @EndUserText.label: 'Defect Code'
      I_DefectUnion.DefectCode,

      @ObjectModel.readOnly: true
      I_DefectUnion._DefectCodeGroup._Text[1:Language=$session.system_language].DefectCodeGroupText,

      @ObjectModel: { readOnly: true, text.element:  [ 'DefectCodeGroupText' ], foreignKey.association: '_DefectCodeGroup' }
      I_DefectUnion.DefectCodeGroup,

      @ObjectModel: {
        readOnly: true,
//        sort: { enabled: true, transformedBy: 'ABAP:CL_QM_DEFECT_MANAGE_EXIT' }, -- probably not needed

//        filter: { enabled: true, transformedBy: 'ABAP:CL_QM_DEFECT_MANAGE_EXIT' }, -- probably not needed

        text.element: ['DefectCodeText']
      }
      cast( concat_with_space(I_DefectUnion.DefectCodeGroup, I_DefectUnion.DefectCode, 1) as qdefect_code_group_and_code preserving type ) as DefectCodeGroupAndCode, 
      
      @DefaultAggregation: #SUM
      @ObjectModel.readOnly: true
      @EndUserText.label: 'Defects'
      I_DefectUnion.NumberOfDefects,

      //Fields for filter

      @UI.hidden: true
      I_DefectUnion.Material,

      @UI.hidden: true
      I_DefectUnion.Plant,

      @UI.hidden: true
      I_DefectUnion._InspectionLot.InspectionLotOrigin,

      @UI.hidden: true
      I_DefectUnion.CreationDate,

      @UI.hidden: true
      I_DefectUnion._InspectionLot.Supplier,

      @UI.hidden: true
      I_DefectUnion._InspectionLot.Customer,

      @UI.hidden: true
      I_DefectUnion.DefectCategory,

      @UI.hidden: true
      I_DefectUnion.DefectClass,

      @UI.hidden: true
      I_DefectUnion.MainWorkCenterInternalID,
      
      @UI.hidden: true
      I_DefectUnion.MainWorkCenterPlant,

      @UI.hidden: true
      _WorkCenter.WorkCenter,

      @UI.hidden: true
      I_DefectUnion._InspectionLot.InspectionLotType,

      @UI.hidden: true
      I_DefectUnion._InspectionLot.Batch,

      @UI.hidden: true
      I_DefectUnion._InspectionLot.BatchStorageLocation,

      @UI.hidden: true
      _DefectsWeek.CalendarWeek,

      @UI.hidden: true
      _DefectsWeek.CalendarYear,

      @UI.hidden: true
      I_DefectUnion._InspectionLot.Manufacturer,
      @UI.hidden: true
      I_DefectUnion._InspectionLot.ManufacturerPartNmbr,

      @UI.hidden: true
      I_DefectUnion._InspectionLot.PurchasingOrganization,

      @UI.hidden: true
      I_DefectUnion._InspectionLot.PurchasingDocument,

      @UI.hidden: true
      I_DefectUnion._InspectionLot.ManufacturingOrder,

      @UI.hidden: true
      I_DefectUnion._InspectionLot.SalesOrder,

      @UI.hidden: true
      I_DefectUnion._InspectionLot.DeliveryDocument,

      @UI.hidden: true
      I_DefectUnion._InspectionLot.SalesOrganization,

      @UI.hidden: true
      I_DefectUnion._InspectionLot.MaterialByCustomer,

      @UI.hidden: true
      cast ( I_DefectUnion._InspectionLot.InspectionLotHasUsageDecision as xfeld) as InspectionLotHasUsageDecision,
      
      @Consumption.hidden: true
      InspectionLot,
      
      @Consumption.hidden: true
      _InspectionLot.IsBusinessPurposeCompleted, 

//    Authorization check related fields

      @Consumption.hidden: true
      I_DefectUnion.WorkCenterTypeCode,
      @Consumption.hidden: true
      I_DefectUnion.MainWorkCenter,

      //Associations

      @Consumption.filter.hidden: true
      _WorkCenter,
      @Consumption.filter.hidden: true
      _DefectsWeek,
      @Consumption.filter.hidden: true
      _Notification, //do not publish this association via the OData service, it is just needed for auth. check!

      @Consumption.filter.hidden: true
      @Consumption.hidden: true
      _InspectionLot,
      @Consumption.filter.hidden: true
      _DefectCode,
      @Consumption.filter.hidden: true
      _DefectCodeGroup

} where I_DefectUnion.DefectCode <> '' and I_DefectUnion.DefectCode is not null 
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_CALENDARDATE",
"I_DEFECTCODE",
"I_DEFECTCODEGROUP",
"I_DEFECTCODEGROUPTEXT",
"I_DEFECTCODETEXT",
"I_DEFECTUNION",
"I_INSPECTIONLOT",
"I_WORKCENTERBYSEMANTICKEY"
],
"ASSOCIATED":
[
"I_CALENDARDATE",
"I_DEFECTCODE",
"I_DEFECTCODEGROUP",
"I_INSPECTIONLOT",
"I_NOTIFICATION",
"I_WORKCENTERBYSEMANTICKEY"
],
"BASE":
[
"I_DEFECTUNION"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/