P_CalculatedAllwncCustomers
Calculated Allowance documents with ref. to customers
P_CalculatedAllwncCustomers is a Composite CDS View that provides data about "Calculated Allowance documents with ref. to customers" in SAP S/4HANA. It reads from 1 data source (I_OperationalAcctgDocItem) and exposes 18 fields with key fields CompanyCode, AccountingDocument, FiscalYear, AccountingDocumentItem. It has 3 associations to related views. Part of development package ODATA_DOUBTFUL_ACCTS_VALUATION.
Data Sources (1)
| Source | Alias | Join Type |
|---|---|---|
| I_OperationalAcctgDocItem | I_OperationalAcctgDocItem | from |
Parameters (1)
| Name | Type | Default |
|---|---|---|
| P_KeyDate | sydate |
Associations (3)
| Cardinality | Target | Alias | Condition |
|---|---|---|---|
| [1..1] | P_CalculatedAllwncCrdtAccount | _DoubtfulReceivables | _DoubtfulReceivables.CreditGLAccount = $projection.GLAccount |
| [0..1] | I_Customer | _ReferencedCustomer | _ReferencedCustomer.Customer = $projection.ReferencedCustomer |
| [0..1] | I_OperationalAcctgDocItem | _ReferencedDocument | _ReferencedDocument.AccountingDocument = $projection.ReferencedDocument and _ReferencedDocument.CompanyCode = $projection.CompanyCode and _ReferencedDocument.FiscalYear = $projection.ReferencedFiscalYear and _ReferencedDocument.AccountingDocumentItem = $projection.ReferencedDocumentItem |
Annotations (7)
| Name | Value | Level | Field |
|---|---|---|---|
| AbapCatalog.sqlViewName | PCALALLWNCCUST | view | |
| AbapCatalog.compiler.compareFilter | true | view | |
| AbapCatalog.preserveKey | true | view | |
| AccessControl.authorizationCheck | #NOT_REQUIRED | view | |
| ClientHandling.algorithm | #SESSION_VARIABLE | view | |
| VDM.viewType | #COMPOSITE | view | |
| VDM.private | true | view |
Fields (18)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | CompanyCode | CompanyCode | ||
| KEY | AccountingDocument | AccountingDocument | ||
| KEY | FiscalYear | FiscalYear | ||
| KEY | AccountingDocumentItem | AccountingDocumentItem | ||
| SpecialGLCode | SpecialGLCode | |||
| ReferencedCustomer | ||||
| ReferencedDocument | ||||
| ReferencedDocumentItem | ||||
| ReferencedFiscalYear | ||||
| AccountingDocumentType | AccountingDocumentType | |||
| PostingDate | PostingDate | |||
| NetDueDate | ||||
| GLAccount | GLAccount | |||
| AmountInCompanyCodeCurrency | AmountInCompanyCodeCurrency | |||
| CompanyCodeCurrency | CompanyCodeCurrency | |||
| AssignmentReference | AssignmentReference | |||
| _ReferencedCustomer | _ReferencedCustomer | |||
| _ReferencedDocument | _ReferencedDocument |
@AbapCatalog.sqlViewName: 'PCALALLWNCCUST'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey:true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE
@VDM.viewType: #COMPOSITE
@VDM.private: true
define view P_CalculatedAllwncCustomers
with parameters
P_KeyDate : sydate
as select from I_OperationalAcctgDocItem
association [1..1] to P_CalculatedAllwncCrdtAccount as _DoubtfulReceivables on _DoubtfulReceivables.CreditGLAccount = $projection.GLAccount
association [0..1] to I_Customer as _ReferencedCustomer on _ReferencedCustomer.Customer = $projection.ReferencedCustomer
association [0..1] to I_OperationalAcctgDocItem as _ReferencedDocument on _ReferencedDocument.AccountingDocument = $projection.ReferencedDocument
and _ReferencedDocument.CompanyCode = $projection.CompanyCode
and _ReferencedDocument.FiscalYear = $projection.ReferencedFiscalYear
and _ReferencedDocument.AccountingDocumentItem = $projection.ReferencedDocumentItem
{
key CompanyCode,
key AccountingDocument,
key FiscalYear,
key AccountingDocumentItem,
case SpecialGLCode
when '' then cast( '' as fis_kunnr ) // Key 50 or 40: calculated allowance - no direct customer assignment
else cast( Customer as fis_kunnr ) // Key 19 or 09: special allowance - direct customer assignment
end as AssignedCustomer,
case SpecialGLCode
when '' then AmountInCompanyCodeCurrency //Key 50 or 40 - calculated allowance
else 0 //Key 19 or 09
end as CalcdAllwncForDoubtfulAccts,
case SpecialGLCode
when '' then 0 //Key 50 or 40
else AmountInCompanyCodeCurrency //Key 19 or 09 - special allowance
end as SpclAllwncForDoubtfulAccts,
SpecialGLCode,
cast(substring(AssignmentReference, 1, 10) as fis_kunnr) as ReferencedCustomer,
cast(substring(AssignmentReference, 1, 10) as farp_belnr_d) as ReferencedDocument,
cast(substring(AssignmentReference, 11, 3) as fis_buzei ) as ReferencedDocumentItem,
cast(substring(AssignmentReference, 14, 4) as fis_gjahr ) as ReferencedFiscalYear,
AccountingDocumentType,
PostingDate,
cast('00000000' as farp_netdt) as NetDueDate,
case SpecialGLCode
when '' then cast('CA' as farp_dav_document_category)
else cast('SP' as farp_dav_document_category)
end as BadDebtReserveDocumentCategory,
GLAccount,
AmountInCompanyCodeCurrency,
CompanyCodeCurrency,
AssignmentReference,
_ReferencedCustomer,
_ReferencedDocument
}
where
GLAccount = _DoubtfulReceivables.CreditGLAccount
and PostingDate <= :P_KeyDate
and(
(
SpecialGLCode = ''
and(
PostingKey = '50'
or PostingKey = '40'
)
)
or(
SpecialGLCode != ''
and(
PostingKey = '19'
or PostingKey = '09'
)
)
)
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