P_EquipmentStatus is a Composite CDS View in SAP S/4HANA. It reads from 2 data sources (I_Equipment, I_StatusObjectActiveStatus) and exposes 2 fields with key field Equipment.
@AbapCatalog.sqlViewName: 'PEQUIPMENTSTATUS'
@AbapCatalog.compiler.compareFilter: true@AbapCatalog.preserveKey: true@AccessControl.authorizationCheck: #NOT_REQUIRED@ClientHandling.algorithm: #SESSION_VARIABLE@ObjectModel.usageType: {serviceQuality: #B, sizeCategory: #L, dataClass: #TRANSACTIONAL}@VDM.viewType: #COMPOSITE// technically a BASIC but due to view layering a COMPOSITE)
@VDM.private: true// provides the non-aggregated status
// to be used in aggregation views such as P_OrderStatusAggr only
defineview P_EquipmentStatus
asselectfrom I_Equipment as Equipment
innerjoin I_StatusObjectActiveStatus as jest on jest.StatusObject = Equipment.MaintObjectInternalID
{
key Equipment.Equipment,
Equipment.MaintObjectInternalID,
case jest.StatusCode
when 'I0099' then 'X'
else ''
endas EquipmentIsAvailable,
case jest.StatusCode
when 'I0184' then 'X'
else ''
endas EquipmentIsInWarehouse,
case jest.StatusCode
when 'I0188' then 'X'
else ''
endas EquipmentIsAtCustomer,
case jest.StatusCode
when 'I0186' then 'X'
else ''
endas EquipmentIsAssignedToDelivery,
case jest.StatusCode
when 'I0076' then 'X'
else ''
endas EquipmentIsMarkedForDeletion,
case jest.StatusCode
when 'I0100' then 'X'
else ''
endas EquipmentIsInstalled,
case jest.StatusCode
when 'I0320' then 'X'
else ''
endas EquipmentIsInactive,
case jest.StatusCode
when 'I0116' then 'X'
else ''
endas EquipIsAllocToSuperiorEquip
}
where
(
jest.StatusCode = 'I0099'
or jest.StatusCode = 'I0184'
or jest.StatusCode = 'I0188'
or jest.StatusCode = 'I0186'
or jest.StatusCode = 'I0076'
or jest.StatusCode = 'I0100'
or jest.StatusCode = 'I0320'
or jest.StatusCode = 'I0116'
)
and jest.StatusObject like 'IE%';
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_EQUIPMENT",
"I_STATUSOBJECTACTIVESTATUS"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/