P_PurInfoRecdPrHist

DDL: P_PURINFORECDPRHIST SQL: PPURINFRECHIST Type: view CONSUMPTION

Private View for Purchasing Info Record Price History

P_PurInfoRecdPrHist is a Consumption CDS View that provides data about "Private View for Purchasing Info Record Price History" in SAP S/4HANA. It reads from 2 data sources (I_PurgInfoRecordWithOrgData, I_PurInfCndPeriod) and exposes 86 fields with key fields PurchasingInfoRecord, PurchasingOrganization, PurchasingInfoRecordCategory, Plant, ConditionValidityEndDate. It has 1 association to related views.

Data Sources (2)

SourceAliasJoin Type
I_PurgInfoRecordWithOrgData _Header from
I_PurInfCndPeriod _Item union_all

Associations (1)

CardinalityTargetAliasCondition
[0..1] I_PurgInfoRecordWithOrgData _InfoRecord $projection.PurchasingInfoRecord = _InfoRecord.PurchasingInfoRecord and $projection.Plant = _InfoRecord.Plant and $projection.PurchasingInfoRecordCategory = _InfoRecord.PurchasingInfoRecordCategory and $projection.PurchasingOrganization = _InfoRecord.PurchasingOrganization

Annotations (11)

NameValueLevelField
AbapCatalog.sqlViewName PPURINFRECHIST view
VDM.private true view
VDM.viewType #CONSUMPTION view
ClientHandling.algorithm #SESSION_VARIABLE view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #PRIVILEGED_ONLY view
EndUserText.label Private View for Purchasing Info Record Price History view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.dataClass #TRANSACTIONAL view
Metadata.ignorePropagatedAnnotations true view

Fields (86)

KeyFieldSource TableSource FieldDescription
KEY PurchasingInfoRecord I_PurgInfoRecordWithOrgData PurchasingInfoRecord
KEY PurchasingOrganization I_PurgInfoRecordWithOrgData PurchasingOrganization
KEY PurchasingInfoRecordCategory I_PurgInfoRecordWithOrgData PurchasingInfoRecordCategory
KEY Plant I_PurgInfoRecordWithOrgData Plant
KEY ConditionValidityEndDate
KEY ConditionRecord
char50asFormattedPurDoc
Currency I_PurgInfoRecordWithOrgData Currency
PurchasingGroup I_PurgInfoRecordWithOrgData PurchasingGroup
PurchasingDocument
PurchasingDocumentItem
FormattedPurchaseOrderItem
ConditionValidityStartDate
ConditionIsDeleted
ConditionRateValue
ConditionRateValueUnit
ConditionQuantity
ConditionQuantityUnit
BaseUnit I_PurgInfoRecordWithOrgData PurgDocOrderQuantityUnit
NumberOfItems
HierarchyNodeLevel
PurgDocDrillDownState
PurchasingDocumentType
ParentNode
NetAmount
Supplier I_PurgInfoRecordWithOrgData Supplier
Material I_PurgInfoRecordWithOrgData Material
MaterialGroup I_PurgInfoRecordWithOrgData MaterialGroup
SupplierSubrange I_PurgInfoRecordWithOrgData SupplierSubrange
Manufacturer I_PurgInfoRecordWithOrgData Manufacturer
IncotermsClassification I_PurgInfoRecordWithOrgData IncotermsClassification
TaxCode I_PurgInfoRecordWithOrgData TaxCode
PriorSupplier I_PurgInfoRecordWithOrgData PriorSupplier
PricingDateControl I_PurgInfoRecordWithOrgData PricingDateControl
SupplierMaterialNumber I_PurgInfoRecordWithOrgData SupplierMaterialNumber
MaterialPlannedDeliveryDurn I_PurgInfoRecordWithOrgData MaterialPlannedDeliveryDurn
OverdelivTolrtdLmtRatioInPct I_PurgInfoRecordWithOrgData OverdelivTolrtdLmtRatioInPct
UnderdelivTolrtdLmtRatioInPct I_PurgInfoRecordWithOrgData UnderdelivTolrtdLmtRatioInPct
IsDeleted I_PurgInfoRecordWithOrgData IsDeleted
AvailabilityStartDate I_PurgInfoRecordWithOrgData AvailabilityStartDate
AvailabilityEndDate I_PurgInfoRecordWithOrgData AvailabilityEndDate
SupplierName
PlantName
TaxCalculationProcedure
PurchasingInfoRecord
KEY PurchasingOrganization I_PurInfCndPeriod PurchasingOrganization
KEY PurchasingInfoRecordCategory I_PurInfCndPeriod PurchasingInfoRecordCategory
KEY Plant I_PurInfCndPeriod Plant
KEY ConditionValidityEndDate I_PurInfCndPeriod ConditionValidityEndDate
KEY ConditionRecord I_PurInfCndPeriod ConditionRecord
Currency _InfoRecord Currency
PurchasingGroup _InfoRecord PurchasingGroup
PurchasingDocument
PurchasingDocumentItem
FormattedPurchaseOrderItem
ConditionValidityStartDate I_PurInfCndPeriod ConditionValidityStartDate
ConditionIsDeleted I_PurInfCndPeriod ConditionIsDeleted
ConditionRateValue I_PurInfCndPeriod ConditionRateValue
ConditionRateValueUnit I_PurInfCndPeriod ConditionRateValueUnit
ConditionQuantity
ConditionQuantityUnit I_PurInfCndPeriod ConditionQuantityUnit
BaseUnit _InfoRecord PurgDocOrderQuantityUnit
NumberOfItems 0
HierarchyNodeLevel
PurgDocDrillDownState
PurchasingDocumentType
Supplier _InfoRecord Supplier
Material _InfoRecord Material
MaterialGroup _InfoRecord MaterialGroup
SupplierSubrange _InfoRecord SupplierSubrange
Manufacturer _InfoRecord Manufacturer
IncotermsClassification _InfoRecord IncotermsClassification
TaxCode _InfoRecord TaxCode
PriorSupplier _InfoRecord PriorSupplier
PricingDateControl _InfoRecord PricingDateControl
SupplierMaterialNumber _InfoRecord SupplierMaterialNumber
MaterialPlannedDeliveryDurn _InfoRecord MaterialPlannedDeliveryDurn
OverdelivTolrtdLmtRatioInPct _InfoRecord OverdelivTolrtdLmtRatioInPct
UnderdelivTolrtdLmtRatioInPct _InfoRecord UnderdelivTolrtdLmtRatioInPct
IsDeleted _InfoRecord IsDeleted
AvailabilityStartDate _InfoRecord AvailabilityStartDate
AvailabilityEndDate _InfoRecord AvailabilityEndDate
SupplierName
PlantName
TaxCalculationProcedure
ConditionType I_PurInfCndPeriod ConditionType
@AbapCatalog.sqlViewName: 'PPURINFRECHIST'
@AbapCatalog.viewEnhancementCategory: [#PROJECTION_LIST,#UNION]                                 //2803239

@VDM.private: true
@VDM.viewType: #CONSUMPTION
@ClientHandling.algorithm: #SESSION_VARIABLE
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck:#PRIVILEGED_ONLY
@EndUserText.label: 'Private View for Purchasing Info Record Price History'
@ObjectModel.usageType.serviceQuality: #C
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.dataClass: #TRANSACTIONAL
@Metadata.ignorePropagatedAnnotations: true

define view P_PurInfoRecdPrHist
  as select from I_PurgInfoRecordWithOrgData as _Header
{
       //I_PurgInfoRecordWithOrgData

  key  _Header.PurchasingInfoRecord,
  key  _Header.PurchasingOrganization,
  key  _Header.PurchasingInfoRecordCategory,
  key  _Header.Plant,
  key  '00000000'                                                                                                                                                    as     ConditionValidityEndDate,
  key  cast('0000000000' as knumh)                                                                                                                                   as     ConditionRecord,
       cast(concat(concat(concat(concat(concat(concat(_Header.PurchasingInfoRecord, '/'),
       _Header.PurchasingOrganization),'/'),
       _Header.PurchasingInfoRecordCategory),'/'),
       _Header.Plant)
       as abap.char(50))                                                                                                                                              as     FormattedPurDoc,

       _Header.Currency,
       _Header.PurchasingGroup,

       cast('_' as ebeln)                                                                                                                                             as     PurchasingDocument,
       cast('00000' as ebelp)                                                                                                                                             as     PurchasingDocumentItem,
       cast('_' as abap.char(50))                                                                                                                                     as     FormattedPurchaseOrderItem,
       cast('00000000' as abap.dats)                                                                                                                                  as     ConditionValidityStartDate,
       '_'                                                                                                                                                            as     ConditionIsDeleted,
       cast(0   as kbetr_kond)                                                                                                                                        as     ConditionRateValue,
       cast('_' as konwa)                                                                                                                                             as     ConditionRateValueUnit,
       cast(0   as abap.quan(13,3))                                                                                                                                   as     ConditionQuantity,
       cast('_' as kmein)                                                                                                                                             as     ConditionQuantityUnit,
       _Header.PurgDocOrderQuantityUnit                                                                                                                               as     BaseUnit,

       //@DefaultAggregation: #SUM

       cast(0   as abap.int4 )                                                                                                                                        as     NumberOfItems,
       cast('0' as abap.char(1))                                                                                                                                      as     HierarchyNodeLevel,
       cast('expanded' as abap.char(8))                                                                                                                               as     PurgDocDrillDownState,
       cast('0' as abap.char(1))                                                                                                                                      as     PurchasingDocumentType,
       cast(' ' as abap.char(50))                                                                                                                                     as     ParentNode,
       cast(0   as kbetr_kond)                                                                                                                                        as     NetAmount,
       _Header.Supplier,
       _Header.Material,
       _Header.MaterialGroup,
       _Header.SupplierSubrange,
       _Header.Manufacturer,
       _Header.IncotermsClassification,
       _Header.TaxCode,
       _Header.PriorSupplier,
       _Header.PricingDateControl,
       _Header.SupplierMaterialNumber,
       _Header.MaterialPlannedDeliveryDurn,
       _Header.OverdelivTolrtdLmtRatioInPct,
       _Header.UnderdelivTolrtdLmtRatioInPct,
       _Header.IsDeleted,
       _Header.AvailabilityStartDate,
       _Header.AvailabilityEndDate,
       _Header._Supplier.SupplierName,
       _Header._Plant.PlantName,
       _Header._Plant._Address._Country.TaxCalculationProcedure,
       cast('' as kscha) as ConditionType
 }
where
  _Header.IsDeleted = ''

union all select from I_PurInfCndPeriod as _Item
association [0..1] to I_PurgInfoRecordWithOrgData as _InfoRecord on  $projection.PurchasingInfoRecord         = _InfoRecord.PurchasingInfoRecord
                                                                 and $projection.Plant                        = _InfoRecord.Plant
                                                                 and $projection.PurchasingInfoRecordCategory = _InfoRecord.PurchasingInfoRecordCategory
                                                                 and $projection.PurchasingOrganization       = _InfoRecord.PurchasingOrganization


{
       //I_PurInfCndPeriod

  key  _Item.PurchasingInfoRecord,
  key  _Item.PurchasingOrganization,
  key  _Item.PurchasingInfoRecordCategory,
  key  _Item.Plant,
  key  _Item.ConditionValidityEndDate,
  key  _Item.ConditionRecord,
       concat(concat(concat(concat(concat(concat(concat(concat(_Item.PurchasingInfoRecord, '/'),
       _Item.PurchasingOrganization),'/'),
       _Item.PurchasingInfoRecordCategory),'/'),
       _Item.Plant), '/'),
       _Item.ConditionValidityEndDate)                                                                                            as     FormattedPurDoc,

       _InfoRecord.Currency                                                                                                       as     Currency,
       _InfoRecord.PurchasingGroup                                                                                                as     PurchasingGroup,

       cast('_' as ebeln)                                                                                                         as     PurchasingDocument,
       cast('00000' as ebelp)                                                                                                         as     PurchasingDocumentItem,
       '_'                                                                                                                        as     FormattedPurchaseOrderItem,

       _Item.ConditionValidityStartDate,
       _Item.ConditionIsDeleted,
       _Item.ConditionRateValue,
       _Item.ConditionRateValueUnit,
       cast(_Item.ConditionQuantity as abap.quan(13,3))                                                                           as     ConditionQuantity,
       _Item.ConditionQuantityUnit,
       _InfoRecord.PurgDocOrderQuantityUnit         as BaseUnit,

       //@DefaultAggregation: #SUM

       0                                                                                                                          as     NumberOfItems,
       '1'                                                                                                                        as     HierarchyNodeLevel,
       'leaf'                                                                                                                     as     PurgDocDrillDownState,
       '1'                                                                                                                        as     PurchasingDocumentType,
       concat(concat(concat(concat(concat(concat(PurchasingInfoRecord, '/'),
       PurchasingOrganization),'/'),
       PurchasingInfoRecordCategory),'/'),
       Plant)                                                                                                                     as     ParentNode,

       case when _Item.ConditionQuantity > 0
       then division(currency_conversion(
        amount             => _Item.ConditionRateValue,
        source_currency    => _Item.ConditionRateValueUnit,
        target_currency    => _InfoRecord.Currency,
        exchange_rate_date => _Item.ConditionValidityStartDate,
        exchange_rate_type => 'M',
        error_handling     => 'SET_TO_NULL'
        ) , _Item.ConditionQuantity,2)
        else
        currency_conversion(
        amount             => _Item.ConditionRateValue,
        source_currency    => _Item.ConditionRateValueUnit,
        target_currency    => _InfoRecord.Currency,
        exchange_rate_date => _Item.ConditionValidityStartDate,
        exchange_rate_type => 'M',
        error_handling     => 'SET_TO_NULL'
        )
        end                                                                                                                       as     NetAmount,
       _InfoRecord.Supplier,
       _InfoRecord.Material,
       _InfoRecord.MaterialGroup,
       _InfoRecord.SupplierSubrange,
       _InfoRecord.Manufacturer,
       _InfoRecord.IncotermsClassification,
       _InfoRecord.TaxCode,
       _InfoRecord.PriorSupplier,
       _InfoRecord.PricingDateControl,
       _InfoRecord.SupplierMaterialNumber,
       _InfoRecord.MaterialPlannedDeliveryDurn,
       _InfoRecord.OverdelivTolrtdLmtRatioInPct,
       _InfoRecord.UnderdelivTolrtdLmtRatioInPct,
       _InfoRecord.IsDeleted,
       _InfoRecord.AvailabilityStartDate,
       _InfoRecord.AvailabilityEndDate,
       _InfoRecord._Supplier.SupplierName,
       _InfoRecord._Plant.PlantName,
       _InfoRecord._Plant._Address._Country.TaxCalculationProcedure,
       _Item.ConditionType
}
where
      _InfoRecord.IsDeleted           = ''
  and _Item.ConditionSequentialNumber = '01'
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_ADDRESS",
"I_COUNTRY",
"I_PLANT",
"I_PURGINFORECORDWITHORGDATA",
"I_PURINFCNDPERIOD",
"I_SUPPLIER"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/