I_HandlingUnitValueHelp is a Composite CDS View that provides data about "HU ID and WH" in SAP S/4HANA. It reads from 4 data sources (I_HandlingUnitHeader, P_EWM_HandlingUnitHeader02, I_HandlingUnitHeader, I_HandlingUnitHeader) and exposes 13 fields with key fields HandlingUnitExternalID, Warehouse, Warehouse, Warehouse, Warehouse. It has 6 associations to related views.
@VDM.viewType: #COMPOSITE@VDM.lifecycle.contract.type: #SAP_INTERNAL_API@AccessControl.authorizationCheck: #CHECK@Metadata.ignorePropagatedAnnotations: true@ObjectModel.dataCategory: #VALUE_HELP@ObjectModel.usageType.serviceQuality: #C@ObjectModel.usageType.sizeCategory: #XL@ObjectModel.usageType.dataClass: #TRANSACTIONAL@EndUserText.label: 'HU ID and WH'
defineviewentity I_HandlingUnitValueHelp
// 1). select LO HUs for non-EWM and non-WM storage locations
asselectfrom I_HandlingUnitHeader as ERPHeader
{
key ERPHeader.HandlingUnitExternalID,
keycast(' ' as /scwm/lgnum) as Warehouse,
@UI.hidden: true
Plant,
@UI.hidden: true
ShippingPoint
}
where
(
HandlingUnitPackingObjectType != '00' //Not assigned to an object.
and HandlingUnitPackingObjectType != '02' //Sales document
and HandlingUnitPackingObjectType != '04' //Shipment
and HandlingUnitPackingObjectType != '05' //Non-Assigned HU
and HandlingUnitPackingObjectType != '06' //Non-Assigned HU
and HandlingUnitPackingObjectType != '21' //Cross-Outbound Delivery
and HandlingUnitPackingObjectType != '23' //Cross-Inbound Delivery
)
and(
Warehouse is initial //only for S/4HANA Cloud! needs to be changed for onPrem
and HandlingUnitInternalStatus != '0060' //deleted
//additional conditions to not show HUs that are managed by EWM
and(
//standalone HUs that are managed externally
(
HandlingUnitStockMgmtType != 'A' //HU in system with IM stock -> HU is managed externally
and HandlingUnitPackingObjectType = '12' //Non-Assigned HU -> standalone HU
)
or(
HandlingUnitPackingObjectType = '09' // Work Order - Finished Product
or HandlingUnitPackingObjectType = '07' // Repititive Manufacturing
)
or(
HandlingUnitPackingObjectType = '01' // Outbound Delivery
or HandlingUnitPackingObjectType = '03' // Inbound Delivery
)
)
)
unionall// 2). select LO HUs for ext. WM storage locations - only for outbound deliveries
selectfrom I_HandlingUnitHeader as vekp_decwhs
join I_ERPWarehouseParameters as whs_param on whs_param.Warehouse = vekp_decwhs.Warehouse
and(
whs_param.HandlingUnitWarehouseType = 'X'
or whs_param.HandlingUnitWarehouseType is initial
)
association [0..1] to I_HandlingUnitHeader as _HandlingUnitParentHdr on _HandlingUnitParentHdr.HandlingUnitInternalID = vekp_decwhs.HandlingUnitLowerLevelRefer
{
key vekp_decwhs.HandlingUnitExternalID,
keycast(' ' as /scwm/lgnum preserving type) as Warehouse,
vekp_decwhs.Plant,
vekp_decwhs.ShippingPoint
}
where
vekp_decwhs.Warehouse isnot initial
and(
vekp_decwhs.HandlingUnitPackingObjectType != '00' //Not assigned to an object.
or vekp_decwhs.HandlingUnitPackingObjectType != '02' //Sales document
or vekp_decwhs.HandlingUnitPackingObjectType != '04' //Shipment
or vekp_decwhs.HandlingUnitPackingObjectType != '05' //Non-Assigned HU
or vekp_decwhs.HandlingUnitPackingObjectType != '06' //Non-Assigned HU
or vekp_decwhs.HandlingUnitPackingObjectType != '21' //Cross-Outbound Delivery
or vekp_decwhs.HandlingUnitPackingObjectType != '23' //Cross-Inbound Delivery
)
and vekp_decwhs.HandlingUnitInternalStatus <> '0060'
unionall// 3). select LO HUs for EWM storage locations - only for outbound deliveries
// - for inbound and standalone HUs EWM is master system,
// so for last ones we take them always from EWM and ignore LO ones
selectfrom I_HandlingUnitHeader as vekp_ewm
join I_ERPWarehouseParameters as whs_param on whs_param.Warehouse = vekp_ewm.Warehouse
and whs_param.HandlingUnitWarehouseType = 'E'
join I_ERPWarehouseToEWMWarehouse as ewm_whs on ewm_whs.WarehouseERP = vekp_ewm.Warehouse
association [0..1] to I_UnitOfMeasure as _WeightUnit on _WeightUnit.UnitOfMeasure = vekp_ewm.WeightUnit
association [0..1] to I_UnitOfMeasure as _WeightUnitTare on _WeightUnitTare.UnitOfMeasure = vekp_ewm.HandlingUnitTareWeightUnit
association [0..1] to I_UnitOfMeasure as _VolumeUnit on _VolumeUnit.UnitOfMeasure = vekp_ewm.VolumeUnit
association [0..1] to I_UnitOfMeasure as _VolumeUnitTare on _VolumeUnitTare.UnitOfMeasure = vekp_ewm.HandlingUnitTareVolumeUnit
association [0..1] to I_UnitOfMeasure as _UnitOfMeasureDimension on _UnitOfMeasureDimension.UnitOfMeasure = vekp_ewm.UnitOfMeasureDimension
association [0..1] to I_HandlingUnitHeader as _HandlingUnitParentHdr on _HandlingUnitParentHdr.HandlingUnitInternalID = vekp_ewm.HandlingUnitLowerLevelRefer
{
key vekp_ewm.HandlingUnitExternalID,
key ewm_whs.Warehouse as Warehouse,
vekp_ewm.Plant,
vekp_ewm.ShippingPoint
}
where
vekp_ewm.Warehouse isnot initial
and(
vekp_ewm.HandlingUnitPackingObjectType = '01'
or// Outbound Delivery
vekp_ewm.HandlingUnitPackingObjectType = '21'
) // Cross-Outbound Delivery
and vekp_ewm.HandlingUnitInternalStatus <> '0060'
unionall// 4). select EWM HUs
selectfrom P_EWM_HandlingUnitHeader02 as EWMHeader
{
key EWMHeader.HandlingUnitExternalID,
key EWMHeader.Warehouse,
cast(' ' as hum_werks) as Plant,
cast(' ' as vstel) as ShippingPoint
}
where
EWMHeader.HandlingUnitStatus != 'D' //deleted
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_ERPWAREHOUSEPARAMETERS",
"I_ERPWAREHOUSETOEWMWAREHOUSE",
"I_HANDLINGUNITHEADER",
"P_EWM_HANDLINGUNITHEADER02"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/