P_PL_SAFTInvoiceItem
P_PL_SAFTInvoiceItem is a Consumption CDS View in SAP S/4HANA. It reads from 2 data sources (P_PL_SAFTAcctgInvoiceItem, P_PL_SAFTSalesInvItem) and exposes 25 fields with key fields CompanyCode, AccountingDocument, FiscalYear, BillingDocumentItem, AccountingDocument.
Data Sources (2)
| Source | Alias | Join Type |
|---|---|---|
| P_PL_SAFTAcctgInvoiceItem | P_PL_SAFTAcctgInvoiceItem | union |
| P_PL_SAFTSalesInvItem | P_PL_SAFTSalesInvItem | from |
Parameters (2)
| Name | Type | Default |
|---|---|---|
| P_StartDate | datum | |
| P_EndDate | datum |
Annotations (10)
| Name | Value | Level | Field |
|---|---|---|---|
| AbapCatalog.sqlViewName | PPLSAFTINVITM | view | |
| AbapCatalog.compiler.compareFilter | true | view | |
| AbapCatalog.preserveKey | true | view | |
| AccessControl.authorizationCheck | #CHECK | view | |
| VDM.private | true | view | |
| VDM.viewType | #CONSUMPTION | view | |
| ObjectModel.usageType.sizeCategory | #XL | view | |
| ObjectModel.usageType.dataClass | #MIXED | view | |
| ObjectModel.usageType.serviceQuality | #P | view | |
| ClientHandling.algorithm | #SESSION_VARIABLE | view |
Fields (25)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | CompanyCode | CompanyCode | ||
| KEY | AccountingDocument | AccountingDocument | ||
| KEY | FiscalYear | FiscalYear | ||
| KEY | BillingDocumentItem | BillingDocumentItem | ||
| InvoiceDocumentNumber | ||||
| MaterialDescription | BillingDocumentItemText | |||
| UnitOfMeasure | BillingQuantityUnit | |||
| TransactionCurrency | TransactionCurrency | |||
| CompanyCodeCurrency | CompanyCodeCurrency | |||
| Quantity | BillingQuantity | |||
| P_StartDate | ||||
| P_EndDatekeyCompanyCode | ||||
| KEY | AccountingDocument | AccountingDocument | ||
| KEY | FiscalYear | FiscalYear | ||
| KEY | BillingDocumentItem | |||
| InvoiceDocumentNumber | InvoiceDocumentNumber | |||
| MaterialDescription | DocumentItemText | |||
| UnitOfMeasure | BaseUnit | |||
| TransactionCurrency | TransactionCurrency | |||
| CompanyCodeCurrency | CompanyCodeCurrency | |||
| Quantity | Quantity | |||
| NetPriceAmount | NetPriceAmount | |||
| NetAmount | AmountInTransactionCurrency | |||
| DiscountAmount | 0 | |||
| TaxRate |
@AbapCatalog.sqlViewName: 'PPLSAFTINVITM'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@VDM.private: true
@VDM.viewType: #CONSUMPTION
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.serviceQuality: #P
@ClientHandling.algorithm: #SESSION_VARIABLE
define view P_PL_SAFTInvoiceItem
with parameters
P_StartDate : datum,
P_EndDate : datum
as select from P_PL_SAFTSalesInvItem( P_StartDate:$parameters.P_StartDate, P_EndDate: $parameters.P_EndDate)
{
key CompanyCode,
key AccountingDocument,
key FiscalYear,
key BillingDocumentItem,
ltrim(cast(BillingDocument as abap.char(30)),'0') as InvoiceDocumentNumber,
BillingDocumentItemText as MaterialDescription,
@Semantics.unitOfMeasure: true
BillingQuantityUnit as UnitOfMeasure,
@Semantics.currencyCode: true
TransactionCurrency,
@Semantics.currencyCode: true
CompanyCodeCurrency,
@Semantics.quantity.unitOfMeasure: 'UnitOfMeasure'
BillingQuantity as Quantity,
@Semantics.amount.currencyCode: 'TransactionCurrency'
case when PL_SAFTInvoiceType = 'KOREKTA'
then abs(NetPriceAmount)
when ItemSignIsReversed is not initial
then -NetPriceAmount
else NetPriceAmount
end as NetPriceAmount,
@Semantics.amount.currencyCode: 'TransactionCurrency'
cast( case when ItemSignIsReversed is not initial
then -NetAmount
else NetAmount end as fis_wsl) as NetAmount,
@Semantics.amount.currencyCode: 'TransactionCurrency'
case when ItemSignIsReversed is not initial
then -DiscountAmount
else DiscountAmount
end as DiscountAmount,
// coalesce(lower(_Tax.PL_SAFTTaxPercentageCode),'zw') as TaxRate
coalesce(lower(PL_SAFTTaxPercentageCode),'zw') as TaxRate
}
union
select from P_PL_SAFTAcctgInvoiceItem( P_StartDate:$parameters.P_StartDate, P_EndDate: $parameters.P_EndDate)
{
key CompanyCode,
key AccountingDocument,
key FiscalYear,
key cast(concat('000',AccountingDocumentItem) as posnr_vf) as BillingDocumentItem,
InvoiceDocumentNumber,
DocumentItemText as MaterialDescription,
@Semantics.unitOfMeasure: true
BaseUnit as UnitOfMeasure,
@Semantics.currencyCode: true
TransactionCurrency,
@Semantics.currencyCode: true
CompanyCodeCurrency,
@Semantics.quantity.unitOfMeasure: 'UnitOfMeasure'
Quantity,
@Semantics.amount.currencyCode: 'TransactionCurrency'
NetPriceAmount,
@Semantics.amount.currencyCode: 'TransactionCurrency'
AmountInTransactionCurrency as NetAmount,
@Semantics.amount.currencyCode: 'TransactionCurrency'
0 as DiscountAmount,
coalesce(_Tax.PL_SAFTTaxPercentageCode,'zw') as TaxRate
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"P_PL_SAFTACCTGINVOICEITEM",
"P_PL_SAFTINVOICETAX",
"P_PL_SAFTSALESINVITEM"
],
"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