P_PL_SAFTSalesInvItem
P_PL_SAFTSalesInvItem is a Composite CDS View in SAP S/4HANA. It reads from 3 data sources (P_PL_SAFTBillingDocumentBasic, I_BillingDocumentItem, P_PL_SAFTInvoiceTax) and exposes 17 fields with key fields CompanyCode, AccountingDocument, FiscalYear, BillingDocument, BillingDocumentItem.
Data Sources (3)
| Source | Alias | Join Type |
|---|---|---|
| P_PL_SAFTBillingDocumentBasic | Header | inner |
| I_BillingDocumentItem | Item | inner |
| P_PL_SAFTInvoiceTax | Tax | inner |
Parameters (2)
| Name | Type | Default |
|---|---|---|
| P_StartDate | datum | |
| P_EndDate | datum |
Annotations (10)
| Name | Value | Level | Field |
|---|---|---|---|
| AbapCatalog.sqlViewName | PPLSAFTSLSINVITM | view | |
| AbapCatalog.compiler.compareFilter | true | view | |
| AbapCatalog.preserveKey | true | view | |
| AccessControl.authorizationCheck | #CHECK | view | |
| VDM.private | true | view | |
| VDM.viewType | #COMPOSITE | view | |
| ObjectModel.usageType.sizeCategory | #XL | view | |
| ObjectModel.usageType.dataClass | #MIXED | view | |
| ObjectModel.usageType.serviceQuality | #D | view | |
| ClientHandling.algorithm | #SESSION_VARIABLE | view |
Fields (17)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | CompanyCode | Entry | CompanyCode | |
| KEY | AccountingDocument | Entry | AccountingDocument | |
| KEY | FiscalYear | Entry | FiscalYear | |
| KEY | BillingDocument | I_BillingDocumentItem | BillingDocument | |
| KEY | BillingDocumentItem | I_BillingDocumentItem | BillingDocumentItem | |
| PL_SAFTInvoiceType | P_PL_SAFTBillingDocumentBasic | PL_SAFTInvoiceType | ||
| CancelledBillingDocument | P_PL_SAFTBillingDocumentBasic | CancelledBillingDocument | ||
| BillingDocumentItemText | I_BillingDocumentItem | BillingDocumentItemText | ||
| BillingQuantityUnit | I_BillingDocumentItem | BillingQuantityUnit | ||
| BillingQuantity | I_BillingDocumentItem | BillingQuantity | ||
| NetPriceAmountendasnetprasNetPriceAmount | ||||
| CompanyCodeCurrency | Entry | CompanyCodeCurrency | ||
| TransactionCurrency | I_BillingDocumentItem | TransactionCurrency | ||
| NetAmount | I_BillingDocumentItem | NetAmount | ||
| NetAmountendasDiscountAmount | ||||
| TaxCode | ||||
| PL_SAFTTaxPercentageCode | P_PL_SAFTInvoiceTax | PL_SAFTTaxPercentageCode |
@AbapCatalog.sqlViewName: 'PPLSAFTSLSINVITM'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@VDM.private: true
@VDM.viewType: #COMPOSITE
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.dataClass: #MIXED
@ObjectModel.usageType.serviceQuality: #D
@ClientHandling.algorithm: #SESSION_VARIABLE
define view P_PL_SAFTSalesInvItem
with parameters
P_StartDate : datum,
P_EndDate : datum
as select distinct from P_PL_SAFTInvoiceHeaderBasic( P_StartDate:$parameters.P_StartDate, P_EndDate: $parameters.P_EndDate) as Entry
inner join I_BillingDocumentItem as Item on Item.BillingDocument = Entry.BillingDocument
inner join P_PL_SAFTBillingDocumentBasic as Header on Header.BillingDocument = Item.BillingDocument
and(
Header.PL_SAFTInvoiceType <> 'ZAL'
or Header.CancelledBillingDocument is not initial
)
inner join P_PL_SAFTInvoiceTax as Tax on Tax.CompanyCode = Entry.CompanyCode
and Tax.AccountingDocument = Entry.AccountingDocument
and Tax.FiscalYear = Entry.FiscalYear
and Tax.TaxCode = Item.TaxCode
{
key Entry.CompanyCode,
key Entry.AccountingDocument,
key Entry.FiscalYear,
key Item.BillingDocument,
key Item.BillingDocumentItem,
Header.PL_SAFTInvoiceType,
Header.CancelledBillingDocument,
case when Header.SDDocumentCategory = 'O' //Credit Memo
or Header.SDDocumentCategory = 'N' //Invoice Cancellation
or Header.SDDocumentCategory = '4' //Credit Memo List
then 'X'
else ' '
end as ItemSignIsReversed,
Item.BillingDocumentItemText,
Item.BillingQuantityUnit,
Item.BillingQuantity,
@Semantics.amount.currencyCode: 'TransactionCurrency'
cast( case when Item.BillingQuantity is not initial
then division(Item.NetAmount,Item.BillingQuantity,2)
else Item._SalesDocumentItem.NetPriceAmount
end as netpr) as NetPriceAmount,
@Semantics.currencyCode: true
Entry.CompanyCodeCurrency,
@Semantics.currencyCode: true
Item.TransactionCurrency,
@Semantics.amount.currencyCode: 'TransactionCurrency'
Item.NetAmount,
@Semantics.amount.currencyCode: 'TransactionCurrency'
case
when Header.BillingDocumentType = 'G2DP' and Header.PL_SAFTInvoiceType = 'KOREKTA'
then 0
else Item.Subtotal1Amount - Item.NetAmount
end as DiscountAmount,
Item._PricingElement[ ConditionApplication = 'V'
and ConditionClass = 'D'
and ConditionCategory = 'D'
and ConditionInactiveReason = ''
and ConditionIsForStatistics = ''
].TaxCode,
Tax.PL_SAFTTaxPercentageCode
}
where
Entry.BusinessTransactionType = 'SD00'
and not(
Header.PL_SAFTInvoiceType = 'ZAL'
and Header.CancelledBillingDocument is not initial
)
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_BILLINGDOCUMENTITEM",
"I_BILLINGDOCUMENTITEMPRCGELMNT",
"I_SALESDOCUMENTITEM",
"P_PL_SAFTBILLINGDOCUMENTBASIC",
"P_PL_SAFTINVOICEHEADERBASIC",
"P_PL_SAFTINVOICETAX"
],
"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