P_KZ_VATRetOutDoc
Selection for outgoing documents
P_KZ_VATRetOutDoc is a Composite CDS View that provides data about "Selection for outgoing documents" in SAP S/4HANA. It reads from 2 data sources (P_KZ_BillingMaterialDetails, P_KZ_JournalEntryItemLdngLdgr) and exposes 46 fields. Part of development package GLO_FIN_IS_VAT_KZ_RETURN.
Data Sources (2)
| Source | Alias | Join Type |
|---|---|---|
| P_KZ_BillingMaterialDetails | BillingMaterial | left_outer |
| P_KZ_JournalEntryItemLdngLdgr | DocumentItem | left_outer |
Annotations (6)
| Name | Value | Level | Field |
|---|---|---|---|
| AbapCatalog.sqlViewName | PKZVATRETOUTDOC | view | |
| AccessControl.authorizationCheck | #NOT_REQUIRED | view | |
| VDM.viewType | #COMPOSITE | view | |
| VDM.private | true | view | |
| AbapCatalog.compiler.compareFilter | true | view | |
| ClientHandling.algorithm | #SESSION_VARIABLE | view |
Fields (46)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| CompanyCode | LogItems | CompanyCode | ||
| AccountingDocument | LogItems | AccountingDocument | ||
| FiscalYear | LogItems | FiscalYear | ||
| TaxCode | LogItems | TaxCode | ||
| TaxRate | LogItems | TaxRate | ||
| AmountSign | LogItems | AmountSign | ||
| NegativeSign | LogItems | NegativeSign | ||
| AmountInCompanyCodeCurrency | P_KZ_JournalEntryItemLdngLdgr | AmountInCompanyCodeCurrency | ||
| TaxBaseAmountInCoCodeCrcy | LogItems | TaxBaseAmountInCoCodeCrcy | ||
| TaxAmountInCoCodeCrcy | LogItems | TaxAmountInCoCodeCrcy | ||
| TaxBaseAmountInCoCodeCrcyABS | ||||
| AmountInCompanyCodeCurrencyABS | ||||
| TaxBaseAmountInCoCodeCrcyTot | LogItems | TaxBaseAmountInCoCodeCrcy | ||
| TaxAmountInCoCodeCrcyTot | LogItems | TaxAmountInCoCodeCrcy | ||
| TransactionTypeDetermination | LogItems | TransactionTypeDetermination | ||
| PostingDate | LogItems | PostingDate | ||
| TaxReportingDate | LogItems | TaxReportingDate | ||
| AccountingDocumentType | LogItems | AccountingDocumentType | ||
| IsReversal | LogItems | IsReversal | ||
| IsReversed | LogItems | IsReversed | ||
| OriginalReferenceDocument | LogItems | OriginalReferenceDocument | ||
| ReferenceDocumentType | LogItems | ReferenceDocumentType | ||
| DocumentReferenceID | LogItems | DocumentReferenceID | ||
| BusinessTransactionType | LogItems | BusinessTransactionType | ||
| SenderLogicalSystem | LogItems | SenderLogicalSystem | ||
| AccountingDocumentHeaderText | LogItems | AccountingDocumentHeaderText | ||
| AccountingDocCreatedByUser | LogItems | AccountingDocCreatedByUser | ||
| Reference1InDocumentHeader | LogItems | Reference1InDocumentHeader | ||
| Reference2InDocumentHeader | LogItems | Reference2InDocumentHeader | ||
| DocumentItemText | LogItems | DocumentItemText | ||
| CompanyCodeCurrency | LogItems | CompanyCodeCurrency | ||
| Currency | LogItems | Currency | ||
| StatryRptgEntity | LogItems | StatryRptgEntity | ||
| StatryRptCategory | LogItems | StatryRptCategory | ||
| StatryRptRunID | LogItems | StatryRptRunID | ||
| AccountingDocumentItem | LogItems | AccountingDocumentItem | ||
| KZ_VATReturnSectionType | LogItems | KZ_VATReturnSectionType | ||
| Material | P_KZ_BillingMaterialDetails | Material | ||
| PurchasingDocument | P_KZ_JournalEntryItemLdngLdgr | PurchasingDocument | ||
| PurchasingDocumentItem | P_KZ_JournalEntryItemLdngLdgr | PurchasingDocumentItem | ||
| MaterialNameelseendasMaterialName | ||||
| ActivityendasActivity | ||||
| KZ_MaterialSubGroup | P_KZ_BillingMaterialDetails | KZ_MaterialSubGroup | ||
| AnalyticBaseUnit | P_KZ_BillingMaterialDetails | BaseUnit | ||
| AnalyticBillingQuantity | P_KZ_BillingMaterialDetails | BillingQuantity | ||
| AnalyticMaterialName | P_KZ_BillingMaterialDetails | MaterialName |
@AbapCatalog.sqlViewName: 'PKZVATRETOUTDOC'
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.viewType: #COMPOSITE
@VDM.private: true
@AbapCatalog.compiler.compareFilter:true
@ClientHandling.algorithm: #SESSION_VARIABLE
define view P_KZ_VATRetOutDoc
as select distinct from P_KZ_VATReturnSection3 as LogItems
left outer join P_KZ_JournalEntryItemLdngLdgr as DocumentItem on DocumentItem.CompanyCode = LogItems.CompanyCode
and DocumentItem.AccountingDocument = LogItems.AccountingDocument
and DocumentItem.FiscalYear = LogItems.FiscalYear
and DocumentItem.Material <> ''
and (
DocumentItem.TaxCode = LogItems.TaxCode
or DocumentItem.TaxCode = ''
)
left outer join P_KZ_BillingMaterialDetails as BillingMaterial on BillingMaterial.BillingDocument = LogItems.OriginalReferenceDocument
and (
LogItems.ReferenceDocumentType = 'VBRK'
or LogItems.ReferenceDocumentType = 'CF3PS'
)
and BillingMaterial.Material = DocumentItem.Material
{
//P_KZ_VATReturnSection3
LogItems.CompanyCode,
LogItems.AccountingDocument,
LogItems.FiscalYear,
LogItems.TaxCode,
LogItems.TaxRate,
LogItems.AmountSign,
LogItems.NegativeSign,
DocumentItem.AmountInCompanyCodeCurrency,
// case when DocumentItem.AmountInCompanyCodeCurrency is null
// then LogItems.TaxBaseAmountInCoCodeCrcy
// else DocumentItem.AmountInCompanyCodeCurrency
// end as TaxBaseAmountInCoCodeCrcy,
//
// case when DocumentItem.AmountInCompanyCodeCurrency is null
// then LogItems.TaxAmountInCoCodeCrcy
// else //cast( DocumentItem.AmountInCompanyCodeCurrency as abap.fltp ) / cast( LogItems.TaxBaseAmountInCoCodeCrcy as abap.fltp )
// cast ( DIVISION( DocumentItem.AmountInCompanyCodeCurrency, LogItems.TaxBaseAmountInCoCodeCrcy, 2) as abap.dec( 3, 2 ) )
// //* cast( LogItems.TaxAmountInCoCodeCrcy as abap.fltp)
// * LogItems.TaxAmountInCoCodeCrcy
// end as TaxAmountInCoCodeCrcy,
LogItems.TaxBaseAmountInCoCodeCrcy,
LogItems.TaxAmountInCoCodeCrcy,
abs( LogItems.TaxBaseAmountInCoCodeCrcy ) as TaxBaseAmountInCoCodeCrcyABS,
abs( DocumentItem.AmountInCompanyCodeCurrency ) as AmountInCompanyCodeCurrencyABS,
LogItems.TaxBaseAmountInCoCodeCrcy as TaxBaseAmountInCoCodeCrcyTot,
LogItems.TaxAmountInCoCodeCrcy as TaxAmountInCoCodeCrcyTot,
LogItems.TransactionTypeDetermination,
LogItems.PostingDate,
LogItems.TaxReportingDate,
case LogItems.JrnlEntryCntrySpecificDate1
when '' then LogItems.DocumentDate
else LogItems.JrnlEntryCntrySpecificDate1
end as DocumentDate,
LogItems.AccountingDocumentType,
LogItems.IsReversal,
LogItems.IsReversed,
LogItems.OriginalReferenceDocument,
LogItems.ReferenceDocumentType,
LogItems.DocumentReferenceID,
LogItems.BusinessTransactionType,
LogItems.SenderLogicalSystem,
LogItems.AccountingDocumentHeaderText,
LogItems.AccountingDocCreatedByUser,
LogItems.Reference1InDocumentHeader,
LogItems.Reference2InDocumentHeader,
LogItems.DocumentItemText,
LogItems.CompanyCodeCurrency,
LogItems.Currency,
LogItems.StatryRptgEntity,
LogItems.StatryRptCategory,
LogItems.StatryRptRunID,
LogItems.AccountingDocumentItem,
LogItems.KZ_VATReturnSectionType,
BillingMaterial.Material,
DocumentItem.PurchasingDocument,
DocumentItem.PurchasingDocumentItem,
case LogItems.JrnlEntryCntrySpecificRef1
when ''
then case LogItems.DocumentReferenceID when ''
then LogItems.AccountingDocument
else LogItems.DocumentReferenceID
end
else LogItems.JrnlEntryCntrySpecificRef1
end as InvoiceNumber,
case BillingMaterial.KZ_MaterialSubGroup
when 'MIN'
then BillingMaterial.BaseUnit
else cast( '' as meins)
end as BaseUnit,
@Semantics.quantity.unitOfMeasure: 'BaseUnit'
case BillingMaterial.KZ_MaterialSubGroup
when 'MIN'
then BillingMaterial.BillingQuantity
else cast ( 0 as fkimg )
end as BillingQuantity,
case BillingMaterial.KZ_MaterialSubGroup
when 'MIN'
then BillingMaterial.MaterialName
else ''
end as MaterialName,
case BillingMaterial.Activity
when '' then '1'
else BillingMaterial.Activity
end as Activity,
BillingMaterial.KZ_MaterialSubGroup,
BillingMaterial.BaseUnit as AnalyticBaseUnit,
@Semantics.quantity.unitOfMeasure: 'AnalyticBaseUnit'
BillingMaterial.BillingQuantity as AnalyticBillingQuantity,
BillingMaterial.MaterialName as AnalyticMaterialName
}
where
LogItems.KZ_VATReturnSectionType = '07'
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