I_MaterialDocumentSerialNumber

DDL: I_MATERIALDOCUMENTSERIALNUMBER Type: view_entity COMPOSITE

Seial Numbers for Material Document

I_MaterialDocumentSerialNumber is a Composite CDS View that provides data about "Seial Numbers for Material Document" in SAP S/4HANA. It reads from 3 data sources (I_PhysInvtryDocSrlNmbr, I_PhysInvtryDocItem, I_SerialNumberMaterialDocument) and exposes 20 fields with key fields Material, SerialNumber, MaterialDocument, MaterialDocumentYear, SerialNumber.

Data Sources (3)

SourceAliasJoin Type
I_PhysInvtryDocSrlNmbr act union
I_PhysInvtryDocItem exp inner
I_SerialNumberMaterialDocument I_SerialNumberMaterialDocument from

Annotations (8)

NameValueLevelField
AccessControl.authorizationCheck #CHECK view
EndUserText.label Seial Numbers for Material Document view
Metadata.ignorePropagatedAnnotations true view
ObjectModel.usageType.serviceQuality #X view
ObjectModel.usageType.sizeCategory #S view
ObjectModel.usageType.dataClass #MIXED view
Search.searchable true view
VDM.viewType #COMPOSITE view

Fields (20)

KeyFieldSource TableSource FieldDescription
KEY Material Material
KEY SerialNumber SerialNumber
KEY MaterialDocument MaterialDocument
KEY MaterialDocumentYear MaterialDocumentYear
Equipment Equipment
MaterialName
PhysicalInventoryDocumentItem
SerialNumberIsInBooks
SerialNumberIsCounted
Material
KEY SerialNumber I_PhysInvtryDocSrlNmbr SerialNumber
KEY MaterialDocument I_PhysInvtryDocItem MaterialDocument
KEY MaterialDocumentItem I_PhysInvtryDocItem MaterialDocumentItem
KEY MaterialDocumentYear I_PhysInvtryDocItem MaterialDocumentYear
Equipment I_PhysInvtryDocSrlNmbr Equipment
MaterialName
PhysicalInventoryDocumentItem I_PhysInvtryDocSrlNmbr PhysicalInventoryDocumentItem
SerialNumberIsInBooks
SerialNumberIsCounted
_Product I_PhysInvtryDocItem _Product
@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Seial Numbers for Material Document'
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType:{
    serviceQuality: #X,
    sizeCategory: #S,
    dataClass: #MIXED
}
@Search.searchable: true
@VDM.viewType: #COMPOSITE

define view entity I_MaterialDocumentSerialNumber
  as select from I_SerialNumberMaterialDocument
{
      @Search.defaultSearchElement: true
  key Material,
      @Search.defaultSearchElement: true
  key SerialNumber,
      @Search.defaultSearchElement: true
  key MaterialDocument,
  key cast ( case _MaterialDocumentItem.HasMultipleAccountAssignment
        when ''
           then MaterialDocumentItem
        else
            _MaterialDocumentItem.MultiAcctAssgmtOriglMatlDocItm
        end as mblpo preserving type )                                 as MaterialDocumentItem,
  key MaterialDocumentYear,
      Equipment,
      _Product._Text[1: Language=$session.system_language].ProductName as MaterialName,
      '000'                                                            as PhysicalInventoryDocumentItem,
      cast('' as boolean preserving type )                             as SerialNumberIsInBooks,
      cast('' as boolean preserving type )                             as SerialNumberIsCounted,
      /* Associations */
      _Product
}
where
  _MaterialDocumentItem.IsAutomaticallyCreated = ''

// The union is added to fetch the serial numbers for the Material Document that has been posted

// against Physical Inventory and the field "modcontrol" is used to decide the visibilty of SerialNumberIsInBooks

// and SerialNumberIsCounted

union select from I_PhysInvtryDocSrlNmbr as act
  inner join      I_PhysInvtryDocItem    as exp on  exp.PhysicalInventoryDocument     = act.PhysicalInventoryDocument
                                                and exp.PhysicalInventoryDocumentItem = act.PhysicalInventoryDocumentItem
                                                and exp.FiscalYear                    = act.FiscalYear
{
  key exp.Material,
  key act.SerialNumber,
  key exp.MaterialDocument,
  key exp.MaterialDocumentItem,
  key exp.MaterialDocumentYear,
      act.Equipment,
      exp._Product._Text[1: Language=$session.system_language].ProductName as MaterialName,
      act.PhysicalInventoryDocumentItem                                    as PhysicalInventoryDocumentItem,
      cast(act.SerialNumberIsInBooks as boolean preserving type )          as SerialNumberIsInBooks,
      cast(act.SerialNumberIsCounted as boolean preserving type )          as SerialNumberIsCounted,


      /* Associations */
      exp._Product
}
where
  (
        act.SerialNumberIsCounted = ''
    and act.SerialNumberIsInBooks = 'X'
  )
  or(
        act.SerialNumberIsCounted = 'X'
    and act.SerialNumberIsInBooks = ''
  )