I_MATERIALDOCUMENTSERIALNUMBER

CDS View

Seial Numbers for Material Document

I_MATERIALDOCUMENTSERIALNUMBER is a CDS View in S/4HANA. Seial Numbers for Material Document. 4 CDS views read from this table.

CDS Views using this table (4)

ViewTypeJoinVDMDescription
I_MatDocOvwItmSerialNumber view_entity from COMPOSITE Serial Number for Material Document Item
I_MaterialDocumentOvwSerialNo view from COMPOSITE Serial Number For Material Document Overview
I_MatlDocOvwItmSrlNmbrPInv view from COMPOSITE Serial Number for Mat Doc Item PI
I_MatlDocOvwSrlNmbrPhysInvtry view from COMPOSITE Serial No for MatDoc Overview PI
@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 = ''
  )
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_MATERIALDOCUMENTITEM",
"I_PHYSINVTRYDOCITEM",
"I_PHYSINVTRYDOCSRLNMBR",
"I_PRODUCT",
"I_PRODUCTTEXT",
"I_SERIALNUMBERMATERIALDOCUMENT"
],
"ASSOCIATED":
[
"I_PRODUCT"
],
"BASE":
[
"I_SERIALNUMBERMATERIALDOCUMENT"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/