I_RO_SAFTMatlDocLineItem

DDL: I_RO_SAFTMATLDOCLINEITEM Type: view_entity COMPOSITE

RO SAFT Matl Doc Lines

I_RO_SAFTMatlDocLineItem is a Composite CDS View (Cube) that provides data about "RO SAFT Matl Doc Lines" in SAP S/4HANA. It reads from 3 data sources (I_RO_SAFTDocumentTypeMap, I_MaterialDocumentRecord, t001w) and exposes 21 fields with key fields MaterialDocument, MaterialDocumentYear, MaterialDocumentItem, CompanyCode. It has 12 associations to related views.

Data Sources (3)

SourceAliasJoin Type
I_RO_SAFTDocumentTypeMap _DocumentMap inner
I_MaterialDocumentRecord _Matdoc from
t001w _Plant inner

Associations (12)

CardinalityTargetAliasCondition
[0..1] I_CompanyCode _CompanyCode _CompanyCode.CompanyCode = _Matdoc.CompanyCode
[0..1] t001k _ValuationArea _Plant.bwkey = _ValuationArea.bwkey
[0..1] I_RO_SAFTProductValuation _Valuation _Matdoc.StockIdentifyingMaterial = _Valuation.Product and _Plant.bwkey = _Valuation.ValuationArea and _Matdoc.InventoryValuationType = _Valuation.ValuationType
[0..1] I_ProductUnitsOfMeasure _ProductUom _Matdoc.Material = _ProductUom.Product and _Matdoc.MaterialBaseUnit = _ProductUom.AlternativeUnit
[0..1] I_RO_SAFTUnitOfMeasureMap _Uom _Matdoc.MaterialBaseUnit = _Uom.SourceUnitOfMeasure
[0..*] I_RO_BusinessPartnerTaxType _DCustomer _DCustomer.BusinessPartner = _Matdoc.Customer and _DCustomer.BusinessPartnerIsSAFTRelevant = 'X' and _DCustomer.TaxType = '6' and _DCustomer.FinancialAccountType = 'D' and _DCustomer.ValidFrom <= $session.system_date and _DCustomer.ValidTo >= $session.system_date and _DCustomer.VATRegistration is not initial
[0..*] I_RO_BusinessPartnerTaxType _KSupplier _KSupplier.BusinessPartner = _Matdoc.Supplier and _KSupplier.BusinessPartnerIsSAFTRelevant = 'X' and _KSupplier.TaxType = '6' and _KSupplier.FinancialAccountType = 'K' and _KSupplier.ValidFrom <= $session.system_date and _KSupplier.ValidTo >= $session.system_date and _KSupplier.VATRegistration is not initial
[0..1] I_RO_SAFTMvtTypeTableEntry _MovementType1 _MovementType1.GoodsMovementType = _Matdoc.GoodsMovementType and _MovementType1.Plant = _Matdoc.Plant and _MovementType1.TargetGLAccount = '' and _MovementType1.AccountingDocumentType = _Matdoc.AccountingDocumentType and _MovementType1.DebitCreditCode = _Matdoc.DebitCreditCode
[0..1] I_RO_SAFTMvtTypeTableEntry _MovementType2 _MovementType2.GoodsMovementType = _Matdoc.GoodsMovementType and _MovementType2.Plant = _Matdoc.Plant and _MovementType2.TargetGLAccount = '' and _MovementType2.AccountingDocumentType = _Matdoc.AccountingDocumentType and _MovementType2.DebitCreditCode = ''
[0..1] I_RO_SAFTMvtTypeTableEntry _MovementType3 _MovementType3.GoodsMovementType = _Matdoc.GoodsMovementType and _MovementType3.Plant = _Matdoc.Plant and _MovementType3.TargetGLAccount = '' and _MovementType3.AccountingDocumentType = '' and _MovementType3.DebitCreditCode = ''
[0..1] I_RO_SAFTMvtTypeTableEntry _MovementType4 _MovementType4.GoodsMovementType = _Matdoc.GoodsMovementType and _MovementType4.Plant = _Matdoc.Plant and _MovementType4.TargetGLAccount = '' and _MovementType4.AccountingDocumentType = '' and _MovementType4.DebitCreditCode = _Matdoc.DebitCreditCode
[0..1] I_RO_SAFTMvtTypeTableEntry _MovementType5 _MovementType5.GoodsMovementType = _Matdoc.GoodsMovementType and _MovementType5.Plant = '' and _MovementType5.TargetGLAccount = '' and _MovementType5.AccountingDocumentType = '' and _MovementType5.DebitCreditCode = ''

Annotations (11)

NameValueLevelField
VDM.viewType #COMPOSITE view
AccessControl.authorizationCheck #MANDATORY view
EndUserText.label RO SAFT Matl Doc Lines view
Metadata.ignorePropagatedAnnotations true view
Metadata.allowExtensions true view
Analytics.internalName #LOCAL view
Analytics.dataCategory #CUBE view
AccessControl.personalData.blocking #NOT_REQUIRED view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.sizeCategory #XXL view
ObjectModel.usageType.dataClass #MIXED view

Fields (21)

KeyFieldSource TableSource FieldDescription
KEY MaterialDocument I_MaterialDocumentRecord MaterialDocument
KEY MaterialDocumentYear I_MaterialDocumentRecord MaterialDocumentYear
KEY MaterialDocumentItem I_MaterialDocumentRecord MaterialDocumentItem
KEY CompanyCode I_MaterialDocumentRecord CompanyCode
Product I_MaterialDocumentRecord Material
Plant I_MaterialDocumentRecord Plant
DebitCreditCode I_MaterialDocumentRecord DebitCreditCode
AccountingDocumentType I_MaterialDocumentRecord AccountingDocumentType
MaterialBaseUnit I_MaterialDocumentRecord MaterialBaseUnit
MatlStkChangeQtyInBaseUnit
PostingDate I_MaterialDocumentRecord PostingDate
DocumentDate I_MaterialDocumentRecord DocumentDate
CompanyCodeCurrency I_MaterialDocumentRecord CompanyCodeCurrency
GoodsMovementStkAmtInCCCrcy I_MaterialDocumentRecord GoodsMovementStkAmtInCCCrcy
CreatedByUser I_MaterialDocumentRecord CreatedByUser
GoodsMovementType I_MaterialDocumentRecord GoodsMovementType
Batch I_MaterialDocumentRecord Batch
MaterialDocumentItemText I_MaterialDocumentRecord MaterialDocumentItemText
SourceUnitOfMeasureFactor _Uom SourceUnitOfMeasureFactor
ValuationGroupingCode _ValuationArea bwmod
ValuationClass _Valuation ValuationClass
@VDM.viewType: #COMPOSITE
@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #MANDATORY
@EndUserText.label: 'RO SAFT Matl Doc Lines'
@Metadata.ignorePropagatedAnnotations: true
@Metadata.allowExtensions:true
@Analytics.internalName:#LOCAL
@Analytics: { dataCategory: #CUBE }
@AccessControl.personalData.blocking: #NOT_REQUIRED
@ObjectModel.usageType:{
  serviceQuality: #D,
  sizeCategory: #XXL,
  dataClass: #MIXED
}
@Consumption.dbHints: ['PREAGGR_BEFORE_JOIN']
define view entity I_RO_SAFTMatlDocLineItem
  as select from I_MaterialDocumentRecord   as _Matdoc

  inner join I_RO_SAFTDocumentTypeMap       as _DocumentMap
                                                          on  _DocumentMap.CompanyCode = _Matdoc.CompanyCode
                                                          and _DocumentMap.AccountingDocumentType = _Matdoc.AccountingDocumentType
                                                          and _DocumentMap.RO_SAFTSourceDocumentType = '05'
  inner join t001w                                        as  _Plant
                                                          on  _Matdoc.Plant = _Plant.werks
  association [0..1] to I_CompanyCode                     as  _CompanyCode
                                                          on  _CompanyCode.CompanyCode = _Matdoc.CompanyCode
  association [0..1] to t001k                             as  _ValuationArea
                                                          on  _Plant.bwkey = _ValuationArea.bwkey
  association [0..1] to I_RO_SAFTProductValuation         as  _Valuation
                                                          on  _Matdoc.StockIdentifyingMaterial = _Valuation.Product
                                                          and _Plant.bwkey = _Valuation.ValuationArea
                                                          and _Matdoc.InventoryValuationType = _Valuation.ValuationType
  association [0..1] to I_ProductUnitsOfMeasure
                                            as _ProductUom
                                                          on  _Matdoc.Material  = _ProductUom.Product
                                                          and _Matdoc.MaterialBaseUnit = _ProductUom.AlternativeUnit
  association [0..1] to I_RO_SAFTUnitOfMeasureMap
                                            as _Uom       on  _Matdoc.MaterialBaseUnit = _Uom.SourceUnitOfMeasure
  association [0..*] to I_RO_BusinessPartnerTaxType
                                            as _DCustomer on  _DCustomer.BusinessPartner = _Matdoc.Customer
                                                          and _DCustomer.BusinessPartnerIsSAFTRelevant = 'X'
                                                          and _DCustomer.TaxType = '6'
                                                          and _DCustomer.FinancialAccountType = 'D'
                                                          and _DCustomer.ValidFrom <= $session.system_date
                                                          and _DCustomer.ValidTo >=  $session.system_date
                                                          and _DCustomer.VATRegistration is not initial
  association [0..*] to I_RO_BusinessPartnerTaxType
                                            as _KSupplier on  _KSupplier.BusinessPartner = _Matdoc.Supplier
                                                          and _KSupplier.BusinessPartnerIsSAFTRelevant = 'X'
                                                          and _KSupplier.TaxType = '6'
                                                          and _KSupplier.FinancialAccountType = 'K'
                                                          and _KSupplier.ValidFrom <= $session.system_date
                                                          and _KSupplier.ValidTo >=  $session.system_date
                                                          and _KSupplier.VATRegistration is not initial
  association [0..1] to I_RO_SAFTMvtTypeTableEntry
                                            as _MovementType1
                                                          on  _MovementType1.GoodsMovementType = _Matdoc.GoodsMovementType
                                                          and _MovementType1.Plant = _Matdoc.Plant
                                                          and _MovementType1.TargetGLAccount = ''
                                                          and _MovementType1.AccountingDocumentType = _Matdoc.AccountingDocumentType
                                                          and _MovementType1.DebitCreditCode = _Matdoc.DebitCreditCode
  association [0..1] to I_RO_SAFTMvtTypeTableEntry
                                            as _MovementType2
                                                          on  _MovementType2.GoodsMovementType = _Matdoc.GoodsMovementType
                                                          and _MovementType2.Plant = _Matdoc.Plant
                                                          and _MovementType2.TargetGLAccount = ''
                                                          and _MovementType2.AccountingDocumentType = _Matdoc.AccountingDocumentType
                                                          and _MovementType2.DebitCreditCode = ''
  association [0..1] to I_RO_SAFTMvtTypeTableEntry
                                            as _MovementType3
                                                          on  _MovementType3.GoodsMovementType = _Matdoc.GoodsMovementType
                                                          and _MovementType3.Plant = _Matdoc.Plant
                                                          and _MovementType3.TargetGLAccount = ''
                                                          and _MovementType3.AccountingDocumentType = ''
                                                          and _MovementType3.DebitCreditCode = ''
  association [0..1] to I_RO_SAFTMvtTypeTableEntry
                                            as _MovementType4
                                                          on  _MovementType4.GoodsMovementType = _Matdoc.GoodsMovementType
                                                          and _MovementType4.Plant = _Matdoc.Plant
                                                          and _MovementType4.TargetGLAccount = ''
                                                          and _MovementType4.AccountingDocumentType = ''
                                                          and _MovementType4.DebitCreditCode = _Matdoc.DebitCreditCode
  association [0..1] to I_RO_SAFTMvtTypeTableEntry
                                            as _MovementType5
                                                          on  _MovementType5.GoodsMovementType = _Matdoc.GoodsMovementType
                                                          and _MovementType5.Plant = ''
                                                          and _MovementType5.TargetGLAccount = ''
                                                          and _MovementType5.AccountingDocumentType = ''
                                                          and _MovementType5.DebitCreditCode = ''
{
  key _Matdoc.MaterialDocument,
  key _Matdoc.MaterialDocumentYear,
  key _Matdoc.MaterialDocumentItem,
  key _Matdoc.CompanyCode,
      concat(
        concat( _Matdoc.CompanyCode, _Matdoc.MaterialDocumentYear ),
        concat( _Matdoc.AccountingDocumentType, _Matdoc.MaterialDocument ) ) as
       BusinessTransactionTypeName,
      _Matdoc.Material as Product,
      _Matdoc.Plant,
      _Matdoc.DebitCreditCode,
      _Matdoc.AccountingDocumentType,
      _Matdoc.MaterialBaseUnit,
      @Semantics: { quantity : {unitOfMeasure: 'MaterialBaseUnit'} }
      cast( _Matdoc.MatlStkChangeQtyInBaseUnit as menge_d ) as MatlStkChangeQtyInBaseUnit,
      _Matdoc.PostingDate,
      _Matdoc.DocumentDate,
      _Matdoc.CompanyCodeCurrency,
      @Semantics: { amount : {currencyCode: 'CompanyCodeCurrency'} }
      _Matdoc.GoodsMovementStkAmtInCCCrcy,
      _Matdoc.CreatedByUser as CreatedByUser,

      cast(
        case
          when _Matdoc.InventorySpecialStockType <> 'K'
            then concat( '00', substring(_CompanyCode.VATRegistration, 3, 20) )
          else
            ( case
                when _DCustomer.VATRegistration is not null
                  then _DCustomer.VATRegistration
                when _DCustomer.VATRegistration is null and _KSupplier.VATRegistration is null
                  then concat( '00', substring(_CompanyCode.VATRegistration, 3, 20) )
                else
                  '0' end )
        end as stceg ) as CustomerVATRegistration,

      cast(
        case
          when _Matdoc.InventorySpecialStockType <> 'K'
            then concat( '00', substring(_CompanyCode.VATRegistration, 3, 20) )
          else
            ( case
                when _KSupplier.VATRegistration is not null
                  then _KSupplier.VATRegistration
                when _KSupplier.VATRegistration is null and _DCustomer.VATRegistration is null
                  then concat( '00', substring(_CompanyCode.VATRegistration, 3, 20) )
                else
                '0' end )
        end as stceg ) as SupplierVATRegistration,

      _Matdoc.GoodsMovementType,
      _Matdoc.Batch,
      _Matdoc.MaterialDocumentItemText,
      _Uom.SourceUnitOfMeasureFactor,

      cast( case
        when _ProductUom.QuantityDenominator is not null
          then _ProductUom.QuantityNumerator / _ProductUom.QuantityDenominator
        else 0
      end as dec_23_3 ) as ConversionFactor,

      case
        when _MovementType1.RO_SAFTMovementType is not initial
          then _MovementType1.RO_SAFTMovementType
        when _MovementType2.RO_SAFTMovementType is not initial
          then _MovementType2.RO_SAFTMovementType
        when _MovementType3.RO_SAFTMovementType is not initial
          then _MovementType3.RO_SAFTMovementType
        when _MovementType4.RO_SAFTMovementType is not initial
          then _MovementType4.RO_SAFTMovementType
        else _MovementType5.RO_SAFTMovementType
      end as RO_SAFTMovementType,

      _ValuationArea.bwmod as ValuationGroupingCode,
      _Valuation.ValuationClass as ValuationClass

} where _Matdoc.MaterialDocumentRecordType = 'MDOC'
  and   _Matdoc.StockIdentifyingMaterial is not initial
  //and   _Matdoc.GoodsMovementStkAmtInCCCrcy is not initial