R_MatlValnEndgInvtryByKeyDate

DDL: R_MATLVALNENDGINVTRYBYKEYDATE Type: view_entity COMPOSITE Package: FINS_ML_VDM

Ending Invtry Qty and Amount by Date

R_MatlValnEndgInvtryByKeyDate is a Composite CDS View that provides data about "Ending Invtry Qty and Amount by Date" in SAP S/4HANA. It reads from 3 data sources (R_MatlLdgrCrcyTypeMappg, I_GLAccountLineItem, I_Product) and exposes 16 fields with key fields CompanyCode, CostEstimate, Ledger, CurrencyRole. Part of development package FINS_ML_VDM.

Data Sources (3)

SourceAliasJoin Type
R_MatlLdgrCrcyTypeMappg c inner
I_GLAccountLineItem m from
I_Product ma inner

Parameters (1)

NameTypeDefault
P_ValidOnDate fml_date_valid_on

Annotations (8)

NameValueLevelField
AccessControl.personalData.blocking #NOT_REQUIRED view
AccessControl.authorizationCheck #MANDATORY view
EndUserText.label Ending Invtry Qty and Amount by Date view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.usageType.sizeCategory #XXL view
ObjectModel.usageType.dataClass #MIXED view
VDM.lifecycle.contract.type #SAP_INTERNAL_API view
VDM.viewType #COMPOSITE view

Fields (16)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode I_GLAccountLineItem CompanyCode
KEY CostEstimate I_GLAccountLineItem CostEstimate
KEY Ledger I_GLAccountLineItem Ledger
KEY CurrencyRole R_MatlLdgrCrcyTypeMappg CurrencyRole
Material I_GLAccountLineItem Product
ValuationType I_GLAccountLineItem InventoryValuationType
ValuationArea I_GLAccountLineItem ValuationArea
SalesOrder I_GLAccountLineItem InventorySpclStkSalesDocument
SalesOrderItem I_GLAccountLineItem InventorySpclStkSalesDocItm
Supplier I_GLAccountLineItem InventorySpecialStockSupplier
InvtryValnSpecialStockType I_GLAccountLineItem InventorySpecialStockType
Currency R_MatlLdgrCrcyTypeMappg Currency
ValidOnDate
WBSElementInternalID I_GLAccountLineItem InvtrySpclStockWBSElmntIntID
ValuationQuantity
UnitOfMeasure I_Product BaseUnit
@AbapCatalog.viewEnhancementCategory: [ #NONE ]
@AccessControl.personalData.blocking: #NOT_REQUIRED
@AccessControl.authorizationCheck: #MANDATORY
@EndUserText.label: 'Ending Invtry Qty and Amount by Date'
@ObjectModel.usageType: { serviceQuality: #C, sizeCategory: #XXL, dataClass: #MIXED }
@VDM.lifecycle.contract.type: #SAP_INTERNAL_API

@VDM.viewType: #COMPOSITE

define view entity R_MatlValnEndgInvtryByKeyDate
  with parameters
    P_ValidOnDate : fml_date_valid_on

  as select from            I_GLAccountLineItem as m

    inner join              I_Product                  as ma
      on ma.Product = m.Product

    inner join R_MatlLdgrCrcyTypeMappg    as c
      on  m.CompanyCode  = c.CompanyCode
      and m.Ledger = c.Ledger

{
  key m.CompanyCode,                                                             
  key m.CostEstimate,
  key m.Ledger, 
  key c.CurrencyRole                                                              as CurrencyRole,
      cast(concat(c.CurrencyRole,
           concat('/', coalesce(m.Ledger, ' '))) as fml_valncrcyrolesemkey) as MatlLdgrPrValnCrcyRoleSemKey,

      m.Product                                                                   as Material,
      m.InventoryValuationType                                                    as ValuationType,
      m.ValuationArea,
      m.InventorySpclStkSalesDocument                                             as SalesOrder,
      m.InventorySpclStkSalesDocItm                                               as SalesOrderItem,
      m.InventorySpecialStockSupplier                                             as Supplier,
      m.InventorySpecialStockType                                                 as InvtryValnSpecialStockType,
      
      c.Currency                                                                  as Currency,
      $parameters.P_ValidOnDate                                                   as ValidOnDate,
      m.InvtrySpclStockWBSElmntIntID                                              as WBSElementInternalID,


      @Semantics.quantity.unitOfMeasure: 'UnitOfMeasure'
      sum(m.ValuationQuantity)                                                    as ValuationQuantity,
      ma.BaseUnit                                                                 as UnitOfMeasure,

      @Semantics.amount.currencyCode: 'Currency'
      sum(case c.JrnlEntrItemCrcyRolePosition when 'H' then cast(m.AmountInCompanyCodeCurrency as fml_salk3)
                      when 'K' then cast(m.AmountInGlobalCurrency as fml_salk3)
                      when 'O' then cast(m.AmountInFreeDefinedCurrency1 as fml_salk3)
                      when 'V' then cast(m.AmountInFreeDefinedCurrency2 as fml_salk3)
                      when 'B' then cast(m.AmountInFreeDefinedCurrency3 as fml_salk3)
                      when 'C' then cast(m.AmountInFreeDefinedCurrency4 as fml_salk3)
                      when 'D' then cast(m.AmountInFreeDefinedCurrency5 as fml_salk3)
                      when 'E' then cast(m.AmountInFreeDefinedCurrency6 as fml_salk3)
                      when 'F' then cast(m.AmountInFreeDefinedCurrency7 as fml_salk3)
                      when 'G' then cast(m.AmountInFreeDefinedCurrency8 as fml_salk3)
                      else cast(0 as fml_salk3)
       end)                                                                       as TotalValuatedStockAmount
}

where m.PostingDate                  <= $parameters.P_ValidOnDate
  and m.TransactionTypeDetermination  = 'BSX'

group by m.Ledger,
         m.CompanyCode,
         m.CostEstimate,
         m.Product,
         m.InventoryValuationType,
         m.ValuationArea,
         m.InventorySpecialStockType,
         m.InventorySpclStkSalesDocument,
         m.InventorySpclStkSalesDocItm,
         m.InventorySpecialStockSupplier,
         m.InvtrySpclStockWBSElmntIntID,
         ma.BaseUnit,
         c.CurrencyRole,
         c.Currency,
         c.JrnlEntrItemCrcyRolePosition