P_BOMItems
Get Valid BOM items for BOM header
P_BOMItems is a Basic CDS View that provides data about "Get Valid BOM items for BOM header" in SAP S/4HANA. It reads from 3 data sources (stas, stpo, tcs03) and exposes 104 fields with key fields BillOfMaterialCategory, BillOfMaterial, BillOfMaterialVariant, BillOfMaterialItemNodeNumber.
Annotations (13)
| Name | Value | Level | Field |
|---|---|---|---|
| AbapCatalog.sqlViewName | P_ITEMS | view | |
| AbapCatalog.preserveKey | true | view | |
| ClientHandling.type | #INHERITED | view | |
| ClientHandling.algorithm | #AUTOMATED | view | |
| VDM.private | true | view | |
| VDM.viewType | #BASIC | view | |
| AbapCatalog.compiler.compareFilter | true | view | |
| ObjectModel.usageType.serviceQuality | #B | view | |
| ObjectModel.usageType.sizeCategory | #XL | view | |
| ObjectModel.usageType.dataClass | #TRANSACTIONAL | view | |
| AccessControl.authorizationCheck | #NOT_REQUIRED | view | |
| VDM.lifecycle.contract.type | #NONE | view | |
| EndUserText.label | Get Valid BOM items for BOM header | view |
Fields (104)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | BillOfMaterialCategory | stpo | stlty | |
| KEY | BillOfMaterial | stpo | stlnr | |
| KEY | BillOfMaterialVariant | stas | stlal | |
| KEY | BillOfMaterialItemNodeNumber | stpo | stlkn | |
| BillOfMaterialItemUUID | stpo | guidx | ||
| BOMItemInternalChangeCount | stpo | stpoz | ||
| InheritedNodeNumberForBOMItem | stas | stvkn | ||
| InheritedNodeNumberVersionBOM | stpo | stvkn_versn | ||
| BillOfMaterialVersion | stas | bom_versn | ||
| ValidityStartDate | stpo | datuv | ||
| ChangeNumberFrom | stpo | aennr | ||
| ChangeNumberTo | stpo | ecn_to | ||
| BOMItemRecordCreationDate | stpo | andat | ||
| BOMItemCreatedByUser | stpo | annam | ||
| BOMItemLastChangeDate | stpo | aedat | ||
| BOMItemLastChangedByUser | stpo | aenam | ||
| BillOfMaterialComponent | stpo | idnrk | ||
| BillOfMaterialItemCategory | stpo | postp | ||
| BillOfMaterialItemNumber | stpo | posnr | ||
| BillOfMaterialItemUnit | stpo | meins | ||
| BillOfMaterialItemQuantity | stpo | menge | ||
| IsSubItem | stpo | upskz | ||
| SortString | stpo | sortf | ||
| BOMItemSorter | stpo | sortf | ||
| FixedQuantity | stpo | fmeng | ||
| BOMItemHasFixedQuantity | stpo | fmeng | ||
| PurchasingGroup | stpo | ekgrp | ||
| Currency | stpo | waers | ||
| MaterialComponentPrice | stpo | preis | ||
| itmidendasIdentifierBOMItem | ||||
| MaterialPriceUnitQty | stpo | peinh | ||
| ComponentScrapInPercent | stpo | ausch | ||
| OperationScrapInPercent | stpo | avoau | ||
| IsNetScrap | stpo | netau | ||
| NumberOfVariableSizeItem | stpo | roanz | ||
| QuantityVariableSizeItem | stpo | romen | ||
| FormulaKey | stpo | rform | ||
| BOMItemDescription | stpo | potx1 | ||
| BOMItemText2 | stpo | potx2 | ||
| LongTextLanguage | stpo | ltxsp | ||
| MaterialGroup | stpo | matkl | ||
| DocumentType | stpo | dokar | ||
| DocNumber | stpo | doknr | ||
| DocumentVersion | stpo | dokvr | ||
| DocumentPart | stpo | doktl | ||
| ClassNumber | stpo | class | ||
| ClassType | stpo | klart | ||
| ResultingItemCategory | stpo | potpr | ||
| DependencyObjectNumber | stpo | knobj | ||
| ObjectType | stpo | objty | ||
| IsClassificationRelevant | stpo | kzclb | ||
| IsBulkMaterial | stpo | schgt | ||
| BOMItemIsSparePart | stpo | erskz | ||
| BOMItemIsSalesRelevant | stpo | rvrel | ||
| IsProductionRelevant | stpo | sanfe | ||
| BOMItemIsPlantMaintRelevant | stpo | sanin | ||
| BOMItemIsCostingRelevant | stpo | sanka | ||
| IsEngineeringRelevant | stpo | sanko | ||
| SpecialProcurementType | stpo | itsob | ||
| IsBOMRecursiveAllowed | stpo | rekrs | ||
| OperationLeadTimeOffset | stpo | nlfzv | ||
| OpsLeadTimeOffsetUnit | stpo | nlfmv | ||
| BOMItemChangeDate | stpo | aedat | ||
| IsMaterialProvision | stpo | beikz | ||
| BOMIsRecursive | stpo | rekri | ||
| DocumentIsCreatedByCAD | stpo | cadpo | ||
| DistrKeyCompConsumption | stpo | verti | ||
| DeliveryDurationInDays | stpo | lifzt | ||
| CostElement | stpo | sakto | ||
| Size1 | stpo | roms1 | ||
| Size2 | stpo | roms2 | ||
| Size3 | stpo | roms3 | ||
| UnitOfMeasureForSize1To3 | stpo | romei | ||
| GoodsReceiptDuration | stpo | webaz | ||
| PurchasingOrganization | stpo | ekorg | ||
| RequiredComponent | stpo | clobk | ||
| MultipleSelectionAllowed | stpo | clmul | ||
| ProdOrderIssueLocation | stpo | lgort | ||
| MaterialIsCoProduct | stpo | kzkup | ||
| ExplosionType | stpo | dspst | ||
| FollowUpGroup | stpo | nfgrp | ||
| DiscontinuationGroup | stpo | nfeag | ||
| ReinsurContrOrgUnit | stpo | cview | ||
| IsConfigurableBOM | stpo | awakz | ||
| ReferencePoint | stpo | rfpnt | ||
| LeadTimeOffset | stpo | nlfzt | ||
| IsSoftwareComponent | stpo | sfwind | ||
| ProductionSupplyArea | stpo | prvbe | ||
| IsDeleted | stpo | lkenz | ||
| IsALE | stpo | alekz | ||
| UnitOfMeasureForPiece | tcs03 | bmein | ||
| UnitOfMeasureForVarSizeItem | tcs03 | roame | ||
| AlternativeItemGroup | stpo | alpgr | ||
| AlternativeItemPriority | stpo | alprf | ||
| AlternativeItemStrategy | stpo | alpst | ||
| UsageProbabilityPercent | stpo | ewahr | ||
| IsPMAssemblyRelevant | stpo | stkkz | ||
| IsAssembly | ||||
| SpclProcmtTypeIsConsistent | t460a | SpclProcmtTypeIsConsistent | ||
| OrigSalesOrderBOMItmCategory | stpo | kstty | ||
| OrigSalesOrderBOM | stpo | kstnr | ||
| OrigSalesOrderBOMItmNodeNumber | stpo | kstkn | ||
| OrigSalesOrderBOMItmNumber | stpo | kstpz | ||
| PreliminaryMaterial | stpo | preliminary_material |
@AbapCatalog.sqlViewName: 'P_ITEMS'
@AbapCatalog.preserveKey:true
@ClientHandling.type : #INHERITED
@ClientHandling.algorithm : #AUTOMATED
@VDM.private: true
@VDM.viewType: #BASIC
@AbapCatalog.compiler.compareFilter: true
@ObjectModel.usageType: {serviceQuality: #B, sizeCategory: #XL, dataClass: #TRANSACTIONAL}
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.lifecycle.contract.type: #NONE
--@EndUserText.label: 'Get Valid BOM items for BOM header'
define view P_BOMItems
as select from stpo as stpo // Removed distinct due to performance impact : testing need to be done
inner join stas as stas on stpo.stlty = stas.stlty
and stpo.stlnr = stas.stlnr
and stpo.stlkn = stas.stlkn
and stas.lkenz = ' '
inner join tcs03 as tcs03 on tcs03.agb29 = '29'
left outer to one join P_T460aGlobal as t460a on t460a.Sobes = stpo.itsob
left outer to one join I_Supplier as Supplier on stpo.lifnr = Supplier.Supplier
and(
Supplier.IsBusinessPurposeCompleted is null
or Supplier.IsBusinessPurposeCompleted = ''
)
{
key stpo.stlty as BillOfMaterialCategory,
key stpo.stlnr as BillOfMaterial,
key stas.stlal as BillOfMaterialVariant,
key stpo.stlkn as BillOfMaterialItemNodeNumber,
stpo.guidx as BillOfMaterialItemUUID,
stpo.stpoz as BOMItemInternalChangeCount,
stas.stvkn as InheritedNodeNumberForBOMItem,
stpo.stvkn_versn as InheritedNodeNumberVersionBOM,
stas.bom_versn as BillOfMaterialVersion,
@Semantics.businessDate.from: true
stpo.datuv as ValidityStartDate,
-- @ObjectModel.virtualElement : true
-- @ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_CS_BOM_ATTR_DETERMINATION'
-- case when ( stpo.valid_to = '00000000' and stpo.datuv <> '00000000' )
-- then valid_items.ValidityEndDate
-- else -- end
@Semantics.businessDate.to: true
case
when stpo.datuv != '00000000' and stpo.valid_to = '00000000'
then cast('99991231' as datub )
else cast( stpo.valid_to as datub preserving type )
end as ValidityEndDate,
stpo.aennr as ChangeNumberFrom,
stpo.ecn_to as ChangeNumberTo,
// @ObjectModel.readOnly: true
stpo.andat as BOMItemRecordCreationDate,
//@ObjectModel.readOnly: true
stpo.annam as BOMItemCreatedByUser,
//@ObjectModel.readOnly: true
stpo.aedat as BOMItemLastChangeDate,
//@ObjectModel.readOnly: true
stpo.aenam as BOMItemLastChangedByUser,
stpo.idnrk as BillOfMaterialComponent,
stpo.postp as BillOfMaterialItemCategory,
stpo.posnr as BillOfMaterialItemNumber,
@Semantics.unitOfMeasure: true
stpo.meins as BillOfMaterialItemUnit,
@Semantics.quantity.unitOfMeasure: 'BillOfMaterialItemUnit'
stpo.menge as BillOfMaterialItemQuantity,
stpo.upskz as IsSubItem,
stpo.sortf as SortString,
stpo.sortf as BOMItemSorter,
stpo.fmeng as FixedQuantity,
stpo.fmeng as BOMItemHasFixedQuantity,
stpo.ekgrp as PurchasingGroup,
@Semantics.currencyCode: true
stpo.waers as Currency,
@Semantics.amount.currencyCode : 'Currency'
stpo.preis as MaterialComponentPrice,
case when
( stpo.itmid is null or stpo.itmid = '')
then stpo.stvkn
else
stpo.itmid
end as IdentifierBOMItem,
//stpo.itmid as IdentifierBOMItem,
stpo.peinh as MaterialPriceUnitQty,
stpo.ausch as ComponentScrapInPercent,
stpo.avoau as OperationScrapInPercent,
stpo.netau as IsNetScrap,
stpo.roanz as NumberOfVariableSizeItem,
stpo.romen as QuantityVariableSizeItem,
stpo.rform as FormulaKey,
stpo.potx1 as BOMItemDescription,
stpo.potx2 as BOMItemText2,
stpo.ltxsp as LongTextLanguage,
stpo.matkl as MaterialGroup,
stpo.dokar as DocumentType,
stpo.doknr as DocNumber,
stpo.dokvr as DocumentVersion,
stpo.doktl as DocumentPart,
stpo.class as ClassNumber,
stpo.klart as ClassType,
stpo.potpr as ResultingItemCategory,
stpo.knobj as DependencyObjectNumber,
stpo.objty as ObjectType,
stpo.kzclb as IsClassificationRelevant,
stpo.schgt as IsBulkMaterial,
stpo.erskz as BOMItemIsSparePart,
stpo.rvrel as BOMItemIsSalesRelevant,
stpo.sanfe as IsProductionRelevant,
stpo.sanin as BOMItemIsPlantMaintRelevant,
stpo.sanka as BOMItemIsCostingRelevant,
stpo.sanko as IsEngineeringRelevant,
stpo.itsob as SpecialProcurementType,
stpo.rekrs as IsBOMRecursiveAllowed,
stpo.nlfzv as OperationLeadTimeOffset,
stpo.nlfmv as OpsLeadTimeOffsetUnit,
stpo.aedat as BOMItemChangeDate,
stpo.beikz as IsMaterialProvision,
stpo.rekri as BOMIsRecursive,
stpo.cadpo as DocumentIsCreatedByCAD,
stpo.verti as DistrKeyCompConsumption,
stpo.lifzt as DeliveryDurationInDays,
case when Supplier.IsBusinessPurposeCompleted is null or Supplier.IsBusinessPurposeCompleted = ''
then stpo.lifnr else
cast (' ' as lifnr preserving type)
end as Creditor,
stpo.sakto as CostElement,
stpo.roms1 as Size1,
stpo.roms2 as Size2,
stpo.roms3 as Size3,
stpo.romei as UnitOfMeasureForSize1To3,
stpo.webaz as GoodsReceiptDuration,
stpo.ekorg as PurchasingOrganization,
stpo.clobk as RequiredComponent,
stpo.clmul as MultipleSelectionAllowed,
stpo.lgort as ProdOrderIssueLocation,
stpo.kzkup as MaterialIsCoProduct,
stpo.dspst as ExplosionType,
stpo.nfgrp as FollowUpGroup,
stpo.nfeag as DiscontinuationGroup,
stpo.cview as ReinsurContrOrgUnit,
stpo.awakz as IsConfigurableBOM,
stpo.rfpnt as ReferencePoint,
stpo.nlfzt as LeadTimeOffset,
stpo.sfwind as IsSoftwareComponent,
stpo.prvbe as ProductionSupplyArea,
stpo.lkenz as IsDeleted,
stpo.alekz as IsALE,
tcs03.bmein as UnitOfMeasureForPiece,
tcs03.roame as UnitOfMeasureForVarSizeItem,
//Alternative Item Fields
stpo.alpgr as AlternativeItemGroup,
stpo.alprf as AlternativeItemPriority,
stpo.alpst as AlternativeItemStrategy,
stpo.ewahr as UsageProbabilityPercent,
stpo.stkkz as IsPMAssemblyRelevant,
cast(' ' as xfeld preserving type) as IsAssembly,
case
when t460a.Dumps = 'X'
then cast('X' as xfeld preserving type)
else
cast('' as xfeld preserving type)
end as IsPhantomItem,
t460a.SpclProcmtTypeIsConsistent,
case
when stpo.lastchangedatetime = 0.0000000 then
case when stpo.aenam <> '' then cast(dats_tims_to_tstmp(stpo.aedat, cast('120000' as uzeit), 'UTC', $session.client, 'NULL') as timestampl )
else cast(dats_tims_to_tstmp(stpo.andat, cast('120000' as uzeit), 'UTC', $session.client, 'NULL') as timestampl )
end
else
stpo.lastchangedatetime
end as LastChangeDateTime,
stpo.kstty as OrigSalesOrderBOMItmCategory,
stpo.kstnr as OrigSalesOrderBOM,
stpo.kstkn as OrigSalesOrderBOMItmNodeNumber,
stpo.kstpz as OrigSalesOrderBOMItmNumber,
stpo.preliminary_material as PreliminaryMaterial
// stpo.idpos as BOMItemGroup
}
--where
--stpo.valid_to != '00000000'
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_SUPPLIER",
"P_T460AGLOBAL",
"STAS",
"STPO",
"TCS03"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/
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