P_EWM_PInvDocBusKeyItem
Private view for Row of PInv Item with Quantity in Whse
P_EWM_PInvDocBusKeyItem is a Composite CDS View that provides data about "Private view for Row of PInv Item with Quantity in Whse" in SAP S/4HANA. It reads from 2 data sources (I_EWM_PInvDocBusKeyItem, I_Product) and exposes 42 fields with key fields PhysicalInventoryDocumentUUID, PhysicalInventoryItemNumber, LineIndexOfPInvItem, PhysicalInventoryChangeVersion, PInvDocumentItemType. It has 4 associations to related views. Part of development package VDM_EWM_CORE.
Data Sources (2)
| Source | Alias | Join Type |
|---|---|---|
| I_EWM_PInvDocBusKeyItem | _PIItemBusKey | from |
| I_Product | _Product | inner |
Associations (4)
| Cardinality | Target | Alias | Condition |
|---|---|---|---|
| [0..1] | I_EWM_SerialNumberHeader_2 | _SNHeader | _SNHeader.EWMWarehouse = _PIItemBusKey.EWMWarehouse and _SNHeader.EntitledToDisposeParty = _PIItemBusKey.EntitledToDisposeParty and _SNHeader.ProductUUID = _Product.ProductUUID |
| [0..1] | I_BatchDistinct | _Batch | _PIItemBusKey.BatchUUID = _Batch.BatchExtWhseMgmtInternalId and _PIItemBusKey.BatchUUID is not initial |
| [0..1] | I_EWM_MaterialValuation | _MaterialValuation | _PIItemBusKey.BatchUUID = _MaterialValuation.BatchUUID and _PIItemBusKey.BatchUUID is not initial |
| [0..1] | I_WBSElementBasicData | _WBSBaiscData | _WBSBaiscData.WBSElementInternalID = _PIItemBusKey.StockDocumentNumber |
Annotations (7)
| Name | Value | Level | Field |
|---|---|---|---|
| AccessControl.authorizationCheck | #NOT_REQUIRED | view | |
| Metadata.ignorePropagatedAnnotations | true | view | |
| ObjectModel.usageType.serviceQuality | #C | view | |
| ObjectModel.usageType.dataClass | #MIXED | view | |
| ObjectModel.usageType.sizeCategory | #L | view | |
| VDM.private | true | view | |
| VDM.viewType | #COMPOSITE | view |
Fields (42)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | PhysicalInventoryDocumentUUID | I_EWM_PInvDocBusKeyItem | PhysicalInventoryDocumentUUID | |
| KEY | PhysicalInventoryItemNumber | I_EWM_PInvDocBusKeyItem | PhysicalInventoryItemNumber | |
| KEY | LineIndexOfPInvItem | I_EWM_PInvDocBusKeyItem | LineIndexOfPInvItem | |
| KEY | PhysicalInventoryChangeVersion | I_EWM_PInvDocBusKeyItem | PhysicalInventoryChangeVersion | |
| KEY | PInvDocumentItemType | I_EWM_PInvDocBusKeyItem | PInvDocumentItemType | |
| EWMStockOwner | I_EWM_PInvDocBusKeyItem | EWMStockOwner | ||
| StockOwnerPartnerRole | I_EWM_PInvDocBusKeyItem | StockOwnerPartnerRole | ||
| GlobalTradeItemNumber | I_EWM_PInvDocBusKeyItem | GlobalTradeItemNumber | ||
| GlobalTradeItemNumberVariant | I_EWM_PInvDocBusKeyItem | GlobalTradeItemNumberVariant | ||
| EWMStockType | I_EWM_PInvDocBusKeyItem | EWMStockType | ||
| EWMStockUsage | I_EWM_PInvDocBusKeyItem | EWMStockUsage | ||
| StockUsage | I_EWM_PInvDocBusKeyItem | StockUsage | ||
| InventorySpclStockWBSElement | I_EWM_PInvDocBusKeyItem | InventorySpclStockWBSElement | ||
| PlanningVersionUUID | I_EWM_PInvDocBusKeyItem | PlanningVersionUUID | ||
| ProducedMaterial | I_EWM_PInvDocBusKeyItem | ProducedMaterial | ||
| EWMWarehouse | I_EWM_PInvDocBusKeyItem | EWMWarehouse | ||
| ProductUUID | I_EWM_PInvDocBusKeyItem | ProductUUID | ||
| Product | I_Product | Product | ||
| BatchUUID | I_EWM_PInvDocBusKeyItem | BatchUUID | ||
| SerialNumberRequiredLevel | _SNHeader | SerialNumberRequiredLevel | ||
| StockDocumentCategory | ||||
| StockItemNumber | I_EWM_PInvDocBusKeyItem | StockItemNumber | ||
| DocumentReltdStockDocCat | I_EWM_PInvDocBusKeyItem | DocumentReltdStockDocCat | ||
| EntitledToDisposeParty | I_EWM_PInvDocBusKeyItem | EntitledToDisposeParty | ||
| EntitledToDisposePartnerRole | I_EWM_PInvDocBusKeyItem | EntitledToDisposePartnerRole | ||
| CounterForStockSeparation | I_EWM_PInvDocBusKeyItem | CounterForStockSeparation | ||
| SerialShippingContainerCode | I_EWM_PInvDocBusKeyItem | SerialShippingContainerCode | ||
| HandlingUnitNumber | I_EWM_PInvDocBusKeyItem | HandlingUnitNumber | ||
| HandlingUnitIndicator | I_EWM_PInvDocBusKeyItem | HandlingUnitIndicator | ||
| LocationPlant | I_EWM_PInvDocBusKeyItem | LocationPlant | ||
| StorageLocation | I_EWM_PInvDocBusKeyItem | StorageLocation | ||
| GlobalLocationNumber | I_EWM_PInvDocBusKeyItem | GlobalLocationNumber | ||
| WarehouseLocationUUID | I_EWM_PInvDocBusKeyItem | WarehouseLocationUUID | ||
| WarehouseLocation | I_EWM_PInvDocBusKeyItem | WarehouseLocation | ||
| BusinessPartner | I_EWM_PInvDocBusKeyItem | BusinessPartner | ||
| WarehouseLocationRole | I_EWM_PInvDocBusKeyItem | WarehouseLocationRole | ||
| EWMMeansOfTransport | I_EWM_PInvDocBusKeyItem | EWMMeansOfTransport | ||
| StorageType | I_EWM_PInvDocBusKeyItem | StorageType | ||
| EWMStorageType | I_EWM_PInvDocBusKeyItem | EWMStorageType | ||
| EWMStorageBin | I_EWM_PInvDocBusKeyItem | EWMStorageBin | ||
| SourceResource | I_EWM_PInvDocBusKeyItem | SourceResource | ||
| WarehouseViewForGlobalStocks | I_EWM_PInvDocBusKeyItem | WarehouseViewForGlobalStocks |
@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #NOT_REQUIRED
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType: {serviceQuality: #C,
dataClass: #MIXED,
sizeCategory: #L}
@VDM.private: true
@VDM.viewType:#COMPOSITE
// Important info!!!
// this CDS view is designed to retrieve the business information ONLY for product
define view entity P_EWM_PInvDocBusKeyItem
as select from I_EWM_PInvDocBusKeyItem as _PIItemBusKey // remove unused fields
inner join I_Product as _Product on _Product.ProductUUID = _PIItemBusKey.ProductUUID
and _PIItemBusKey.ProductUUID is not initial
association [0..1] to I_EWM_SerialNumberHeader_2 as _SNHeader on _SNHeader.EWMWarehouse = _PIItemBusKey.EWMWarehouse
and _SNHeader.EntitledToDisposeParty = _PIItemBusKey.EntitledToDisposeParty
and _SNHeader.ProductUUID = _Product.ProductUUID // that's why we don't use assocation
// association [0..1] to I_Batch as _Batch on _Batch.BatchExtWhseMgmtInternalId = _PIItemBusKey.BatchUUID
// and _Batch.Material = _Product.Product
association [0..1] to I_BatchDistinct as _Batch on _PIItemBusKey.BatchUUID = _Batch.BatchExtWhseMgmtInternalId
and _PIItemBusKey.BatchUUID is not initial //<> '00000000000000000000000000000000' // do association only if batch uuid is not initial
association [0..1] to I_EWM_MaterialValuation as _MaterialValuation on _PIItemBusKey.BatchUUID = _MaterialValuation.BatchUUID
and _PIItemBusKey.BatchUUID is not initial //<> '00000000000000000000000000000000'
association [0..1] to I_WBSElementBasicData as _WBSBaiscData on _WBSBaiscData.WBSElementInternalID = _PIItemBusKey.StockDocumentNumber
{
key _PIItemBusKey.PhysicalInventoryDocumentUUID,
key _PIItemBusKey.PhysicalInventoryItemNumber,
key _PIItemBusKey.LineIndexOfPInvItem,
key _PIItemBusKey.PhysicalInventoryChangeVersion,
key _PIItemBusKey.PInvDocumentItemType,
_PIItemBusKey.EWMStockOwner,
_PIItemBusKey.StockOwnerPartnerRole,
_PIItemBusKey.GlobalTradeItemNumber,
_PIItemBusKey.GlobalTradeItemNumberVariant,
_PIItemBusKey.EWMStockType,
_PIItemBusKey.EWMStockUsage,
_PIItemBusKey.StockUsage,
_PIItemBusKey.InventorySpclStockWBSElement,
_PIItemBusKey.PlanningVersionUUID,
_PIItemBusKey.ProducedMaterial,
_PIItemBusKey.EWMWarehouse,
_PIItemBusKey.ProductUUID,
_Product.Product,
_PIItemBusKey.BatchUUID,
case
when _PIItemBusKey.BatchUUID is not initial and _Batch.Batch is null then cast ( _MaterialValuation.InventoryValuationType as charg_d preserving type )
else cast ( _Batch.Batch as charg_d preserving type )
end as Batch,
_SNHeader.SerialNumberRequiredLevel,
/*-- special stocks --*/
// follow P_EWM_PINVDOCCNTITEM02_2, not I_EWM_OutbDelivOrdItem
cast( _PIItemBusKey.StockDocumentCategory as ewm_de_stockdocumentcat preserving type ) as StockDocumentCategory,
// WBSElementInternalID
case _PIItemBusKey.StockDocumentCategory
when 'PJS' then _WBSBaiscData.WBSElementInternalID
else cast ('00000000' as ps_s4_pspnr preserving type )
end as WBSElementInternalID,
// WBSElementExternalID
case _PIItemBusKey.StockDocumentCategory
when 'PJS' then _WBSBaiscData.WBSElementExternalID
else cast( '' as ps_posid_edit )
end as WBSElementExternalID,
// SpecialStockIdfgSalesOrder
case _PIItemBusKey.StockDocumentCategory
when 'SOS' then cast(ltrim(_PIItemBusKey.StockDocumentNumber, '0') as ewm_de_special_stock_idfg_hdr)
else cast( '' as ewm_de_special_stock_idfg_hdr)
end as SpecialStockIdfgSalesOrder,
// SpecialStockIdfgSalesOrderItem
case _PIItemBusKey.StockDocumentCategory
when 'SOS' then cast(ltrim(_PIItemBusKey.StockItemNumber, '0') as mat_kdpos)
else cast( '000000' as mat_kdpos )
end as SpecialStockIdfgSalesOrderItem,
/*-- special stocks --*/
_PIItemBusKey.StockItemNumber,
_PIItemBusKey.DocumentReltdStockDocCat,
_PIItemBusKey.EntitledToDisposeParty,
_PIItemBusKey.EntitledToDisposePartnerRole,
_PIItemBusKey.CounterForStockSeparation,
_PIItemBusKey.SerialShippingContainerCode,
_PIItemBusKey.HandlingUnitNumber,
_PIItemBusKey.HandlingUnitIndicator,
_PIItemBusKey.LocationPlant,
_PIItemBusKey.StorageLocation,
_PIItemBusKey.GlobalLocationNumber,
_PIItemBusKey.WarehouseLocationUUID,
_PIItemBusKey.WarehouseLocation,
_PIItemBusKey.BusinessPartner,
_PIItemBusKey.WarehouseLocationRole,
_PIItemBusKey.EWMMeansOfTransport,
_PIItemBusKey.StorageType,
_PIItemBusKey.EWMStorageType,
_PIItemBusKey.EWMStorageBin,
_PIItemBusKey.SourceResource,
_PIItemBusKey.WarehouseViewForGlobalStocks
//_PIItemBusKey.PackagingMaterial,
//_PIItemBusKey.HandlingUnitType
}
where
_PIItemBusKey.LineIndexOfPInvItem = 0
or(
_PIItemBusKey.LineIndexOfPInvItem > 0
and _PIItemBusKey.PhysicalInventoryChangeVersion = 0
and _PIItemBusKey.HandlingUnitIndicator <> 'A' // not dummy HU
)
Learn More
- What Is a CDS View in SAP S/4HANA?
- Types of CDS Views: Basic, Composite, Consumption, and Transactional
- SAP Tables vs CDS Views — Key Differences
- Understanding Data Lineage in SAP S/4HANA
- VDM (Virtual Data Model) in SAP S/4HANA Explained
- CDS View Annotations — A Complete Guide
- CDS View Field Mapping and Associations
- Understanding the SAP S/4HANA Data Model
- CDS View Extensions and Custom Fields in SAP S/4HANA
- Released APIs and Stability Contracts in SAP S/4HANA