I_ExistenceCheckOnMatlDocItem

DDL: I_EXISTENCECHECKONMATLDOCITEM Type: view_entity COMPOSITE

Existence Check on Material Doc Item

I_ExistenceCheckOnMatlDocItem is a Composite CDS View that provides data about "Existence Check on Material Doc Item" in SAP S/4HANA. It reads from 1 data source (I_MaterialDocumentRecord) and exposes 3 fields with key fields MaterialDocument, MaterialDocumentItem, MaterialDocumentYear. It has 1 association to related views.

Data Sources (1)

SourceAliasJoin Type
I_MaterialDocumentRecord I_MaterialDocumentRecord from

Associations (1)

CardinalityTargetAliasCondition
[0..*] I_MatDocOvwItmSerialNumber _SerialNo $projection.MaterialDocument = _SerialNo.MaterialDocument and $projection.MaterialDocumentItem = _SerialNo.MaterialDocumentItem and $projection.MaterialDocumentYear = _SerialNo.MaterialDocumentYear

Annotations (8)

NameValueLevelField
AccessControl.authorizationCheck #NOT_REQUIRED view
AccessControl.personalData.blocking #NOT_REQUIRED view
EndUserText.label Existence Check on Material Doc Item view
Metadata.ignorePropagatedAnnotations true view
VDM.viewType #COMPOSITE view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.dataClass #TRANSACTIONAL view

Fields (3)

KeyFieldSource TableSource FieldDescription
KEY MaterialDocument MaterialDocument
KEY MaterialDocumentItem MaterialDocumentItem
KEY MaterialDocumentYear MaterialDocumentYear
//-- This CDS View is intended to check if Material Document Item consists specific fields              --

//-- At the moment based on Material Document Number, Material Document Item and Material Document Year --

//-- existence of Serial Number is being check, this is open for any further improvements/additions     --


@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl: { authorizationCheck: #NOT_REQUIRED,
                  personalData.blocking: #NOT_REQUIRED }
@EndUserText.label: 'Existence Check on Material Doc Item'
@Metadata.ignorePropagatedAnnotations: true
@VDM.viewType: #COMPOSITE
@ObjectModel.usageType:{
    serviceQuality: #C,
    sizeCategory: #XL,
    dataClass: #TRANSACTIONAL
}

define view entity I_ExistenceCheckOnMatlDocItem
  as select from I_MaterialDocumentRecord
  association [0..*] to I_MatDocOvwItmSerialNumber as _SerialNo on  $projection.MaterialDocument     = _SerialNo.MaterialDocument
                                                                and $projection.MaterialDocumentItem = _SerialNo.MaterialDocumentItem
                                                                and $projection.MaterialDocumentYear = _SerialNo.MaterialDocumentYear
{
  key MaterialDocument,
  key MaterialDocumentItem,
  key MaterialDocumentYear,
//      cast(

//            min(case when _SerialNo.SerialNumber is null

//                        then 'X'

//                     else '' end

//           ) as boolean preserving type) as MatlDocHasNoSerializedMaterial,

//      @Semantics.booleanIndicator: true           

//      case min(_SerialNo.PhysicalInventoryDocumentItem)

//           when '000'

//                then 'X'

//           else ''

//            end                          as MatDocHasNoSrlNmbrForPInv


cast(

            // This field is 'X' when either the material in the material document is NOT serialized or

            // the Material is Serialized but it is related to a Physical inventory document, in which case

            // the field below (MatDocHasNoSrlNmbrForPInv) is blank. These fields toggle de visibility 

            // of the two different facets for SNs in the Material Documents Overview App. Therefore, ONLY ONE OF THESE 

            // CAN BE BLANK AT A GIVEN TIME

            min(case when (     ( _SerialNo.SerialNumber is not null and _SerialNo.PhysicalInventoryDocumentItem <> '000' )
                            or  ( _SerialNo.SerialNumber is null )                              
                          )
                        then 'X'
                     else '' end
           ) as boolean preserving type) as MatlDocHasNoSerializedMaterial, 
      
      @Semantics.booleanIndicator: true
      min( case when ( _SerialNo.PhysicalInventoryDocumentItem is null or _SerialNo.PhysicalInventoryDocumentItem = '000' )   
                  then 'X'
                else ''
           end 
         ) as MatDocHasNoSrlNmbrForPInv
}
group by
  MaterialDocument,
  MaterialDocumentItem,
  MaterialDocumentYear,
  _SerialNo.PhysicalInventoryDocumentItem