P_PurchasingGroupAnalysis2

DDL: P_PURCHASINGGROUPANALYSIS2 SQL: PMMPURGRPAN2 Type: view CONSUMPTION

Purchasing Group Analysis 2

P_PurchasingGroupAnalysis2 is a Consumption CDS View that provides data about "Purchasing Group Analysis 2" in SAP S/4HANA. It reads from 3 data sources (I_CalendarDate, P_PurchaseOrderHistDetail, I_PurchaseOrder) and exposes 19 fields with key fields PurchaseOrder, PurchaseOrderItem, PurchaseOrderTransactionType.

Data Sources (3)

SourceAliasJoin Type
I_CalendarDate CalendarDate inner
P_PurchaseOrderHistDetail P_PurchaseOrderHistDetail from
I_PurchaseOrder PurchaseOrder inner

Parameters (3)

NameTypeDefault
P_DisplayCurrency displaycurrency
P_StartDate bedat
P_EndDate bedat

Annotations (6)

NameValueLevelField
AbapCatalog.sqlViewName PMMPURGRPAN2 view
VDM.viewType #CONSUMPTION view
VDM.private true view
AccessControl.authorizationCheck #CHECK view
EndUserText.label Purchasing Group Analysis 2 view
AccessControl.personalData.blocking #NOT_REQUIRED view

Fields (19)

KeyFieldSource TableSource FieldDescription
KEY PurchaseOrder ItemHistDel PurchaseOrder
KEY PurchaseOrderItem ItemHistDel PurchaseOrderItem
KEY PurchaseOrderTransactionType ItemHistDel PurchaseOrderTransactionType
CompanyCodeCurrency ItemHistDel CompanyCodeCurrency
PostingDate ItemHistDel PostingDate
PurchaseOrderType ItemHistDel PurchaseOrderType
PurchasingGroup ItemHistDel PurchasingGroup
PurchasingOrganization ItemHistDel PurchasingOrganization
Plant Plant
Supplier Supplier
CompanyCode CompanyCode
PurchasingDocumentCategory PurchasingDocumentCategory
PurchasingDocumentStatus I_PurchaseOrder PurchasingDocumentOrigin
CalendarYear I_CalendarDate CalendarYear
CalendarMonth I_CalendarDate CalendarMonth
CalendarQuarter I_CalendarDate CalendarQuarter
CalendarWeek I_CalendarDate CalendarWeek
DisplayCurrency
curr182asTotalInvoiceAmountInDisCrcy
@AbapCatalog.sqlViewName: 'PMMPURGRPAN2'
@VDM.viewType: #CONSUMPTION
//@Analytics.dataCategory: #CUBE

@VDM.private : true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Purchasing Group Analysis 2'
@AccessControl.personalData.blocking: #NOT_REQUIRED
define view P_PurchasingGroupAnalysis2
  with parameters
    P_DisplayCurrency : displaycurrency,
    P_StartDate       : bedat,
    P_EndDate         : bedat
  as select from P_PurchaseOrderHistDetail( P_StartDate: $parameters.P_StartDate, P_EndDate: $parameters.P_EndDate ) as ItemHistDel
    inner join   I_PurchaseOrder                                                                                     as PurchaseOrder on PurchaseOrder.PurchaseOrder = ItemHistDel.PurchaseOrder
    inner join   I_CalendarDate                                                                                      as CalendarDate  on PurchaseOrder.PurchaseOrderDate = CalendarDate.CalendarDate

{
  key ItemHistDel.PurchaseOrder,
  key ItemHistDel.PurchaseOrderItem,
  key ItemHistDel.PurchaseOrderTransactionType,
  ItemHistDel.CompanyCodeCurrency,
  ItemHistDel.PostingDate,
  
  ItemHistDel.PurchaseOrderType,
  ItemHistDel.PurchasingGroup,
  ItemHistDel.PurchasingOrganization,
  Plant,
  Supplier,
  CompanyCode,
  PurchasingDocumentCategory,
  PurchaseOrder.PurchasingDocumentOrigin as  PurchasingDocumentStatus,
  CalendarDate.CalendarYear,
  CalendarDate.CalendarMonth,
  CalendarDate.CalendarQuarter,
  CalendarDate.CalendarWeek,


  @Semantics.currencyCode: true
  :P_DisplayCurrency                     as  DisplayCurrency,

  @Semantics.amount.currencyCode: 'DisplayCurrency'
  cast(currency_conversion(  amount             => ItemHistDel.TotalInvoiceAmountInCoCodeCrcy,
                     source_currency    => ItemHistDel.CompanyCodeCurrency,                             //2815411

                     target_currency    => $parameters.P_DisplayCurrency,
                     exchange_rate_date => ItemHistDel.PostingDate,
                     exchange_rate_type => 'M'
   ) as abap.curr( 18, 2 ))                 as TotalInvoiceAmountInDisCrcy

}
where
      PurchaseOrderDate <= $parameters.P_EndDate
  and PurchaseOrderDate >= $parameters.P_StartDate