P_ClearedItem2
P_ClearedItem2 is a Consumption CDS View in SAP S/4HANA. It reads from 2 data sources (P_ClearedItem1, I_JournalEntry) and exposes 25 fields with key fields CompanyCode, FiscalYear, AccountingDocument, AccountingDocumentItem, FinancialAccountType.
Data Sources (2)
| Source | Alias | Join Type |
|---|---|---|
| P_ClearedItem1 | CleardItem | inner |
| I_JournalEntry | I_JournalEntry | from |
Annotations (6)
| Name | Value | Level | Field |
|---|---|---|---|
| AbapCatalog.sqlViewName | PCLRDITM2 | view | |
| AbapCatalog.compiler.compareFilter | true | view | |
| VDM.viewType | #CONSUMPTION | view | |
| VDM.private | true | view | |
| AccessControl.authorizationCheck | #NOT_ALLOWED | view | |
| ClientHandling.algorithm | #SESSION_VARIABLE | view |
Fields (25)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | CompanyCode | P_ClearedItem1 | CompanyCode | |
| KEY | FiscalYear | P_ClearedItem1 | FiscalYear | |
| KEY | AccountingDocument | P_ClearedItem1 | AccountingDocument | |
| KEY | AccountingDocumentItem | P_ClearedItem1 | AccountingDocumentItem | |
| KEY | FinancialAccountType | P_ClearedItem1 | FinancialAccountType | |
| ClearingJournalEntry | P_ClearedItem1 | ClearingJournalEntry | ||
| ClearingJournalEntryFiscalYear | P_ClearedItem1 | ClearingJournalEntryFiscalYear | ||
| AccountingDocumentType | P_ClearedItem1 | AccountingDocumentType | ||
| AccountingDocumentCategory | P_ClearedItem1 | AccountingDocumentCategory | ||
| AssignmentReference | P_ClearedItem1 | AssignmentReference | ||
| CompanyCodeCurrency | P_ClearedItem1 | CompanyCodeCurrency | ||
| DocumentDate | P_ClearedItem1 | DocumentDate | ||
| DocumentItemText | P_ClearedItem1 | DocumentItemText | ||
| InvoiceReference | P_ClearedItem1 | InvoiceReference | ||
| FollowOnDocumentType | P_ClearedItem1 | FollowOnDocumentType | ||
| PostingDate | P_ClearedItem1 | PostingDate | ||
| SpecialGLCode | P_ClearedItem1 | SpecialGLCode | ||
| Account | P_ClearedItem1 | Account | ||
| PaymentCardItem | P_ClearedItem1 | PaymentCardItem | ||
| AmountInCompanyCodeCurrency | ||||
| CashDiscountAmtInCoCodeCrcy | ||||
| AmountInAdditionalCurrency1 | P_ClearedItem1 | AmountInAdditionalCurrency1 | ||
| AmountInAdditionalCurrency2 | P_ClearedItem1 | AmountInAdditionalCurrency2 | ||
| IntercompanyTransaction | I_JournalEntry | IntercompanyTransaction | ||
| TransactionCode | I_JournalEntry | TransactionCode |
@AbapCatalog.sqlViewName: 'PCLRDITM2'
@AbapCatalog.compiler.compareFilter: true
@VDM.viewType: #CONSUMPTION
@VDM.private: true
@AccessControl.authorizationCheck: #NOT_ALLOWED
@ClientHandling.algorithm: #SESSION_VARIABLE
define view P_ClearedItem2 as
//Support of Intercompany Use Case
//Clearing Document belongs to an Intercompany transaction.
//Hence the other clearing documents belonging to the same Intercompany transaction need to be
//retrieved in order to get the cleared items which they have cleared
select from I_JournalEntry
inner join P_ClearedItem1 as CleardItem on I_JournalEntry.CompanyCode = CleardItem.CompanyCode
and I_JournalEntry.AccountingDocument = CleardItem.ClearingJournalEntry
and I_JournalEntry.FiscalYear = CleardItem.ClearingJournalEntryFiscalYear
{
key CleardItem.CompanyCode,
key CleardItem.FiscalYear,
key CleardItem.AccountingDocument,
key CleardItem.AccountingDocumentItem,
//The fields CompanyCode, FiscalYear, AccountingDocument and AccountingDocumentItem might not form an unique key
//for line items which belong to an Accounting Document which has been archived and the line items still reside in
//the corresponding *_BCK Tables. The reason is that the value of field AccountingDocumentItem might change during
//the move of line items from BSEG/BSEG_ADD to the *_BCK tables.
//Due to that the field FinancialAccountType is part of the key.
key CleardItem.FinancialAccountType,
CleardItem.ClearingJournalEntry,
CleardItem.ClearingJournalEntryFiscalYear,
CleardItem.AccountingDocumentType,
CleardItem.AccountingDocumentCategory,
CleardItem.AssignmentReference,
@Semantics.currencyCode:true
CleardItem.CompanyCodeCurrency,
CleardItem.DocumentDate,
CleardItem.DocumentItemText,
CleardItem.InvoiceReference,
CleardItem.FollowOnDocumentType,
CleardItem.PostingDate,
CleardItem.SpecialGLCode,
CleardItem.Account,
CleardItem.PaymentCardItem,
@Semantics: { amount : {currencyCode: 'CompanyCodeCurrency'} }
cast( AmountInCompanyCodeCurrency as dmshb_farp ) as AmountInCompanyCodeCurrency,
@Semantics: { amount : {currencyCode: 'CompanyCodeCurrency'} }
cast( CashDiscountAmtInCoCodeCrcy as sknto_farp ) as CashDiscountAmtInCoCodeCrcy,
CleardItem.AmountInAdditionalCurrency1,
CleardItem.AmountInAdditionalCurrency2,
cast(case
when CleardItem.AccountingDocumentItemType = 'Z' then
'X'
else
''
end as boole_d) as IsNetInvoiceCashDiscClearing,
I_JournalEntry.IntercompanyTransaction,
I_JournalEntry.TransactionCode
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_JOURNALENTRY",
"P_CLEAREDITEM1"
],
"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