P_TRDGCONTRITEMQUANTITYDATA
P_TRDGCONTRITEMQUANTITYDATA is a Basic CDS View in SAP S/4HANA. It reads from 5 data sources (wbhd, wbhi, wbgt, wbhk, mara) and exposes 30 fields with key fields ContractNum, ContractItem, ContractSubItem.
Data Sources (5)
Annotations (11)
| Name | Value | Level | Field |
|---|---|---|---|
| AbapCatalog.sqlViewName | ICONTRITMQTY | view | |
| AccessControl.authorizationCheck | #NOT_REQUIRED | view | |
| ClientHandling.type | #INHERITED | view | |
| ClientHandling.algorithm | #SESSION_VARIABLE | view | |
| VDM.viewType | #BASIC | view | |
| VDM.private | true | view | |
| AbapCatalog.compiler.compareFilter | true | view | |
| AbapCatalog.preserveKey | true | view | |
| ObjectModel.usageType.dataClass | #TRANSACTIONAL | view | |
| ObjectModel.usageType.serviceQuality | #C | view | |
| ObjectModel.usageType.sizeCategory | #L | view |
Fields (30)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | ContractNum | wbhi | tkonn | |
| KEY | ContractItem | wbhi | tposn | |
| KEY | ContractSubItem | wbhi | tposn_sub | |
| vrkmeendasTrdgContractItemUnitOfMeasure | ||||
| ContractMaterial | wbhi | matnr | ||
| ContractPlant | wbhi | werks | ||
| RelatedDocumentNumber | wbhi | pred_number | ||
| RelatedDocumentItemNumber | wbhi | pred_item_number | ||
| TradingContractType | wbhk | tctyp | ||
| CompanyCode | wbhk | company_code | ||
| DocumentDate | wbhk | erdat | ||
| TradingContractCreatedBy | wbhk | ernam | ||
| SalesOrganization | wbhk | vkorg | ||
| DistributionChannel | wbhk | vtweg | ||
| Division | wbhk | spart | ||
| PurchasingOrganization | wbhd | ekorg | ||
| PurchasingGroup | wbhd | ekgrp | ||
| Commodity | mara | commodity | ||
| CustomerName | wbhk | kunnr | ||
| SupplierName | wbhd | elifn | ||
| StorageLocation | wbhi | lgort | ||
| DocumentSide | wbgt | side | ||
| TradingContrCreatedOnDate | wbhk | erdat | ||
| TradingContrCreatedOnTime | wbhk | erzeit | ||
| TradingContrChangedOnDate | wbhk | aedat | ||
| TradingContrChangedOnTime | wbhk | aezeit | ||
| ACMContractStatus | wbhk | btbsta | ||
| knumv_sdendasPricingDocument | ||||
| kalsm_sdendasPricingProcedure | ||||
| TrdgContrSrceDocType | wbhk | created_from |
@AbapCatalog.sqlViewName: 'ICONTRITMQTY'
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientHandling.type: #INHERITED
@ClientHandling.algorithm: #SESSION_VARIABLE
@VDM.viewType: #BASIC
@VDM.private: true
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@ObjectModel.usageType.dataClass: #TRANSACTIONAL
@ObjectModel.usageType.serviceQuality: #C
@ObjectModel.usageType.sizeCategory: #L
//@EndUserText.label: 'ACM Qty: Shadow Item Data'
/* Basic Interface View to get Quantity Data for a Contract (Sales & Purchase) */
define view P_TRDGCONTRITEMQUANTITYDATA
as select from wbhi as ContractItem
inner join wbgt as GenericDocInfo on ContractItem.tkonn = GenericDocInfo.vbeln
and ContractItem.tposn = GenericDocInfo.posnr
inner join wbhk as Header on ContractItem.tkonn = Header.tkonn
inner join wbhd as Business on ContractItem.tkonn = Business.tkonn
inner join mara as Material on ContractItem.matnr = Material.matnr
{
key ContractItem.tkonn as ContractNum,
key ContractItem.tposn as ContractItem,
key ContractItem.tposn_sub as ContractSubItem,
// key ContractItem.tposn_sub as ContractCommodityItem,
@Semantics.quantity.unitOfMeasure: 'TrdgContractItemUnitOfMeasure'
case GenericDocInfo.side
when 'P' then ContractItem.menge
when 'S' then ContractItem.kwmeng
else 0
end as TradingContractItemQuantity,
@Semantics.unitOfMeasure: true
case GenericDocInfo.side
when 'P' then ContractItem.meins
when 'S' then ContractItem.vrkme
end as TrdgContractItemUnitOfMeasure,
ContractItem.matnr as ContractMaterial,
ContractItem.werks as ContractPlant,
ContractItem.pred_number as RelatedDocumentNumber,
ContractItem.pred_item_number as RelatedDocumentItemNumber,
Header.tctyp as TradingContractType,
Header.company_code as CompanyCode,
Header.erdat as DocumentDate,
Header.ernam as TradingContractCreatedBy,
Header.vkorg as SalesOrganization,
Header.vtweg as DistributionChannel,
Header.spart as Division,
Business.ekorg as PurchasingOrganization,
Business.ekgrp as PurchasingGroup,
Material.commodity as Commodity,
Header.kunnr as CustomerName,
Business.elifn as SupplierName,
// case GenericDocInfo.side
// when 'S' then Header.kunnr //CustomerName
// when 'P' then Business.elifn //Supplier
// end as Counterparty
ContractItem.lgort as StorageLocation,
GenericDocInfo.side as DocumentSide,
cast(DATS_TIMS_TO_TSTMP(Header.erdat,
Header.erzeit,
abap_system_timezone($session.client, 'NULL'),
$session.client, 'NULL')
as /accgo/e_contract_create_ts preserving type) as TradingContrCreatedOnDateTime,
cast(DATS_TIMS_TO_TSTMP(Header.aedat,
Header.aezeit,
abap_system_timezone($session.client, 'NULL'),
$session.client, 'NULL')
as /accgo/e_contract_change_ts preserving type) as TradingContrChangedOnDateTime,
Header.erdat as TradingContrCreatedOnDate,
Header.erzeit as TradingContrCreatedOnTime,
Header.aedat as TradingContrChangedOnDate,
Header.aezeit as TradingContrChangedOnTime,
Header.btbsta as ACMContractStatus,
case GenericDocInfo.side
when 'P' then Business.knumv_mm
when 'S' then Header.knumv_sd
end as PricingDocument,
case GenericDocInfo.side
when 'P' then Business.kalsm_mm
when 'S' then Header.kalsm_sd
end as PricingProcedure,
Header.created_from as TrdgContrSrceDocType
}
where
GenericDocInfo.doc_type = 'Q'
and Business.tposn = '000000'
and Header.created_from is initial -- To exclude LTC (Logistical TC will have PO/SO filled in this field)
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