P_KZ_VATRetCdec
P_KZ_VATRetCdec is a Composite CDS View in SAP S/4HANA. It reads from 3 data sources (I_CompanyCode, I_KZ_VATCstmDeclnItemLog, P_KZ_CustomDeclarationPrev) and exposes 17 fields with key fields StatryRptgEntity, StatryRptCategory, StatryRptRunID, CompanyCode, FiscalYear.
Data Sources (3)
| Source | Alias | Join Type |
|---|---|---|
| I_CompanyCode | CompanyCode | left_outer |
| I_KZ_VATCstmDeclnItemLog | ItemLog | from |
| P_KZ_CustomDeclarationPrev | P_KZ_CustomDeclarationPrev | left_outer |
Parameters (2)
| Name | Type | Default |
|---|---|---|
| P_FiscalYear | gjahr | |
| P_FiscalPeriod | j_3rf_quarters |
Annotations (7)
| Name | Value | Level | Field |
|---|---|---|---|
| AbapCatalog.sqlViewName | PKZVATRETCDEC | view | |
| ClientHandling.algorithm | #SESSION_VARIABLE | view | |
| AccessControl.authorizationCheck | #NOT_REQUIRED | view | |
| VDM.viewType | #COMPOSITE | view | |
| VDM.private | true | view | |
| AbapCatalog.preserveKey | true | view | |
| AbapCatalog.compiler.compareFilter | true | view |
Fields (17)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | StatryRptgEntity | I_KZ_VATCstmDeclnItemLog | StatryRptgEntity | |
| KEY | StatryRptCategory | I_KZ_VATCstmDeclnItemLog | StatryRptCategory | |
| KEY | StatryRptRunID | I_KZ_VATCstmDeclnItemLog | StatryRptRunID | |
| KEY | CompanyCode | I_KZ_VATCstmDeclnItemLog | CompanyCode | |
| KEY | FiscalYear | I_KZ_VATCstmDeclnItemLog | FiscalYear | |
| KEY | FiscalPeriod | I_KZ_VATCstmDeclnItemLog | PostingFiscalPeriod | |
| KEY | CustomDeclarationNumber | I_KZ_VATCstmDeclnItemLog | CustomsDeclaration | |
| KEY | SectionNum | KZ_VATReturnSection | ||
| LineItem | ||||
| KEY | LineItem | |||
| CustomDeclDate | CustDecl | CustomsDeclarationRegDate | ||
| LocalVATAMount | CustDecl | TaxAmount | ||
| PaymentLimitDate | CustDecl | PaymentDate | ||
| PaidVATAmount | CustDecl | PaidAmountInPaytCurrency | ||
| PaidVATAmountPrev | CustDeclPrev | PaidVATAmount | ||
| VatDebt | ||||
| Currency | I_CompanyCode | Currency |
@AbapCatalog.sqlViewName: 'PKZVATRETCDEC'
@ClientHandling.algorithm: #SESSION_VARIABLE
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.viewType: #COMPOSITE
@VDM.private: true
@AbapCatalog.preserveKey:true
@AbapCatalog.compiler.compareFilter:true
define view P_KZ_VATRetCdec
with parameters
P_FiscalYear : gjahr,
P_FiscalPeriod : j_3rf_quarters
as select from I_KZ_VATCstmDeclnItemLog as ItemLog
join P_KZ_CUSTOMDECLARATION as CustDecl on CustDecl.CompanyCode = ItemLog.CompanyCode
and CustDecl.CustomsDeclaration = ItemLog.CustomsDeclaration
and CustDecl.FiscalYear = ItemLog.FiscalYear
and CustDecl.PostingFiscalPeriod = ItemLog.PostingFiscalPeriod
left outer join P_KZ_CustomDeclarationPrev( P_FiscalYear : $parameters.P_FiscalYear,
P_FiscalPeriod : $parameters.P_FiscalPeriod ) as CustDeclPrev on CustDecl.CompanyCode = CustDeclPrev.CompanyCode
and CustDecl.CustomsDeclaration = CustDeclPrev.CustomDeclarationNumber
and ItemLog.StatryRptgEntity = CustDeclPrev.StatryRptgEntity
and ItemLog.StatryRptCategory = CustDeclPrev.StatryRptCategory
and ItemLog.StatryRptRunID = CustDeclPrev.StatryRptRunID
left outer join I_CompanyCode as CompanyCode on CompanyCode.CompanyCode = ItemLog.CompanyCode
{
key ItemLog.StatryRptgEntity,
key ItemLog.StatryRptCategory,
key ItemLog.StatryRptRunID,
key ItemLog.CompanyCode,
key ItemLog.FiscalYear,
key ItemLog.PostingFiscalPeriod as FiscalPeriod,
key ItemLog.CustomsDeclaration as CustomDeclarationNumber,
key KZ_VATReturnSection as SectionNum,
-- key KZ_VATLineItem as LineItem,
key cast( KZ_VATLineItem as numc08) as LineItem,
CustDecl.CustomsDeclarationRegDate as CustomDeclDate,
@Semantics.amount.currencyCode: 'Currency'
CustDecl.TaxAmount as LocalVATAMount,
CustDecl.PaymentDate as PaymentLimitDate,
@Semantics.amount.currencyCode: 'Currency'
CustDecl.PaidAmountInPaytCurrency as PaidVATAmount,
@Semantics.amount.currencyCode: 'Currency'
CustDeclPrev.PaidVATAmount as PaidVATAmountPrev,
@Semantics.amount.currencyCode: 'Currency'
CustDecl.TaxAmount - ( CustDecl.PaidAmountInPaytCurrency + coalesce( CustDeclPrev.PaidVATAmount, 0 ) ) as VatDebt,
CompanyCode.Currency,
concat(substring(PaymentDate, 7, 2),
concat('.',concat(substring(PaymentDate, 5, 2),
concat('.',substring(PaymentDate, 1, 4))))) as PaymentLimitDateXML
}
where
ItemLog.FiscalYear = $parameters.P_FiscalYear
and ItemLog.PostingFiscalPeriod = $parameters.P_FiscalPeriod
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_COMPANYCODE",
"I_KZ_VATCSTMDECLNITEMLOG",
"P_KZ_CUSTOMDECLARATION",
"P_KZ_CUSTOMDECLARATIONPREV"
],
"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