P_PT_DocItemPartner

DDL: P_PT_DOCITEMPARTNER SQL: PTDOCITEMPARTER Type: view CONSUMPTION Package: GLO_FIN_IS_VAT_PT

View to select all partner and customer line item

P_PT_DocItemPartner is a Consumption CDS View that provides data about "View to select all partner and customer line item" in SAP S/4HANA. It reads from 2 data sources (I_AccountingDocument, I_OperationalAcctgDocItem) and exposes 27 fields with key fields CompanyCode, FiscalYear, AccountingDocument, AccountingDocumentItem. Part of development package GLO_FIN_IS_VAT_PT.

Data Sources (2)

SourceAliasJoin Type
I_AccountingDocument H inner
I_OperationalAcctgDocItem I from

Annotations (11)

NameValueLevelField
AbapCatalog.sqlViewName PTDOCITEMPARTER view
VDM.viewType #CONSUMPTION view
VDM.private true view
AbapCatalog.preserveKey true view
ClientHandling.type #INHERITED view
ClientHandling.algorithm #SESSION_VARIABLE view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.serviceQuality #X view
AbapCatalog.compiler.compareFilter true view
EndUserText.label View to select all partner and customer line item view

Fields (27)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode I_OperationalAcctgDocItem CompanyCode
KEY FiscalYear I_OperationalAcctgDocItem FiscalYear
KEY AccountingDocument I_OperationalAcctgDocItem AccountingDocument
KEY AccountingDocumentItem I_OperationalAcctgDocItem AccountingDocumentItem
ClearingDate I_OperationalAcctgDocItem ClearingDate
PostingDate I_OperationalAcctgDocItem PostingDate
Customer I_OperationalAcctgDocItem Customer
Supplier I_OperationalAcctgDocItem Supplier
DocumentDate I_OperationalAcctgDocItem DocumentDate
DebitCreditCode I_OperationalAcctgDocItem DebitCreditCode
WithholdingTaxCode I_OperationalAcctgDocItem WithholdingTaxCode
BalanceTransactionCurrency I_OperationalAcctgDocItem BalanceTransactionCurrency
TransactionCurrency I_OperationalAcctgDocItem TransactionCurrency
IsSalesRelated I_OperationalAcctgDocItem IsSalesRelated
IsUsedInPaymentTransaction I_OperationalAcctgDocItem IsUsedInPaymentTransaction
FinancialAccountType I_OperationalAcctgDocItem FinancialAccountType
VATRegistration I_OperationalAcctgDocItem VATRegistration
CompanyCodeCurrency I_AccountingDocument CompanyCodeCurrency
ExchangeRate I_AccountingDocument ExchangeRate
AccountingDocumentType I_AccountingDocument AccountingDocumentType
SupplierVATRegistration _Supplier VATRegistration
CustomerVATRegistration _Customer VATRegistration
VATRegistrationCountry
SupplierVATRegistrationCountry
CustomerVATRegistrationCountry
OneTimeVendor _Supplier IsOneTimeAccount
OneTimeCustomer _Customer IsOneTimeAccount
@AbapCatalog.sqlViewName: 'PTDOCITEMPARTER'
@VDM.viewType: #CONSUMPTION
@VDM.private: true
@AbapCatalog.preserveKey:true
@ClientHandling: { type: #INHERITED, algorithm: #SESSION_VARIABLE }
@ObjectModel.usageType: { dataClass: #MIXED, sizeCategory: #XL, serviceQuality: #X }
@AbapCatalog.compiler.compareFilter: true
@EndUserText.label: 'View to select all partner and customer line item'
define view P_PT_DocItemPartner
  as select from I_OperationalAcctgDocItem as I
    inner join   I_AccountingDocument      as H on  H.CompanyCode        = I.CompanyCode
                                                and H.AccountingDocument = I.AccountingDocument
                                                and H.FiscalYear         = I.FiscalYear
{
  key I.CompanyCode,
  key I.FiscalYear,
  key I.AccountingDocument,
  key I.AccountingDocumentItem,
      I.ClearingDate,
      I.PostingDate,
      I.Customer,
      I.Supplier,
      I.DocumentDate,
      I.DebitCreditCode,
      I.WithholdingTaxCode,
      I.BalanceTransactionCurrency,
//      I.CashDiscountAmtInCoCodeCrcy,

      I.TransactionCurrency, 
      I.IsSalesRelated,
      I.IsUsedInPaymentTransaction,
      I.FinancialAccountType,
      I.VATRegistration,
      H.CompanyCodeCurrency,
      H.ExchangeRate,
      H.AccountingDocumentType,
      _Supplier.VATRegistration          as SupplierVATRegistration,
      _Customer.VATRegistration          as CustomerVATRegistration,
      left(I.VATRegistration, 2)         as VATRegistrationCountry,
      left(_Supplier.VATRegistration, 2) as SupplierVATRegistrationCountry,
      left(_Customer.VATRegistration, 2) as CustomerVATRegistrationCountry,
      _Supplier.IsOneTimeAccount         as OneTimeVendor,
      _Customer.IsOneTimeAccount         as OneTimeCustomer,

      case
      when I.FinancialAccountType = 'K'
      then I.AmountInCompanyCodeCurrency * -1
      else I.AmountInCompanyCodeCurrency
      end                                as AmountInCompanyCodeCurrency,

      case
      when I.FinancialAccountType = 'K'
      then I.WithholdingTaxAmount * -1
      else I.WithholdingTaxAmount
      end                                as WithholdingTaxAmount,

      case
      when I.FinancialAccountType = 'K'
      then I.CashDiscountAmount  * -1
      else I.CashDiscountAmount
      end                                as CashDiscountAmount,
      
      case
      when I.FinancialAccountType = 'K'
      then I.CashDiscountAmtInCoCodeCrcy  * -1
      else I.CashDiscountAmtInCoCodeCrcy
      end                                as CashDiscountAmtInCoCodeCrcy


}

where
  (
       I.FinancialAccountType = 'K'
    or I.FinancialAccountType = 'D'
  )