I_MatlSerialNumberInformation

DDL: I_MATLSERIALNUMBERINFORMATION Type: view_entity COMPOSITE Package: ODATA_LO_SN_HISTORY

Serial Number Information

I_MatlSerialNumberInformation is a Composite CDS View that provides data about "Serial Number Information" in SAP S/4HANA. It reads from 1 data source (I_Equipment) and exposes 51 fields with key field Equipment. It has 13 associations to related views. Part of development package ODATA_LO_SN_HISTORY.

Data Sources (1)

SourceAliasJoin Type
I_Equipment I_Equipment from

Associations (13)

CardinalityTargetAliasCondition
[0..1] I_EquipmentStockSegment _StockSegment $projection.Equipment = _StockSegment.Equipment
[1..1] I_MasterWrntyObjectAssgmt _CustomerWarranty $projection.MaintObjectInternalID = _CustomerWarranty.ObjectInternalID and _CustomerWarranty.WarrantyType = '1'
[1..1] I_MasterWrntyObjectAssgmt _SupplierWarranty $projection.MaintObjectInternalID = _SupplierWarranty.ObjectInternalID and _SupplierWarranty.WarrantyType = '2'
[1..1] I_MaterialText _MaterialText $projection.Material = _MaterialText.Material and _MaterialText.Language = $session.system_language
[0..1] I_PlantMaintenancePartner _Partner $projection.MaintObjectInternalID = _Partner.MaintObjectInternalID and _Partner.PartnerFunction = 'AG'
[0..*] C_SerialNumberHistoryPartner _PartnerInfo $projection.MaintObjectInternalID = _PartnerInfo.MaintObjectInternalID
[0..1] P_SrlNmbrHistSalesOrderItemTxt _SalesOrderItemText $projection.Equipment = _SalesOrderItemText.Equipment
[1..1] I_User _User $projection.CreatedByUser = _User.UserID
[1..1] P_SrlNmbrHistMaterialGroup _MaterialGroup $projection.Material = _MaterialGroup.Material
[0..1] I_Supplier _StockOwner $projection.StockOwner = _StockOwner.Supplier
[0..1] I_Plant _Plant $projection.Plant = _Plant.Plant
[0..1] I_StorageLocation _StorageLocation $projection.Plant = _StorageLocation.Plant and $projection.StorageLocation = _StorageLocation.StorageLocation
[0..*] I_SerialNumberHistory _SrlNmbrHistory

Annotations (7)

NameValueLevelField
AccessControl.authorizationCheck #MANDATORY view
AccessControl.personalData.blocking #NOT_REQUIRED view
EndUserText.label Serial Number Information view
ObjectModel.usageType.dataClass #TRANSACTIONAL view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.usageType.sizeCategory #XL view
VDM.viewType #COMPOSITE view

Fields (51)

KeyFieldSource TableSource FieldDescription
KEY Equipment Equipment
Material Material
SerialNumber SerialNumber
MasterWarranty MasterWarranty
MaintObjectInternalID MaintObjectInternalID
HasEquipmentData
CreatedByUser CreatedByUser
UserDescription _User UserDescription
CreationDate CreationDate
ValidityStartDate ValidityStartDate
ValidityEndDate ValidityEndDate
Plant
StorageLocation
Customer
Supplier
SalesOrder
SalesOrderItem
InventorySpecialStockType
WBSElementInternalID
WBSElement
WBSDescription
Batch
InventoryStockType
StockOwner
InventorySpecialStockTypeName
InventoryStockTypeName
MaterialName _MaterialText MaterialName
TechObjCustomerMasterWarranty
TechObjCustWarrantyStartDate _CustomerWarranty WarrantyStartDate
TechObjCustWarrantyEndDate _CustomerWarranty WarrantyEndDate
TechObjSuplrWarrantyStartDate _SupplierWarranty WarrantyStartDate
TechObjSupplierMasterWarranty
TechObjSuplrWarrantyEndDate _SupplierWarranty WarrantyEndDate
MaintenancePartner
BusinessPartnerName
SalesOrderItemText _SalesOrderItemText SalesOrderItemText
CustomerWarrantyName
SupplierWarrantyName
MaterialGroup _MaterialGroup MaterialGroup
MaterialGroupName _MaterialGroup MaterialGroupName
CustomerName
SupplierName
StockOwnerName
_SrlNmbrHistory _SrlNmbrHistory
_Material _Material
_CustomerWarranty _CustomerWarranty
_SupplierWarranty _SupplierWarranty
_PartnerInfo _PartnerInfo
_StockOwner _StockOwner
_Plant _Plant
_StorageLocation _StorageLocation
@AccessControl.authorizationCheck: #MANDATORY
@AccessControl.personalData.blocking: #NOT_REQUIRED

@EndUserText.label: 'Serial Number Information'

@ObjectModel.supportedCapabilities: [ #SQL_DATA_SOURCE, #CDS_MODELING_DATA_SOURCE, #CDS_MODELING_ASSOCIATION_TARGET ]
@ObjectModel.usageType: { dataClass: #TRANSACTIONAL, serviceQuality: #C, sizeCategory: #XL }

@VDM.viewType: #COMPOSITE

define root view entity I_MatlSerialNumberInformation

  as select from I_Equipment

  composition [0..*] of I_SerialNumberHistory          as _SrlNmbrHistory

  association [0..1] to I_EquipmentStockSegment        as _StockSegment
    on $projection.Equipment = _StockSegment.Equipment

  association [1..1] to I_MasterWrntyObjectAssgmt      as _CustomerWarranty
    on  $projection.MaintObjectInternalID = _CustomerWarranty.ObjectInternalID
    and _CustomerWarranty.WarrantyType    = '1'

  association [1..1] to I_MasterWrntyObjectAssgmt      as _SupplierWarranty
    on  $projection.MaintObjectInternalID = _SupplierWarranty.ObjectInternalID
    and _SupplierWarranty.WarrantyType    = '2'

  association [1..1] to I_MaterialText                 as _MaterialText
    on  $projection.Material   = _MaterialText.Material
    and _MaterialText.Language = $session.system_language

  association [0..1] to I_PlantMaintenancePartner      as _Partner
    on  $projection.MaintObjectInternalID = _Partner.MaintObjectInternalID
    and _Partner.PartnerFunction          = 'AG'

  association [0..*] to C_SerialNumberHistoryPartner   as _PartnerInfo
    on $projection.MaintObjectInternalID = _PartnerInfo.MaintObjectInternalID

  association [0..1] to P_SrlNmbrHistSalesOrderItemTxt as _SalesOrderItemText
    on $projection.Equipment = _SalesOrderItemText.Equipment

  association [1..1] to I_User                         as _User
    on $projection.CreatedByUser = _User.UserID

  association [1..1] to P_SrlNmbrHistMaterialGroup     as _MaterialGroup
    on $projection.Material = _MaterialGroup.Material

  association [0..1] to I_Supplier                     as _StockOwner
    on $projection.StockOwner = _StockOwner.Supplier

  association [0..1] to I_Plant                        as _Plant
    on $projection.Plant = _Plant.Plant

  association [0..1] to I_StorageLocation              as _StorageLocation
    on  $projection.Plant           = _StorageLocation.Plant
    and $projection.StorageLocation = _StorageLocation.StorageLocation

{
  key Equipment,
      Material,
      SerialNumber,
      MasterWarranty,
      MaintObjectInternalID,
      cast(HasEquipmentData as abap_boolean preserving type)                                                            as HasEquipmentData,
      CreatedByUser,
      _User.UserDescription,
      CreationDate,
      ValidityStartDate,
      ValidityEndDate,
      cast(coalesce(_StockSegment.Plant, '') as werks_d preserving type)                                                as Plant,
      cast(coalesce(_StockSegment.StorageLocation, '') as lgort_d preserving type)                                      as StorageLocation,
      cast(coalesce(_StockSegment.Customer, '') as b_kunnr preserving type)                                             as Customer,
      cast(coalesce(_StockSegment.Supplier, '') as b_lifnr preserving type)                                             as Supplier,
      cast(coalesce(_StockSegment.SalesOrder, '') as kdauf preserving type)                                             as SalesOrder,
      cast(coalesce(_StockSegment.SalesOrderItem, '') as kdpos)                                                         as SalesOrderItem,
      cast(coalesce(_StockSegment.InventorySpecialStockType, '') as sobkz preserving type)                              as InventorySpecialStockType,
      cast(_StockSegment.WBSElementInternalID as nsdm_wbselement_internal_id preserving type)                           as WBSElementInternalID,
      cast(coalesce(_StockSegment._WBSElementBasicData.WBSElementExternalID, '') as ps_posid_edit preserving type)      as WBSElement,
      _StockSegment._WBSElementBasicData.WBSDescription,
      cast(coalesce(_StockSegment.Batch, '') as b_charge preserving type)                                               as Batch,
      cast(coalesce(_StockSegment.InventoryStockType, '') as lbbsa preserving type)                                     as InventoryStockType,
      cast(coalesce(_StockSegment.StockOwner, '') as owner_d preserving type)                                           as StockOwner,
      _StockSegment._InventorySpecialStockType._Text[1: Language = $session.system_language].InventorySpecialStockTypeName,
      _StockSegment._InventoryStockType._Text[1: Language = $session.system_language].InventoryStockTypeName,
      _MaterialText.MaterialName,
      cast(coalesce(_CustomerWarranty.MasterWarranty, '') as mganr preserving type)                                     as TechObjCustomerMasterWarranty,
      _CustomerWarranty.WarrantyStartDate                                                                               as TechObjCustWarrantyStartDate,
      _CustomerWarranty.WarrantyEndDate                                                                                 as TechObjCustWarrantyEndDate,
      _SupplierWarranty.WarrantyStartDate                                                                               as TechObjSuplrWarrantyStartDate,
      cast(coalesce(_SupplierWarranty.MasterWarranty, '') as mganr preserving type)                                     as TechObjSupplierMasterWarranty,
      _SupplierWarranty.WarrantyEndDate                                                                                 as TechObjSuplrWarrantyEndDate,
      cast(coalesce(ltrim(_Partner.MaintenancePartner, '0'), '') as i_parnr preserving type)                            as MaintenancePartner,
      // Due to truncation issue in KNA1 and LFA1, name and address fields must be fetched from I_Address_2

      _Partner._Customer.BPCustomerFullName                                                                             as BusinessPartnerName,
      _SalesOrderItemText.SalesOrderItemText,

      cast(coalesce(_CustomerWarranty._MasterWarranty._MasterWarrantyText[1: Language = $session.system_language].WarrantyName, '') as losn_customerwarrantyname preserving type)
                                                                                                                        as CustomerWarrantyName,

      cast(coalesce(_SupplierWarranty._MasterWarranty._MasterWarrantyText[1: Language = $session.system_language].WarrantyName, '') as losn_supplierwarrantyname preserving type)
                                                                                                                        as SupplierWarrantyName,

      _MaterialGroup.MaterialGroup,
      _MaterialGroup.MaterialGroupName,

      _StockSegment._Customer.BPCustomerFullName                                                                        as CustomerName,
      _StockSegment._Supplier.BPSupplierFullName                                                                        as SupplierName,
      cast(coalesce(_StockSegment._StockOwner.BPSupplierFullName, '') as losn_stockownerfullname preserving type)       as StockOwnerName,
      
      cast(case HasEquipmentData
             when '' then 'X'
             else ''
           end as abap_boolean preserving type)                                                                         as EquipmentIsHidden,       

      // Associations

      _SrlNmbrHistory,
      _Material,
      _CustomerWarranty,
      _SupplierWarranty,
      _PartnerInfo,
      _StockOwner,
      _Plant,
      _StorageLocation
}

where Material     <> ''
  and SerialNumber <> ''